12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396 |
- From 4e548b6827ab9d2e8a82e0e8b0e5ab5cd891f54b Mon Sep 17 00:00:00 2001
- From: Holger Freyther <ich@tamarin.(none)>
- Date: Thu, 11 Sep 2008 14:55:33 +0200
- Subject: [PATCH] [binutils] EPSON changes to binutils
- ---
- MAKE.sh | 161 ++
- bfd/Makefile.am | 8 +
- bfd/Makefile.in | 8 +
- bfd/archures.c | 2 +
- bfd/bfd-in2.h | 60 +-
- bfd/config.bfd | 5 +
- bfd/configure | 1 +
- bfd/cpu-c33.c | 109 +
- bfd/elf.c | 7 +
- bfd/elf32-c33.c | 2730 +++++++++++++++++++++
- bfd/syms.c | 11 +
- bfd/targets.c | 1 +
- binutils/Makefile.am | 1 +
- binutils/Makefile.in | 1 +
- binutils/objdump.c | 95 +-
- binutils/stabs.c | 7 +
- binutils/version.c | 7 +
- config.sub | 4 +-
- configure.in | 3 +
- gas/Makefile.am | 24 +-
- gas/Makefile.in | 31 +-
- gas/as.c | 851 +++++---
- gas/config/gas/config/tc-c33.c | 4382 ++++++++++++++++++++++++++++++++++
- gas/config/tc-c33.c | 5098 ++++++++++++++++++++++++++++++++++++++++
- gas/config/tc-c33.h | 78 +
- gas/configure | 3 +
- gas/configure.in | 1 +
- gas/doc/Makefile.am | 1 +
- gas/ext_remove.c | 2014 ++++++++++++++++
- gas/ext_remove.h | 176 ++
- gas/input-scrub.c | 31 +-
- gas/read.c | 3438 +++++++++++++++-------------
- gas/stabs.c | 171 +-
- gas/write.c | 2283 +++++++++---------
- include/dis-asm.h | 4 +
- include/elf/c33.h | 128 +
- include/elf/common.h | 6 +
- include/opcode/c33.h | 205 ++
- ld/Makefile.am | 3 +
- ld/Makefile.in | 3 +
- ld/configure.tgt | 1 +
- ld/emulparams/c33.sh | 10 +
- ld/emultempl/c33.em | 128 +
- ld/ldlang.c | 2986 ++++++++++++-----------
- ld/ldmain.c | 711 +++---
- ld/ldver.c | 18 +-
- ld/lexsup.c | 1335 ++++++-----
- ld/scripttempl/c33.sc | 98 +
- opcodes/Makefile.am | 8 +
- opcodes/Makefile.in | 8 +
- opcodes/c33-dis.c | 2824 ++++++++++++++++++++++
- opcodes/c33-opc.c | 2146 +++++++++++++++++
- opcodes/configure | 1 +
- opcodes/configure.in | 1 +
- opcodes/disassemble.c | 9 +
- 55 files changed, 26899 insertions(+), 5537 deletions(-)
- create mode 100755 MAKE.sh
- create mode 100644 bfd/cpu-c33.c
- create mode 100644 bfd/elf32-c33.c
- create mode 100644 gas/config/gas/config/tc-c33.c
- create mode 100644 gas/config/tc-c33.c
- create mode 100644 gas/config/tc-c33.h
- create mode 100644 gas/ext_remove.c
- create mode 100644 gas/ext_remove.h
- create mode 100644 include/elf/c33.h
- create mode 100644 include/opcode/c33.h
- create mode 100644 ld/emulparams/c33.sh
- create mode 100644 ld/emultempl/c33.em
- create mode 100644 ld/scripttempl/c33.sc
- create mode 100644 opcodes/c33-dis.c
- create mode 100644 opcodes/c33-opc.c
- diff --git a/MAKE.sh b/MAKE.sh
- new file mode 100755
- index 0000000..09c88de
- --- /dev/null
- +++ b/MAKE.sh
- @@ -0,0 +1,161 @@
- +#!/bin/sh
- +
- +echo "@@@@@ START: `date`"
- +
- +CROSS_TARGET=c33-epson-elf
- +INSTDIR=/usr/local/c33
- +PREFIX=c33-epson-elf-
- +TARGETS="ld as objdump"
- +TARGETS=$TARGETS" ar ranlib objcopy nm strip size strings"
- +TARGETS=$TARGETS" readelf addr2line cxxfilt"
- +WORKDIR=c33-binutils
- +ARCHIVE_DIR=$WORKDIR/archive
- +ARCHIVE_DATE=`date +%y%m%d`
- +
- +SRCDIR=binutils-2.10.1
- +
- +
- +case `uname -s` in
- +CYGWIN*)
- + EXE=.exe
- + ;;
- +Linux*)
- + EXE=
- + ;;
- +*)
- + EXE=
- + ;;
- +esac
- +LANG=C
- +
- +clean=no
- +config=no
- +build=no
- +install=no
- +tags=no
- +archive=no
- +
- +if [ $# -eq 0 ]; then
- + clean=yes
- + config=yes
- + build=yes
- + install=yes
- + tags=yes
- +fi
- +
- +while [ $# -gt 0 ]; do
- + case $1 in
- + all)
- + clean=yes
- + config=yes
- + build=yes
- + install=yes
- + tags=yes
- + ;;
- + clean)
- + clean=yes
- + ;;
- + config)
- + config=yes
- + ;;
- + build)
- + build=yes
- + ;;
- + install)
- + install=yes
- + ;;
- + tags)
- + tags=yes
- + ;;
- + archive)
- + archive=yes
- + ;;
- + esac
- +
- + shift
- +done
- +
- +if [ "$clean" = "yes" ]; then
- + echo "@@@@@ CLEAN: `date`"
- +
- + if [ -e $$WORKDIR ]; then
- + mv $WORKDIR $WORKDIR-gomi
- + rm -rf $WORKDIR-gomi
- + fi
- +fi
- +
- +if [ "$config" = "yes" ]; then
- + echo "@@@@@ CONFIG: `date`"
- +
- + mkdir $WORKDIR
- + (cd $WORKDIR; \
- + ../$SRCDIR/configure \
- + --target=$CROSS_TARGET \
- + --prefix=$INSTDIR ) || exit 1
- +fi
- +
- +if [ "$build" = "yes" ]; then
- + echo "@@@@@ BUILD: `date`"
- +
- +# (cd $WORKDIR; make) || exit 1
- + (cd $WORKDIR; make clean all) || exit 1
- +
- + cp $WORKDIR/ld/ld-new$EXE c33-ld$EXE
- + cp $WORKDIR/gas/as-new$EXE c33-as$EXE
- + cp $WORKDIR/binutils/objdump$EXE c33-objdump$EXE
- +
- + cp $WORKDIR/binutils/addr2line$EXE c33-addr2line$EXE
- + cp $WORKDIR/binutils/ar$EXE c33-ar$EXE
- + cp $WORKDIR/binutils/cxxfilt$EXE c33-cxxfilt$EXE
- + cp $WORKDIR/binutils/nm-new$EXE c33-nm$EXE
- + cp $WORKDIR/binutils/objcopy$EXE c33-objcopy$EXE
- + cp $WORKDIR/binutils/ranlib$EXE c33-ranlib$EXE
- + cp $WORKDIR/binutils/readelf$EXE c33-readelf$EXE
- + cp $WORKDIR/binutils/size$EXE c33-size$EXE
- + cp $WORKDIR/binutils/strings$EXE c33-strings$EXE
- + cp $WORKDIR/binutils/strip-new$EXE c33-strip$EXE
- +
- +
- + for i in $TARGETS; do
- + strip c33-$i$EXE
- + done
- +
- + cp c33-as$EXE as_org$EXE
- + cp c33-ld$EXE ld$EXE
- + cp c33-objdump$EXE objdump$EXE
- +
- +fi
- +
- +if [ "$install" = "yes" ]; then
- + echo "@@@@@ INSTALL: `date`"
- +
- + mkdir -p $INSTDIR/bin
- + for i in $TARGETS; do
- + cp -p c33-$i$EXE $INSTDIR/bin/$PREFIX$i$EXE
- + done
- +fi
- +
- +if [ "$tags" = "yes" ]; then
- + echo "@@@@@ TAGS: `date`"
- +
- + rm -rf tags
- + ctags -R $SRCDIR
- +fi
- +
- +if [ "$archive" = "yes" ]; then
- + echo "@@@@@ ARCHIVE: `date`"
- + mkdir -p $ARCHIVE_DIR
- +
- + echo "Archive to '$ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz'"
- + if [ -f $ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz ]; then
- + echo -n "This file is exist. Really over write? "
- + read x
- + fi
- + tar cfz $ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz \
- + MAKE.sh \
- + $SRCDIR
- +fi
- +
- +echo "@@@@@ DONE: `date`"
- +
- +exit 0
- diff --git a/bfd/Makefile.am b/bfd/Makefile.am
- index 2d38959..116cf71 100644
- --- a/bfd/Makefile.am
- +++ b/bfd/Makefile.am
- @@ -68,6 +68,7 @@ ALL_MACHINES = \
- cpu-tic30.lo \
- cpu-tic80.lo \
- cpu-v850.lo \
- + cpu-c33.lo \
- cpu-vax.lo \
- cpu-we32k.lo \
- cpu-w65.lo \
- @@ -105,6 +106,7 @@ ALL_MACHINES_CFILES = \
- cpu-tic30.c \
- cpu-tic80.c \
- cpu-v850.c \
- + cpu-c33.c \
- cpu-vax.c \
- cpu-we32k.c \
- cpu-w65.c \
- @@ -180,6 +182,7 @@ BFD32_BACKENDS = \
- elf32-sh.lo \
- elf32-sparc.lo \
- elf32-v850.lo \
- + elf32-c33.lo \
- elf32.lo \
- elflink.lo \
- epoc-pe-arm.lo \
- @@ -310,6 +313,7 @@ BFD32_BACKENDS_CFILES = \
- elf32-sh.c \
- elf32-sparc.c \
- elf32-v850.c \
- + elf32-c33.c \
- elf32.c \
- elflink.c \
- epoc-pe-arm.c \
- @@ -716,6 +720,7 @@ cpu-sparc.lo: cpu-sparc.c
- cpu-tic30.lo: cpu-tic30.c
- cpu-tic80.lo: cpu-tic80.c
- cpu-v850.lo: cpu-v850.c
- +cpu-c33.lo: cpu-c33.c
- cpu-vax.lo: cpu-vax.c
- cpu-we32k.lo: cpu-we32k.c
- cpu-w65.lo: cpu-w65.c
- @@ -918,6 +923,9 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \
- elf32-v850.lo: elf32-v850.c $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
- +elf32-c33.lo: elf32-c33.c $(INCDIR)/bfdlink.h elf-bfd.h \
- + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- + $(INCDIR)/elf/c33.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
- elf32.lo: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- elfcore.h elflink.h
- diff --git a/bfd/Makefile.in b/bfd/Makefile.in
- index bb8e06c..39992f4 100644
- --- a/bfd/Makefile.in
- +++ b/bfd/Makefile.in
- @@ -183,6 +183,7 @@ ALL_MACHINES = \
- cpu-tic30.lo \
- cpu-tic80.lo \
- cpu-v850.lo \
- + cpu-c33.lo \
- cpu-vax.lo \
- cpu-we32k.lo \
- cpu-w65.lo \
- @@ -221,6 +222,7 @@ ALL_MACHINES_CFILES = \
- cpu-tic30.c \
- cpu-tic80.c \
- cpu-v850.c \
- + cpu-c33.c \
- cpu-vax.c \
- cpu-we32k.c \
- cpu-w65.c \
- @@ -297,6 +299,7 @@ BFD32_BACKENDS = \
- elf32-sh.lo \
- elf32-sparc.lo \
- elf32-v850.lo \
- + elf32-c33.lo \
- elf32.lo \
- elflink.lo \
- epoc-pe-arm.lo \
- @@ -428,6 +431,7 @@ BFD32_BACKENDS_CFILES = \
- elf32-sh.c \
- elf32-sparc.c \
- elf32-v850.c \
- + elf32-c33.c \
- elf32.c \
- elflink.c \
- epoc-pe-arm.c \
- @@ -1244,6 +1248,7 @@ cpu-sparc.lo: cpu-sparc.c
- cpu-tic30.lo: cpu-tic30.c
- cpu-tic80.lo: cpu-tic80.c
- cpu-v850.lo: cpu-v850.c
- +cpu-c33.lo: cpu-c33.c
- cpu-vax.lo: cpu-vax.c
- cpu-we32k.lo: cpu-we32k.c
- cpu-w65.lo: cpu-w65.c
- @@ -1446,6 +1451,9 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \
- elf32-v850.lo: elf32-v850.c $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
- +elf32-c33.lo: elf32-c33.c $(INCDIR)/bfdlink.h elf-bfd.h \
- + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- + $(INCDIR)/elf/c33.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
- elf32.lo: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- elfcore.h elflink.h
- diff --git a/bfd/archures.c b/bfd/archures.c
- index 7462592..9bb6a1c 100644
- --- a/bfd/archures.c
- +++ b/bfd/archures.c
- @@ -274,6 +274,7 @@ extern const bfd_arch_info_type bfd_z8k_arch;
- extern const bfd_arch_info_type bfd_ns32k_arch;
- extern const bfd_arch_info_type bfd_w65_arch;
- extern const bfd_arch_info_type bfd_v850_arch;
- +extern const bfd_arch_info_type bfd_c33_arch;
- extern const bfd_arch_info_type bfd_fr30_arch;
- extern const bfd_arch_info_type bfd_mcore_arch;
- extern const bfd_arch_info_type bfd_avr_arch;
- @@ -314,6 +315,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
- &bfd_ns32k_arch,
- &bfd_w65_arch,
- &bfd_v850_arch,
- + &bfd_c33_arch,
- &bfd_fr30_arch,
- &bfd_mcore_arch,
- &bfd_avr_arch,
- diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
- index 4c3eea0..6988b50 100644
- --- a/bfd/bfd-in2.h
- +++ b/bfd/bfd-in2.h
- @@ -1420,6 +1420,8 @@ enum bfd_architecture
- #define bfd_mach_avr2 2
- #define bfd_mach_avr3 3
- #define bfd_mach_avr4 4
- + bfd_arch_c33, /* 追加 2001.2.19 ide */
- +#define bfd_mach_c33 0 /* 追加 2001.2.19 ide */
- bfd_arch_last
- };
-
- @@ -1515,11 +1517,32 @@ typedef enum bfd_reloc_status
- /* The symbol to relocate against was undefined. */
- bfd_reloc_undefined,
-
- +/* add tazaki 2001.11.20 >>>>> */
- + bfd_reloc_over_doff_globalpointer,
- + bfd_reloc_over_goff_globalpointer,
- + bfd_reloc_over_soff_globalpointer,
- + bfd_reloc_over_toff_globalpointer,
- + bfd_reloc_over_zoff_globalpointer,
- + bfd_reloc_doff_over_64mb,
- + bfd_reloc_doff_over_8kb,
- + bfd_reloc_goff_over_8kb,
- + bfd_reloc_soff_over_64mb,
- + bfd_reloc_soff_over_8kb,
- + bfd_reloc_toff_over_64mb,
- + bfd_reloc_toff_over_8kb,
- + bfd_reloc_zoff_over_64mb,
- + bfd_reloc_zoff_over_8kb,
- + bfd_reloc_dpoff_over_512kb,
- + bfd_reloc_dpoff_over_64b,
- +/* add tazaki 2001.11.20 <<<<< */
- +
- /* The relocation was performed, but may not be ok - presently
- generated only when linking i960 coff files with i960 b.out
- symbols. If this type is returned, the error_message argument
- to bfd_perform_relocation will be set. */
- bfd_reloc_dangerous
- +
- +
- }
- bfd_reloc_status_type;
-
- @@ -2376,6 +2399,39 @@ value of SUBI insn. */
- into 22 bits. */
- BFD_RELOC_AVR_CALL,
-
- +
- + /* cc33 relocations */
- + BFD_RELOC_C33_AH,
- + BFD_RELOC_C33_AL,
- + BFD_RELOC_C33_RH,
- + BFD_RELOC_C33_RM,
- + BFD_RELOC_C33_RL,
- + BFD_RELOC_C33_S_RH, /* add tazaki 2002.05.02 */
- + BFD_RELOC_C33_S_RM, /* add tazaki 2002.05.02 */
- + BFD_RELOC_C33_S_RL, /* add tazaki 2002.05.02 */
- + BFD_RELOC_C33_JP, /* add tazaki 2002.04.22 */
- + BFD_RELOC_C33_H,
- + BFD_RELOC_C33_M,
- + BFD_RELOC_C33_L,
- + BFD_RELOC_C33_DH, /* add tazaki 2002.01.11 */
- + BFD_RELOC_C33_DL, /* add tazaki 2002.01.11 */
- + BFD_RELOC_C33_GL, /* add tazaki 2001.07.13 */
- + BFD_RELOC_C33_SH, /* add tazaki 2001.11.07 */
- + BFD_RELOC_C33_SL, /* add tazaki 2001.07.13 */
- + BFD_RELOC_C33_TH, /* add tazaki 2001.11.07 */
- + BFD_RELOC_C33_TL, /* add tazaki 2001.07.13 */
- + BFD_RELOC_C33_ZH, /* add tazaki 2001.11.07 */
- + BFD_RELOC_C33_ZL, /* add tazaki 2001.07.13 */
- + BFD_RELOC_C33_DPH,/* add tazaki 2001.11.08 */
- + BFD_RELOC_C33_DPM,/* add tazaki 2001.11.08 */
- + BFD_RELOC_C33_DPL,/* add tazaki 2001.11.08 */
- + BFD_RELOC_C33_LOOP,/* add tazaki 2002.03.05 */
- + BFD_RELOC_C33_PUSHN_R0, /* add tazaki 2004/08/19 */
- + BFD_RELOC_C33_PUSHN_R1, /* add tazaki 2004/08/19 */
- + BFD_RELOC_C33_PUSH_R1, /* add tazaki 2004/08/19 */
- +
- +
- +
- /* These two relocations are used by the linker to determine which of
- the entries in a C++ virtual function table are actually used. When
- the --gc-sections option is given, the linker will zero out the entries
- @@ -2395,7 +2451,9 @@ is stored in the reloc's addend. For Rel hosts, we are forced to put
- this offset in the reloc's section offset. */
- BFD_RELOC_VTABLE_INHERIT,
- BFD_RELOC_VTABLE_ENTRY,
- - BFD_RELOC_UNUSED };
- + BFD_RELOC_UNUSED,
- +
- + };
- typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
- reloc_howto_type *
-
- diff --git a/bfd/config.bfd b/bfd/config.bfd
- index 3adc5ae..b5f041f 100755
- --- a/bfd/config.bfd
- +++ b/bfd/config.bfd
- @@ -44,6 +44,7 @@ powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
- rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
- sparc*) targ_archs=bfd_sparc_arch ;;
- v850*) targ_archs=bfd_v850_arch ;;
- +c33*) targ_archs=bfd_c33_arch ;;
- z8k*) targ_archs=bfd_z8k_arch ;;
- *) targ_archs=bfd_${targ_cpu}_arch ;;
- esac
- @@ -767,6 +768,10 @@ case "${targ}" in
- ;;
-
-
- + c33-*-*)
- + targ_defvec=bfd_elf32_c33_vec
- + ;;
- +
- v850-*-*)
- targ_defvec=bfd_elf32_v850_vec
- ;;
- diff --git a/bfd/configure b/bfd/configure
- index 89f979e..1bd4958 100755
- --- a/bfd/configure
- +++ b/bfd/configure
- @@ -5111,6 +5111,7 @@ do
- bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
- bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
- bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
- + bfd_elf32_c33_vec) tb="$tb elf32-c33.lo elf32.lo $elf" ;;
- bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- target64=true ;;
- bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
- diff --git a/bfd/cpu-c33.c b/bfd/cpu-c33.c
- new file mode 100644
- index 0000000..384f51c
- --- /dev/null
- +++ b/bfd/cpu-c33.c
- @@ -0,0 +1,109 @@
- +/* BFD support for the NEC V850 processor
- + Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
- +
- +This file is part of BFD, the Binary File Descriptor library.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +#include "bfd.h"
- +#include "sysdep.h"
- +#include "libbfd.h"
- +
- +#include <ctype.h>
- +
- +static boolean
- +scan (info, string)
- + const struct bfd_arch_info * info;
- + const char * string;
- +{
- + const char *ptr_src;
- + const char *ptr_tst;
- + unsigned long number;
- + enum bfd_architecture arch;
- +
- + /* First test for an exact match */
- + if (strcasecmp (string, info->printable_name) == 0)
- + return true;
- +
- + /* See how much of the supplied string matches with the
- + architecture, eg the string m68k:68020 would match the m68k entry
- + up to the :, then we get left with the machine number */
- +
- + for (ptr_src = string, ptr_tst = info->arch_name;
- + *ptr_src && *ptr_tst;
- + ptr_src++, ptr_tst++)
- + {
- + if (*ptr_src != *ptr_tst) break;
- + }
- +
- + /* Chewed up as much of the architecture as will match, skip any
- + colons */
- + if (*ptr_src == ':')
- + ptr_src++;
- +
- + if (*ptr_src == 0)
- + {
- + /* nothing more, then only keep this one if it is the default
- + machine for this architecture */
- + return info->the_default;
- + }
- +
- + number = 0;
- + while (isdigit ((unsigned char) *ptr_src))
- + {
- + number = number * 10 + * ptr_src - '0';
- + ptr_src++;
- + }
- +
- + switch (number)
- + {
- +#if 0
- + case bfd_mach_v850e: arch = bfd_arch_v850; break;
- + case bfd_mach_v850ea: arch = bfd_arch_v850; break;
- +#endif
- + default:
- + return false;
- + }
- +
- + if (arch != info->arch)
- + return false;
- +
- + if (number != info->mach)
- + return false;
- +
- + return true;
- +}
- +
- +#define N(number, print, default, next) \
- +{ 32, 32, 8, bfd_arch_c33, number, "c33", print, 2, default, \
- + bfd_default_compatible, scan, next }
- +
- +#define NEXT NULL
- +#if 0
- +static const bfd_arch_info_type arch_info_struct[] =
- +{
- + N (bfd_mach_v850e, "v850e", false, &arch_info_struct[1]),
- + N (bfd_mach_v850ea, "v850ea", false, NULL)
- +};
- +#undef NEXT
- +#define NEXT &arch_info_struct[0]
- +
- +const bfd_arch_info_type bfd_c33_arch =
- + N (bfd_mach_c33, "c33", true, NEXT);
- +#endif
- +
- +
- +const bfd_arch_info_type bfd_c33_arch =
- + N (0, "c33", true, NULL);
- diff --git a/bfd/elf.c b/bfd/elf.c
- index e8e7e37..b591ee4 100644
- --- a/bfd/elf.c
- +++ b/bfd/elf.c
- @@ -392,6 +392,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
- The symbols will be defined as weak, so that multiple definitions
- are permitted. The GNU linker extension is to actually discard
- all but one of the sections. */
- +
- if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
- flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-
- @@ -3306,6 +3307,12 @@ prep_headers (abfd)
- case bfd_arch_pj:
- i_ehdrp->e_machine = EM_PJ;
- break;
- +/* >>>>> ADDED D.Fujimoto 2007/10/15 Seiko Epson processor (S1C33) */
- + // this flag will be written in o and elf files
- + case bfd_arch_c33:
- + i_ehdrp->e_machine = EM_SE_C33;
- + break;
- +/* <<<<< ADDED D.Fujimoto 2007/10/15 Seiko Epson processor (S1C33) */
- /* also note that EM_M32, AT&T WE32100 is unknown to bfd */
- default:
- i_ehdrp->e_machine = EM_NONE;
- diff --git a/bfd/elf32-c33.c b/bfd/elf32-c33.c
- new file mode 100644
- index 0000000..ba5d1c8
- --- /dev/null
- +++ b/bfd/elf32-c33.c
- @@ -0,0 +1,2730 @@
- +/* c33-specific support for 32-bit ELF
- + Copyright (C) 1996, 1997, 1998, 1999,2001 Free Software Foundation, Inc.
- +
- +This file is part of BFD, the Binary File Descriptor library.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +
- +
- +/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
- + dependencies. As is the gas & simulator code or the c33. */
- +
- +
- +#include "bfd.h"
- +#include "sysdep.h"
- +#include "bfdlink.h"
- +#include "libbfd.h"
- +#include "elf-bfd.h"
- +#include "elf/c33.h"
- +#include "libiberty.h" // ADDED D.Fujimoto 2007/10/02
- +
- +/* sign-extend a 24-bit number */
- +#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
- +
- +static reloc_howto_type *c33_elf_reloc_type_lookup
- + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
- +static void c33_elf_info_to_howto_rel
- + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
- +static void c33_elf_info_to_howto_rela
- + PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
- +static bfd_reloc_status_type c33_elf_reloc
- + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
- +static boolean c33_elf_is_local_label_name
- + PARAMS ((bfd *, const char *));
- +static boolean c33_elf_relocate_section
- + PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
- + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
- +static bfd_reloc_status_type c33_elf_perform_relocation
- + PARAMS ((bfd *, int, bfd_vma, bfd_byte *,unsigned long));
- +static boolean c33_elf_check_relocs
- + PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
- +
- +#if 0
- +static void remember_ah_reloc
- + PARAMS ((bfd *, bfd_vma, bfd_byte *));
- +static bfd_byte * find_remembered_ah_reloc
- + PARAMS ((bfd_vma,bfd_byte*));
- +#endif
- +
- +static bfd_reloc_status_type c33_elf_final_link_relocate
- + PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
- + bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int));
- +#if 0
- +static boolean c33_elf_object_p
- + PARAMS ((bfd *));
- +#endif
- +static boolean c33_elf_fake_sections
- + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
- +#if 0
- +static void c33_elf_final_write_processing
- + PARAMS ((bfd *, boolean));
- +#endif
- +static boolean c33_elf_set_private_flags
- + PARAMS ((bfd *, flagword));
- +static boolean c33_elf_copy_private_bfd_data
- + PARAMS ((bfd *, bfd *));
- +static const char* c33_elf_get_mode_string
- + PARAMS ((char mode_flag));
- +static boolean c33_elf_merge_private_bfd_data
- + PARAMS ((bfd *, bfd *));
- +static boolean c33_elf_print_private_bfd_data
- + PARAMS ((bfd *, PTR));
- +static boolean c33_elf_section_from_bfd_section
- + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *));
- +static void c33_elf_symbol_processing
- + PARAMS ((bfd *, asymbol *));
- +static boolean c33_elf_add_symbol_hook
- + PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
- + const char **, flagword *, asection **, bfd_vma *));
- +static boolean c33_elf_link_output_symbol_hook
- + PARAMS ((bfd *, struct bfd_link_info *, const char *,
- + Elf_Internal_Sym *, asection *));
- +static boolean c33_elf_section_from_shdr
- + PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
- +
- +/* シンボルのリロケーション情報 */
- +/* Note: It is REQUIRED that the 'type' value of each entry in this array
- + match the index of the entry in the array. */
- +static reloc_howto_type c33_elf_howto_table[] =
- +{
- + /* This reloc does nothing. */
- + HOWTO (R_C33_NONE, /* type */
- + 0, /* rightshift */
- + 2, /* size (0 = byte, 1 = short, 2 = long) */
- + 32, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_bitfield, /* complain_on_overflow */
- + bfd_elf_generic_reloc, /* special_function */
- + "R_C33_NONE", /* name */
- + false, /* partial_inplace */
- + 0, /* src_mask */
- + 0, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* Simple 32bit reloc. */
- + HOWTO (R_C33_32, /* type */
- + 0, /* rightshift */
- + 2, /* size (0 = byte, 1 = short, 2 = long) */
- + 32, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + bfd_elf_generic_reloc, /* special_function */
- + "R_C33_32", /* name */
- + false, /* partial_inplace */
- + 0xffffffff, /* src_mask */
- + 0xffffffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* Simple 16bit reloc. */
- + HOWTO (R_C33_16, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 16, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + bfd_elf_generic_reloc, /* special_function */
- + "R_C33_16", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* Simple 8bit reloc. */
- + HOWTO (R_C33_8, /* type */
- + 0, /* rightshift */
- + 0, /* size (0 = byte, 1 = short, 2 = long) */
- + 8, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + bfd_elf_generic_reloc, /* special_function */
- + "R_C33_8", /* name */
- + false, /* partial_inplace */
- + 0xff, /* src_mask */
- + 0xff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @ah LABEL(25:13) */
- + HOWTO (R_C33_AH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_AH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @al LABEL(12:0) */
- + HOWTO (R_C33_AL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_AL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @rh <LABEL-PC>(31:22) */
- + HOWTO (R_C33_RH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_RH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @rm <LABEL-PC>(21:9) */
- + HOWTO (R_C33_RM, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_RM", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @rl <LABEL-PC>(8:0) */
- + HOWTO (R_C33_RL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_RL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @h LABEL(31:19) */
- + HOWTO (R_C33_H, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_H", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @m LABEL(18:6) */
- + HOWTO (R_C33_M, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_M", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @l LABEL(5:0) */
- + HOWTO (R_C33_L, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 6, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_L", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* doff_hi(LABEL(25:13)) */ /* add tazaki 2002.01.11 */
- + HOWTO (R_C33_DH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_DH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* doff_lo(LABEL(12:0)) */ /* add tazaki 2002.01.11 */
- + HOWTO (R_C33_DL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_DL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* goff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
- + HOWTO (R_C33_GL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_GL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* soff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
- + HOWTO (R_C33_SH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_SH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* soff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
- + HOWTO (R_C33_SL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_SL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* toff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
- + HOWTO (R_C33_TH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_TH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* toff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
- + HOWTO (R_C33_TL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_TL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* toff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
- + HOWTO (R_C33_ZH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_ZH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* zoff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
- + HOWTO (R_C33_ZL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_ZL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* (symbol+imm - dp)@31:19 */
- + HOWTO (R_C33_DPH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_DPH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* (symbol+imm - dp)@18:6 */
- + HOWTO (R_C33_DPM, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33DP_DPM", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* (symbol+imm - dp)@5:0 */
- + HOWTO (R_C33_DPL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 6, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_DPL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* loop <LABEL-PC>(4:0) */
- + HOWTO (R_C33_LOOP, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 4, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_LOOP", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* l <LABEL-PC>(8:0) */
- + HOWTO (R_C33_JP, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_JP", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- +/* add T.Tazaki 2002.05.02 sjp,scall,xjp,xcall symbol mask >>> */
- +
- + /* @rh <LABEL-PC>(31:22) */
- + HOWTO (R_C33_S_RH, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_S_RH", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @rm <LABEL-PC>(21:9) */
- + HOWTO (R_C33_S_RM, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_S_RM", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* @rl <LABEL-PC>(8:0) */
- + HOWTO (R_C33_S_RL, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + true, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_S_RL", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- +/* add T.Tazaki 2002.05.02 sjp,scall,xjp,xcall symbol mask <<< */
- +
- + /* pushn %r0 */ /* add tazaki 2004/08/19 */
- + HOWTO (R_C33_PUSHN_R0, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_PUSHN_R0", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* pushn %r1 */ /* add tazaki 2004/08/19 */
- + HOWTO (R_C33_PUSHN_R1, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_PUSHN_R1", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false), /* pcrel_offset */
- +
- + /* push %r1 */ /* add tazaki 2004/08/19 */
- + HOWTO (R_C33_PUSH_R1, /* type */
- + 0, /* rightshift */
- + 1, /* size (0 = byte, 1 = short, 2 = long) */
- + 13, /* bitsize */
- + false, /* pc_relative */
- + 0, /* bitpos */
- + complain_overflow_dont, /* complain_on_overflow */
- + c33_elf_reloc, /* special_function */
- + "R_C33_PUSH_R1", /* name */
- + false, /* partial_inplace */
- + 0xffff, /* src_mask */
- + 0xffff, /* dst_mask */
- + false) /* pcrel_offset */
- +
- +};
- +
- +/* Map BFD reloc types to c33 ELF reloc types. */
- +
- +struct c33_elf_reloc_map
- +{
- + /* BFD_RELOC_C33_CALLT_16_16_OFFSET is 258, which will not fix in an
- + unsigned char. */
- + bfd_reloc_code_real_type bfd_reloc_val;
- + unsigned char elf_reloc_val;
- +};
- +
- +static const struct c33_elf_reloc_map c33_elf_reloc_map[] =
- +{
- + { BFD_RELOC_NONE, R_C33_NONE },
- + { BFD_RELOC_32, R_C33_32 },
- + { BFD_RELOC_16, R_C33_16 },
- + { BFD_RELOC_8, R_C33_8 },
- + { BFD_RELOC_C33_AH, R_C33_AH },
- + { BFD_RELOC_C33_AL, R_C33_AL },
- + { BFD_RELOC_C33_RH, R_C33_RH },
- + { BFD_RELOC_C33_RM, R_C33_RM },
- + { BFD_RELOC_C33_RL, R_C33_RL },
- + { BFD_RELOC_C33_S_RH, R_C33_S_RH }, /* add tazaki 2002.05.02 */
- + { BFD_RELOC_C33_S_RM, R_C33_S_RM }, /* add tazaki 2002.05.02 */
- + { BFD_RELOC_C33_S_RL, R_C33_S_RL }, /* add tazaki 2002.05.02 */
- + { BFD_RELOC_C33_JP, R_C33_JP }, /* add tazaki 2002.05.02 */
- + { BFD_RELOC_C33_H, R_C33_H },
- + { BFD_RELOC_C33_M, R_C33_M },
- + { BFD_RELOC_C33_L, R_C33_L },
- + { BFD_RELOC_C33_DH, R_C33_DH }, /* add tazaki 2002.01.11 */
- + { BFD_RELOC_C33_DL, R_C33_DL }, /* add tazaki 2002.01.11 */
- + { BFD_RELOC_C33_GL, R_C33_GL }, /* add tazaki 2001.07.13 */
- + { BFD_RELOC_C33_SH, R_C33_SH }, /* add tazaki 2001.11.07 */
- + { BFD_RELOC_C33_SL, R_C33_SL }, /* add tazaki 2001.07.13 */
- + { BFD_RELOC_C33_TH, R_C33_TH }, /* add tazaki 2001.11.07 */
- + { BFD_RELOC_C33_TL, R_C33_TL }, /* add tazaki 2001.07.13 */
- + { BFD_RELOC_C33_ZH, R_C33_ZH }, /* add tazaki 2001.11.07 */
- + { BFD_RELOC_C33_ZL, R_C33_ZL }, /* add tazaki 2001.07.13 */
- + { BFD_RELOC_C33_DPH, R_C33_DPH },/* add tazaki 2001.11.08 */
- + { BFD_RELOC_C33_DPM, R_C33_DPM },/* add tazaki 2001.11.08 */
- + { BFD_RELOC_C33_DPL, R_C33_DPL }, /* add tazaki 2001.11.08 */
- + { BFD_RELOC_C33_LOOP, R_C33_LOOP }, /* add tazaki 2002.03.05 */
- + { BFD_RELOC_C33_PUSHN_R0, R_C33_PUSHN_R0 }, /* add tazaki 2004/08/19 */
- + { BFD_RELOC_C33_PUSHN_R1, R_C33_PUSHN_R1 }, /* add tazaki 2004/08/19 */
- + { BFD_RELOC_C33_PUSH_R1, R_C33_PUSH_R1 } /* add tazaki 2004/08/19 */
- +};
- +
- +
- +/* Map a bfd relocation into the appropriate howto structure */
- +static reloc_howto_type *
- +c33_elf_reloc_type_lookup (abfd, code)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + bfd_reloc_code_real_type code;
- +{
- + unsigned int i;
- +
- + for (i = 0;
- + i < sizeof (c33_elf_reloc_map) / sizeof (struct c33_elf_reloc_map);
- + i++)
- + {
- + if (c33_elf_reloc_map[i].bfd_reloc_val == code)
- + {
- + BFD_ASSERT (c33_elf_howto_table[c33_elf_reloc_map[i].elf_reloc_val].type == c33_elf_reloc_map[i].elf_reloc_val);
- +
- + return & c33_elf_howto_table[c33_elf_reloc_map[i].elf_reloc_val];
- + }
- + }
- +
- + return NULL;
- +}
- +
- +
- +/* Set the howto pointer for an c33 ELF reloc. */
- +static void
- +c33_elf_info_to_howto_rel (abfd, cache_ptr, dst)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + arelent * cache_ptr;
- + Elf32_Internal_Rel * dst;
- +{
- + unsigned int r_type;
- +
- + r_type = ELF32_R_TYPE (dst->r_info);
- + BFD_ASSERT (r_type < (unsigned int) R_C33_max);
- + cache_ptr->howto = &c33_elf_howto_table[r_type];
- +}
- +
- +/* Set the howto pointer for a C33 ELF reloc (type RELA). */
- +static void
- +c33_elf_info_to_howto_rela (abfd, cache_ptr, dst)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + arelent * cache_ptr;
- + Elf32_Internal_Rela *dst;
- +{
- + unsigned int r_type;
- +
- + r_type = ELF32_R_TYPE (dst->r_info);
- + BFD_ASSERT (r_type < (unsigned int) R_C33_max);
- + cache_ptr->howto = &c33_elf_howto_table[r_type];
- +}
- +
- +
- +/* Look through the relocs for a section during the first phase, and
- + allocate space in the global offset table or procedure linkage
- + table. */
- +
- +static boolean
- +c33_elf_check_relocs (abfd, info, sec, relocs)
- + bfd * abfd;
- + struct bfd_link_info * info;
- + asection * sec;
- + const Elf_Internal_Rela * relocs;
- +{
- + boolean ret = true;
- + bfd *dynobj;
- + Elf_Internal_Shdr *symtab_hdr;
- + struct elf_link_hash_entry **sym_hashes;
- + const Elf_Internal_Rela *rel;
- + const Elf_Internal_Rela *rel_end;
- + asection *sreloc;
- + enum c33_reloc_type r_type;
- +
- +
- +
- + if (info->relocateable)
- + return true;
- +
- +#ifdef DEBUG
- + fprintf (stderr, "c33_elf_check_relocs called for section %s in %s\n",
- + bfd_get_section_name (abfd, sec),
- + bfd_get_filename (abfd));
- +#endif
- +
- + dynobj = elf_hash_table (info)->dynobj;
- + symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- + sym_hashes = elf_sym_hashes (abfd);
- + sreloc = NULL;
- +
- + rel_end = relocs + sec->reloc_count;
- + for (rel = relocs; rel < rel_end; rel++)
- + {
- + unsigned long r_symndx;
- + struct elf_link_hash_entry *h;
- +
- + r_symndx = ELF32_R_SYM (rel->r_info);
- + if (r_symndx < symtab_hdr->sh_info)
- + h = NULL;
- + else
- + h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- +
- + r_type = (enum c33_reloc_type) ELF32_R_TYPE (rel->r_info);
- + switch (r_type)
- + {
- + default:
- + case R_C33_NONE:
- + case R_C33_32:
- + case R_C33_16:
- + case R_C33_8:
- + case R_C33_AH:
- + case R_C33_AL:
- + case R_C33_RH:
- + case R_C33_RM:
- + case R_C33_RL:
- + case R_C33_S_RH: /* add tazaki 2002.05.02 */
- + case R_C33_S_RM: /* add tazaki 2002.05.02 */
- + case R_C33_S_RL: /* add tazaki 2002.05.02 */
- + case R_C33_JP: /* add tazaki 2002.04.22 */
- + case R_C33_H:
- + case R_C33_M:
- + case R_C33_L:
- + /* >>>>> add tazaki 2002.03.05 */
- + case R_C33_DH:
- + case R_C33_DL:
- + case R_C33_GL:
- + case R_C33_SH:
- + case R_C33_SL:
- + case R_C33_TH:
- + case R_C33_TL:
- + case R_C33_ZH:
- + case R_C33_ZL:
- + case R_C33_DPH:
- + case R_C33_DPM:
- + case R_C33_DPL:
- + case R_C33_LOOP:
- + /* <<<<< add tazaki 2002.03.05 */
- + case R_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
- + case R_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
- + case R_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
- + break;
- +
- + }
- + }
- +
- + return ret;
- +}
- +
- +/*
- + * In the old version, when an entry was checked out from the table,
- + * it was deleted. This produced an error if the entry was needed
- + * more than once, as the second attempted retry failed.
- + *
- + * In the current version, the entry is not deleted, instead we set
- + * the field 'found' to true. If a second lookup matches the same
- + * entry, then we know that the ah reloc has already been updated
- + * and does not need to be updated a second time.
- + *
- + * TODO - TOFIX: If it is possible that we need to restore 2 different
- + * addresses from the same table entry, where the first generates an
- + * overflow, whilst the second do not, then this code will fail.
- + */
- +
- +typedef struct ah_location
- +{
- + bfd_vma addend;
- + bfd_byte * address;
- + unsigned long counter;
- + boolean found;
- + struct ah_location * next;
- +}
- +ah_location;
- +
- +static ah_location * previous_ah;
- +static ah_location * free_ah;
- +static unsigned long ah_counter;
- +
- +#if 0
- +static void
- +remember_ah_reloc (abfd, addend, address)
- + bfd * abfd;
- + bfd_vma addend;
- + bfd_byte * address;
- +{
- + ah_location * entry = NULL;
- +
- + /* Find a free structure. */
- + if (free_ah == NULL)
- + free_ah = (ah_location *) bfd_zalloc (abfd, sizeof (* free_ah));
- +
- + entry = free_ah;
- + free_ah = free_ah->next;
- +
- + entry->addend = addend;
- + entry->address = address;
- + entry->counter = ah_counter ++;
- + entry->found = false;
- + entry->next = previous_ah;
- + previous_ah = entry;
- +
- + /* Cope with wrap around of our counter. */
- + if (ah_counter == 0)
- + {
- + /* XXX - Assume that all counter entries differ only in their low 16 bits. */
- + for (entry = previous_ah; entry != NULL; entry = entry->next)
- + entry->counter &= 0xffff;
- +
- + ah_counter = 0x10000;
- + }
- +
- + return;
- +}
- +
- +static bfd_byte *
- +find_remembered_ah_reloc (addend,address)
- + bfd_vma addend;
- + bfd_byte * address;
- +{
- + ah_location * entry;
- +
- + if( previous_ah == NULL ){ /* add tazaki 2001.11.01 */
- + return NULL;
- + }
- +
- + /* Search the table. Record the most recent entry that matches. */
- + entry = previous_ah;
- +
- + /* 直前にext @ahが存在するか */
- + if ((entry->addend == addend) && (entry->address == address-2))
- + {
- + return entry->address;
- + }
- + else {
- + return NULL;
- + }
- +}
- +
- +#endif
- +
- +/* >>>>>>>>>> add tazaki 2002.03.04 */
- +bfd_byte * g_doff_hi_address = NULL;
- +bfd_byte * g_soff_hi_address = NULL;
- +bfd_byte * g_toff_hi_address = NULL;
- +bfd_byte * g_zoff_hi_address = NULL;
- +bfd_byte * g_symbol_mask_ah_address = NULL;
- +bfd_byte * g_symbol_mask_rh_address = NULL;
- +bfd_byte * g_symbol_mask_rm_address = NULL;
- +bfd_byte * g_dpoff_h_address = NULL;
- +bfd_byte * g_dpoff_m_address = NULL;
- +/* <<<<<<<<<< add tazaki 2002.03.04 */
- +
- +
- +/* 未解決のシンボルを確定する */
- +/* FIXME: The code here probably ought to be removed and the code in reloc.c
- + allowed to do its stuff instead. At least for most of the relocs, anwyay. */
- +static bfd_reloc_status_type
- +c33_elf_perform_relocation (abfd, r_type, addend, address,gp)
- + bfd * abfd;
- + int r_type;
- + bfd_vma addend;
- + bfd_byte * address;
- + unsigned long gp; /* DA,SDA,TDA,ZDA */
- +
- +{
- + unsigned long insn;
- + bfd_signed_vma saddend = (bfd_signed_vma) addend;
- +
- + switch (r_type)
- + {
- + case R_C33_32:
- + bfd_put_32 (abfd, addend, address);
- + return bfd_reloc_ok;
- +
- + case R_C33_16:
- + addend += bfd_get_16 (abfd, address);
- + saddend = (bfd_signed_vma) addend;
- + if (saddend > 0x7fff || saddend < -0x8000)
- + return bfd_reloc_overflow;
- + insn = addend;
- + break;
- +
- + case R_C33_8:
- + addend += (char) bfd_get_8 (abfd, address);
- +
- + saddend = (bfd_signed_vma) addend;
- + if (saddend > 0x7f || saddend < -0x80)
- + return bfd_reloc_overflow;
- +
- + bfd_put_8 (abfd, addend, address);
- + return bfd_reloc_ok;
- +
- + case R_C33_AH: /* @ah (25:13) */
- + /* Remember where this relocation took place. */
- + g_symbol_mask_ah_address = address;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- + /* over 26bit ? */
- + if ( addend > 0x3ffffff )
- + return bfd_reloc_outofrange;
- +
- + /* add symbol25:13 to insn */
- + insn += ((addend >> 13) & 0x1fff);
- + break;
- +
- + case R_C33_AL: /* @al (12:0) */
- + insn = bfd_get_16(abfd, address);
- +
- + if (g_symbol_mask_ah_address != (address - 2)){
- + /* over 13bit ? */
- + if (addend > 0x1fff)
- + return bfd_reloc_outofrange;
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- + case R_C33_RH: /* LABEL-PC(31:22) */
- + case R_C33_S_RH: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
- + /* Remember where this relocation took place. */
- + g_symbol_mask_rh_address = address;
- +
- + insn = bfd_get_16(abfd, address);
- + insn += (((addend - 4) >> 19) & 0x1ff8);
- + break;
- +
- + case R_C33_RM: /* LABEL-PC(21:9) */
- + case R_C33_S_RM: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
- + /* Remember where this relocation took place. */
- + g_symbol_mask_rm_address = address;
- +
- + insn = bfd_get_16(abfd, address);
- +
- + /* if exist @rh before ext ? */
- + if (g_symbol_mask_rh_address != (address - 2)){
- + saddend = (bfd_signed_vma) addend;
- + /* over signed 22bit ? */
- + if ((saddend - 2) > 0x1ffffe || (saddend - 2 ) < -0x200000 ) /* tazaki 2002.04.24 */
- + return bfd_reloc_outofrange;
- + }
- + insn += (((addend - 2) >> 9) & 0x1fff);
- + break;
- +
- + case R_C33_JP: /* LABEL-PC(8:0) */
- + case R_C33_RL: /* LABEL-PC(8:0) */
- + case R_C33_S_RL: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
- + /* sign8=sign32(8:1) sign32(0)=0 */
- + insn = bfd_get_16(abfd, address);
- +
- + /* if exist @rm before ext ? */
- + if (g_symbol_mask_rm_address != (address - 2)){
- +
- + saddend = (bfd_signed_vma) addend;
- + /* over signed 8bit ? */
- + if (saddend > 254 || saddend < -256)
- + return bfd_reloc_outofrange;
- + }
- +
- + insn += ((addend >> 1) & 0xff);
- + break;
- +
- + case R_C33_H: /* LABEL(31:19) */
- + insn = bfd_get_16(abfd, address);
- + insn += ((addend >> 19) & 0x1fff);
- + break;
- +
- + case R_C33_M: /* LABEL(18:6) */
- + insn = bfd_get_16(abfd, address);
- + insn += ((addend >> 6) & 0x1fff);
- + break;
- +
- + case R_C33_L: /* LABEL(5:0) */
- + /* ld.w %rd,LABEL@l */
- + insn = bfd_get_16(abfd, address);
- + insn += (addend & 0x3f) << 4;
- + break;
- +
- + case R_C33_DH: /* doff_hi(LABEL) (25:13) */
- + /* default=0x0 & Warning display */
- +
- + /* Remember where this relocation took place. */
- + g_doff_hi_address = address;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_doff_globalpointer;
- +
- + /* over 26bit ? */
- + if (addend > 0x3ffffff)
- + return bfd_reloc_doff_over_64mb;
- +
- + /* add symbol25:13 to insn */
- + insn += ((addend >> 13) & 0x1fff);
- + break;
- +
- + case R_C33_DL: /* doff_lo(LABEL) (12:0) */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else{
- + return bfd_reloc_over_doff_globalpointer;
- + }
- +
- + /* over 13bit ? */
- + if (addend > 0x1fff){
- + /* if exist doff_hi() before ext ? */
- + if (g_doff_hi_address != (address - 2)){
- + return bfd_reloc_doff_over_8kb;
- + }
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- +
- + case R_C33_GL: /* goff_lo(LABEL) (12:0) */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else{
- + return bfd_reloc_over_goff_globalpointer;
- + }
- +
- + /* over 13bit ? */
- + if (addend > 0x1fff){
- + return bfd_reloc_goff_over_8kb;
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- + case R_C33_SH: /* soff_hi(LABEL) (25:13) */
- +
- + /* Remember where this relocation took place. */
- + g_soff_hi_address = address;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_soff_globalpointer;
- +
- + /* over 26bit ? */
- + if (addend > 0x3ffffff)
- + return bfd_reloc_soff_over_64mb;
- +
- + /* add symbol25:13 to insn */
- + insn += ((addend >> 13) & 0x1fff);
- + break;
- +
- + case R_C33_SL: /* soff_lo(LABEL) (12:0) */
- +
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_soff_globalpointer;
- +
- + if (addend > 0x1fff){
- + /* if exist soff_hi() before ext ? */
- + if (g_soff_hi_address != (address - 2)){
- + return bfd_reloc_soff_over_8kb;
- + }
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- + case R_C33_TH: /* toff_hi(LABEL) (25:13) */
- +
- + /* Remember where this relocation took place. */
- + g_toff_hi_address = address;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_toff_globalpointer;
- +
- + /* over 26bit ? */
- + if (addend > 0x3ffffff)
- + return bfd_reloc_toff_over_64mb;
- +
- + /* add symbol25:13 to insn */
- + insn += ((addend >> 13) & 0x1fff);
- + break;
- +
- + case R_C33_TL: /* toff_lo(LABEL) (12:0) */
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_toff_globalpointer;
- +
- + /* over 13bit ? */
- + if (addend > 0x1fff){
- + /* if exist toff_hi() before ext ? */
- + if (g_toff_hi_address != (address - 2)){
- + return bfd_reloc_toff_over_8kb;
- + }
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- + case R_C33_ZH: /* zoff_hi(LABEL) (25:13) */
- +
- + /* Remember where this relocation took place. */
- + g_zoff_hi_address = address;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_zoff_globalpointer;
- +
- + /* over 26bit ? */
- + if (addend > 0x3ffffff)
- + return bfd_reloc_zoff_over_64mb;
- +
- + /* add symbol25:13 to insn */
- + insn += ((addend >> 13) & 0x1fff);
- + break;
- +
- + case R_C33_ZL: /* zoff_lo(LABEL) (12:0) */
- +
- + insn = bfd_get_16(abfd, address);
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_zoff_globalpointer;
- +
- + /* over 13bit ? */
- + if (addend > 0x1fff){
- + /* if exist zoff_hi() before ext ? */
- + if (g_zoff_hi_address != (address - 2)){
- + return bfd_reloc_zoff_over_8kb;
- + }
- + }
- +
- + insn += (addend & 0x1fff);
- + break;
- +
- + case R_C33_DPH: /* (symbol+imm - %dp)@31:19 */
- +
- + /* Remember where this relocation took place. */
- + g_dpoff_h_address = address;
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_doff_globalpointer;
- +
- + /* Get Instruction code */
- + insn = bfd_get_16(abfd, address);
- + insn += ((addend >> 19) & 0x1fff);
- + break;
- +
- + case R_C33_DPM: /* (symbol+imm - %dp)@18:6 */
- + /* Remember where this relocation took place. */
- + g_dpoff_m_address = address;
- +
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_doff_globalpointer;
- +
- + /* over 19bit ? */
- + if (addend > 0x7ffff){
- + /* if exist dpoff_h() before ext ? */
- + if (g_dpoff_h_address != (address - 2)){
- + return bfd_reloc_dpoff_over_512kb;
- + }
- + }
- +
- + insn = bfd_get_16(abfd, address);
- + insn += ((addend >> 6) & 0x1fff);
- + break;
- +
- + case R_C33_DPL: /* (symbol+imm - %dp)@5:0 */
- + if (addend >= gp)
- + addend -= gp;
- + else
- + return bfd_reloc_over_doff_globalpointer;
- +
- + /* over 6bit ? */
- + if (addend > 0x3f){
- + /* if exist dpoff_m() before ext ? */
- + if (g_dpoff_m_address != (address - 2)){
- + return bfd_reloc_dpoff_over_64b;
- + }
- + }
- +
- + insn = bfd_get_16(abfd, address);
- + insn += (addend & 0x3f) << 4;
- + break;
- +
- + case R_C33_LOOP: /* LABEL-PC(4:0) */
- + /* imm5=imm4(4:1) */
- + insn = bfd_get_16(abfd, address);
- +
- + saddend = (bfd_signed_vma)(addend - *address);
- + /* over imm4bit ? */
- + if (saddend > 30 || saddend < 0)
- + return bfd_reloc_outofrange;
- +
- + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
- + /* " nop " */
- + /* " nop " */
- + /* "Label: " */
- +
- +// insn += (((addend - *address) & 0x1e) << 3);
- + insn += ((((addend - *address)-1) & 0x1e) << 3);
- +
- + /* add T.Tazaki 2004/09/22 <<< */
- + break;
- +
- + /* add T.Tazaki 2004/08/19 >>> */
- + case R_C33_PUSHN_R0: /* xld,xbtst 展開後の最初の "pushn %r0 */
- + insn = bfd_get_16(abfd, address);
- +
- + insn = 0x0200; /* pushn %r0 */
- + break;
- + case R_C33_PUSHN_R1: /* xld,xbtst 展開後の最初の "pushn %r1 */
- + insn = bfd_get_16(abfd, address);
- +
- + insn = 0x0201; /* pushn %r1 */
- + break;
- + case R_C33_PUSH_R1: /* ADV or PE xld,xbtst 展開後の最初の "push %r1 */
- + insn = bfd_get_16(abfd, address);
- +
- + insn = 0x0011; /* push %r1 */
- + break;
- + /* add T.Tazaki 2004/08/19 <<< */
- +
- +
- + default:
- + /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
- + return bfd_reloc_notsupported;
- +
- + }
- +
- + bfd_put_16 (abfd, insn, address);
- + return bfd_reloc_ok;
- +}
- +
- +
- +
- +/* Insert the addend into the instruction. */
- +static bfd_reloc_status_type
- +c33_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + arelent * reloc;
- + asymbol * symbol;
- + PTR data ATTRIBUTE_UNUSED;
- + asection * isection;
- + bfd * obfd;
- + char ** err ATTRIBUTE_UNUSED;
- +{
- + long relocation;
- +
- + /* If there is an output BFD,
- + and the symbol is not a section name (which is only defined at final link time),
- + and either we are not putting the addend into the instruction
- + or the addend is zero, so there is nothing to add into the instruction
- + then just fixup the address and return. */
- + if (obfd != (bfd *) NULL
- + && (symbol->flags & BSF_SECTION_SYM) == 0
- + && (! reloc->howto->partial_inplace
- + || reloc->addend == 0))
- + {
- + reloc->address += isection->output_offset;
- + return bfd_reloc_ok;
- + }
- +#if 0
- + else if (obfd != NULL)
- + {
- + return bfd_reloc_continue;
- + }
- +#endif
- +
- + /* Catch relocs involving undefined symbols. */
- + if (bfd_is_und_section (symbol->section)
- + && (symbol->flags & BSF_WEAK) == 0
- + && obfd == NULL)
- + return bfd_reloc_undefined;
- +
- + /* We handle final linking of some relocs ourselves. */
- +
- + /* Is the address of the relocation really within the section? */
- + if (reloc->address > isection->_cooked_size)
- + return bfd_reloc_outofrange;
- +
- + /* Work out which section the relocation is targetted at and the
- + initial relocation command value. */
- +
- + /* Get symbol value. (Common symbols are special.) */
- + if (bfd_is_com_section (symbol->section))
- + relocation = 0;
- + else
- + relocation = symbol->value;
- +
- + /* Convert input-section-relative symbol value to absolute + addend. */
- + relocation += symbol->section->output_section->vma;
- + relocation += symbol->section->output_offset;
- + relocation += reloc->addend;
- +
- + if (reloc->howto->pc_relative == true)
- + {
- + /* Here the variable relocation holds the final address of the
- + symbol we are relocating against, plus any addend. */
- + relocation -= isection->output_section->vma + isection->output_offset;
- +
- + /* Deal with pcrel_offset */
- + relocation -= reloc->address;
- + }
- +
- + reloc->addend = relocation;
- + return bfd_reloc_ok;
- +}
- +
- +
- +/* Check local label name */
- +/*ARGSUSED*/
- +static boolean
- +c33_elf_is_local_label_name (abfd, name)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + const char * name;
- +{
- + return ((name[0] == '_' && name[1] == '_' && name[2] == 'L'));
- +}
- +
- +
- +/* The symbol changed by relocation at the time of a link is solved. */
- +
- +int i_dp_warn_flag = 0; /* add tazaki 2002.01.11 */
- +int i_gdp_warn_flag = 0; /* add tazaki 2002.01.11 */
- +int i_sdp_warn_flag = 0; /* add tazaki 2002.01.11 */
- +int i_tdp_warn_flag = 0; /* add tazaki 2002.01.11 */
- +int i_zdp_warn_flag = 0; /* add tazaki 2002.01.11 */
- +
- +/* Perform a relocation as part of a final link. */
- +static bfd_reloc_status_type
- +c33_elf_final_link_relocate (howto, input_bfd, output_bfd,
- + input_section, contents, offset, value,
- + addend, info, sym_sec, is_local)
- + reloc_howto_type * howto;
- + bfd * input_bfd;
- + bfd * output_bfd ATTRIBUTE_UNUSED;
- + asection * input_section;
- + bfd_byte * contents;
- + bfd_vma offset;
- + bfd_vma value;
- + bfd_vma addend;
- + struct bfd_link_info * info;
- + asection * sym_sec;
- + int is_local ATTRIBUTE_UNUSED;
- +{
- + unsigned long r_type = howto->type;
- + bfd_byte * hit_data = contents + offset;
- + unsigned long gp = 0;
- + struct bfd_link_hash_entry * h;
- +
- + /* Adjust the value according to the relocation. */
- + switch (r_type)
- + {
- + case R_C33_16:
- + case R_C33_32:
- + case R_C33_8:
- + case R_C33_H:
- + case R_C33_M:
- + case R_C33_L:
- + case R_C33_AH:
- + case R_C33_AL:
- + break;
- +
- + case R_C33_RH:
- + case R_C33_RM:
- + case R_C33_RL:
- + case R_C33_S_RH:
- + case R_C33_S_RM:
- + case R_C33_S_RL:
- + case R_C33_JP:
- + case R_C33_LOOP:
- + /* set PC relative value */
- + value -= (input_section->output_section->vma
- + + input_section->output_offset);
- + value -= offset;
- + break;
- +
- + case R_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
- + case R_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
- + case R_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
- + case R_C33_NONE:
- + return bfd_reloc_ok;
- +
- + /* add tazaki 2001.08.02 >>>>> */
- +
- + case R_C33_DH:
- + case R_C33_DL:
- +
- + /* Get the value of __dp. */
- + h = bfd_link_hash_lookup (info->hash, "__dp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_dp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __dp symbol cannot be refered to.\n" );
- + i_dp_warn_flag = 1;
- + }
- + }
- + else {
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- +
- + break;
- +
- + case R_C33_GL:
- +
- + /* Get the value of __gdp. */
- + h = bfd_link_hash_lookup (info->hash, "__gdp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_gdp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __gdp symbol cannot be refered to.\n" );
- + i_gdp_warn_flag = 1;
- + }
- + }
- + else {
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- +
- + break;
- +
- + case R_C33_SH:
- + case R_C33_SL:
- + /* Get the value of __sdp. */
- + h = bfd_link_hash_lookup (info->hash, "__sdp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_sdp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __sdp symbol cannot be refered to.\n" );
- + i_sdp_warn_flag = 1;
- + }
- + }else{
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- + break;
- +
- + case R_C33_TH:
- + case R_C33_TL:
- + /* Get the value of __tdp. */
- + h = bfd_link_hash_lookup (info->hash, "__tdp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_tdp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __tdp symbol cannot be refered to.\n" );
- + i_tdp_warn_flag = 1;
- + }
- + }else{
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- + break;
- +
- + case R_C33_ZH:
- + case R_C33_ZL:
- + /* Get the value of __zdp. */
- + h = bfd_link_hash_lookup (info->hash, "__zdp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_zdp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __zdp symbol cannot be refered to.\n" );
- + i_zdp_warn_flag = 1;
- + }
- + }else{
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- + break;
- +
- + case R_C33_DPH:
- + case R_C33_DPM:
- + case R_C33_DPL:
- +
- + /* Get the value of __dp. */
- + h = bfd_link_hash_lookup (info->hash, "__dp", false, false, true);
- + if (h == (struct bfd_link_hash_entry *) NULL
- + || h->type != bfd_link_hash_defined)
- + {
- + gp = 0;
- + if( i_dp_warn_flag == 0 ){
- + fprintf( stderr,"Warning: __dp symbol cannot be refered to.\n" );
- + i_dp_warn_flag = 1;
- + }
- + }
- + else {
- + gp = (h->u.def.value
- + + h->u.def.section->output_section->vma
- + + h->u.def.section->output_offset);
- + }
- +
- + break;
- +
- + default:
- + return bfd_reloc_notsupported;
- + }
- +
- +
- + /* add tazaki 2001.08.02 <<<<< */
- +
- + /* Perform the relocation. */
- + return c33_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data,gp);
- +}
- +
- +
- +/* Relocate an C33 ELF section. */
- +static boolean
- +c33_elf_relocate_section (output_bfd, info, input_bfd, input_section,
- + contents, relocs, local_syms, local_sections)
- + bfd * output_bfd;
- + struct bfd_link_info * info;
- + bfd * input_bfd;
- + asection * input_section;
- + bfd_byte * contents;
- + Elf_Internal_Rela * relocs;
- + Elf_Internal_Sym * local_syms;
- + asection ** local_sections;
- +{
- + Elf_Internal_Shdr * symtab_hdr;
- + struct elf_link_hash_entry ** sym_hashes;
- + Elf_Internal_Rela * rel;
- + Elf_Internal_Rela * relend;
- +
- + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
- + sym_hashes = elf_sym_hashes (input_bfd);
- +
- + if (sym_hashes == NULL)
- + {
- + info->callbacks->warning
- + (info, "no hash table available", NULL, input_bfd, input_section, 0);
- +
- + return false;
- + }
- +
- + /* Reset the list of remembered HI16S relocs to empty. */
- + free_ah = previous_ah;
- + previous_ah = NULL;
- + ah_counter = 0;
- +
- +
- + rel = relocs;
- + relend = relocs + input_section->reloc_count;
- + for (; rel < relend; rel++)
- + {
- + int r_type;
- + reloc_howto_type * howto;
- + unsigned long r_symndx;
- + Elf_Internal_Sym * sym;
- + asection * sec;
- + struct elf_link_hash_entry * h;
- + bfd_vma relocation;
- + bfd_reloc_status_type r;
- +
- + r_symndx = ELF32_R_SYM (rel->r_info);
- + r_type = ELF32_R_TYPE (rel->r_info);
- + howto = c33_elf_howto_table + r_type;
- +
- + if (info->relocateable)
- + {
- + /* This is a relocateable link. We don't have to change
- + anything, unless the reloc is against a section symbol,
- + in which case we have to adjust according to where the
- + section symbol winds up in the output section. */
- + if (r_symndx < symtab_hdr->sh_info)
- + {
- + sym = local_syms + r_symndx;
- + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- + {
- + sec = local_sections[r_symndx];
- + rel->r_addend += sec->output_offset + sym->st_value;
- + }
- + }
- +
- + continue;
- + }
- +
- + /* This is a final link. */
- + h = NULL;
- + sym = NULL;
- + sec = NULL;
- + if (r_symndx < symtab_hdr->sh_info)
- + {
- + sym = local_syms + r_symndx;
- + sec = local_sections[r_symndx];
- + relocation = (sec->output_section->vma
- + + sec->output_offset
- + + sym->st_value);
- +#if 0
- + {
- + char * name;
- + name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name);
- + name = (name == NULL) ? "<none>" : name;
- +fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
- + sec->name, name, sym->st_name,
- + sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend);
- + }
- +#endif
- + }
- + else
- + {
- + h = sym_hashes[r_symndx - symtab_hdr->sh_info];
- +
- + while (h->root.type == bfd_link_hash_indirect
- + || h->root.type == bfd_link_hash_warning)
- + h = (struct elf_link_hash_entry *) h->root.u.i.link;
- +
- + if (h->root.type == bfd_link_hash_defined
- + || h->root.type == bfd_link_hash_defweak)
- + {
- + sec = h->root.u.def.section;
- + relocation = (h->root.u.def.value
- + + sec->output_section->vma
- + + sec->output_offset);
- +#if 0
- +fprintf (stderr, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
- + sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation);
- +#endif
- + }
- + else if (h->root.type == bfd_link_hash_undefweak)
- + {
- +#if 0
- +fprintf (stderr, "undefined: sec: %s, name: %s\n",
- + sec->name, h->root.root.string);
- +#endif
- + relocation = 0;
- + }
- + else
- + {
- + if (! ((*info->callbacks->undefined_symbol)
- + (info, h->root.root.string, input_bfd,
- + input_section, rel->r_offset, true)))
- + return false;
- +#if 0
- +fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
- +#endif
- + relocation = 0;
- + }
- + }
- +
- + /* FIXME: We should use the addend, but the COFF relocations
- + don't. */
- + r = c33_elf_final_link_relocate (howto, input_bfd, output_bfd,
- + input_section,
- + contents, rel->r_offset,
- + relocation, rel->r_addend,
- + info, sec, h == NULL);
- +
- + if (r != bfd_reloc_ok)
- + {
- + const char * name;
- + const char * msg = (const char *)0;
- +
- + if (h != NULL)
- + name = h->root.root.string;
- + else
- + {
- + name = (bfd_elf_string_from_elf_section
- + (input_bfd, symtab_hdr->sh_link, sym->st_name));
- + if (name == NULL || *name == '\0')
- + name = bfd_section_name (input_bfd, sec);
- + }
- +
- + switch (r)
- + {
- + case bfd_reloc_overflow:
- + if (! ((*info->callbacks->reloc_overflow)
- + (info, name, howto->name, (bfd_vma) 0,
- + input_bfd, input_section, rel->r_offset)))
- + return false;
- + break;
- +
- + case bfd_reloc_undefined:
- + if (! ((*info->callbacks->undefined_symbol)
- + (info, name, input_bfd, input_section,
- + rel->r_offset, true)))
- + return false;
- + break;
- +
- + case bfd_reloc_outofrange:
- +// msg = _("internal error: out of range error"); /* Change T.Tazaki 2003/11/18 */
- + msg = _("out of range error"); /* Change T.Tazaki 2003/11/18 */
- + goto common_error;
- +
- + case bfd_reloc_notsupported:
- + msg = _("internal error: unsupported relocation error");
- + goto common_error;
- +
- + case bfd_reloc_dangerous:
- + msg = _("internal error: dangerous relocation");
- + goto common_error;
- +
- + case bfd_reloc_other:
- + msg = _("could not locate special linker symbol __gp");
- + goto common_error;
- +
- + case bfd_reloc_continue:
- + msg = _("could not locate special linker symbol __ep");
- + goto common_error;
- +
- + case (bfd_reloc_dangerous + 1):
- + msg = _("could not locate special linker symbol __ctbp");
- + goto common_error;
- +
- +/* add tazaki 2002.01.11 >>>>> */
- + case bfd_reloc_over_doff_globalpointer:
- + msg = _("Default Data area pointer value is larger than symbol address value.");
- + goto common_error;
- +
- + case bfd_reloc_over_goff_globalpointer:
- + msg = _("G Data area pointer value is larger than symbol address value.");
- + goto common_error;
- +
- + case bfd_reloc_over_soff_globalpointer:
- + msg = _("S Data area pointer value is larger than symbol address value.");
- + goto common_error;
- +
- + case bfd_reloc_over_toff_globalpointer:
- + msg = _("T Data area pointer value is larger than symbol address value.");
- + goto common_error;
- +
- + case bfd_reloc_over_zoff_globalpointer:
- + msg = _("Z Data area pointer value is larger than symbol address value.");
- + goto common_error;
- +
- + case bfd_reloc_doff_over_64mb:
- + msg = _("The offset value of a symbol is over 64MB.(default data area)");
- + goto common_error;
- +
- + case bfd_reloc_doff_over_8kb:
- + msg = _("The offset value of a symbol is over 8KB.(default data area)");
- + goto common_error;
- +
- + case bfd_reloc_goff_over_8kb:
- + msg = _("The offset value of a symbol is over 8KB.(G data area)");
- + goto common_error;
- +
- + case bfd_reloc_soff_over_64mb:
- + msg = _("The offset value of a symbol is over 64MB.(S data area)");
- + goto common_error;
- +
- + case bfd_reloc_soff_over_8kb:
- + msg = _("The offset value of a symbol is over 8KB.(S data area)");
- + goto common_error;
- +
- + case bfd_reloc_toff_over_64mb:
- + msg = _("The offset value of a symbol is over 64MB.(T data area)");
- + goto common_error;
- +
- + case bfd_reloc_toff_over_8kb:
- + msg = _("The offset value of a symbol is over 8KB.(T data area)");
- + goto common_error;
- +
- + case bfd_reloc_zoff_over_64mb:
- + msg = _("The offset value of a symbol is over 64MB.(Z data area)");
- + goto common_error;
- +
- + case bfd_reloc_zoff_over_8kb:
- + msg = _("The offset value of a symbol is over 8KB.(Z data area)");
- + goto common_error;
- +
- + case bfd_reloc_dpoff_over_512kb:
- + msg = _("The offset value of a symbol is over 512KB.(default data area)");
- + goto common_error;
- +
- + case bfd_reloc_dpoff_over_64b:
- + msg = _("The offset value of a symbol is over 64byte.(default data area)");
- + goto common_error;
- +
- +/* add tazaki 2002.01.11 <<<<< */
- +
- + default:
- + msg = _("internal error: unknown error");
- + /* fall through */
- +
- + common_error:
- + if (!((*info->callbacks->warning)
- + (info, msg, name, input_bfd, input_section,
- + rel->r_offset)))
- + return false;
- + break;
- + }
- + }
- + }
- +
- + return true;
- +}
- +
- +static boolean
- +c33_elf_gc_sweep_hook (abfd, info, sec, relocs)
- + bfd *abfd ATTRIBUTE_UNUSED;
- + struct bfd_link_info *info ATTRIBUTE_UNUSED;
- + asection *sec ATTRIBUTE_UNUSED;
- + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
- +{
- + /* No got and plt entries for c33-elf */
- + return true;
- +}
- +
- +static asection *
- +c33_elf_gc_mark_hook (abfd, info, rel, h, sym)
- + bfd *abfd;
- + struct bfd_link_info *info ATTRIBUTE_UNUSED;
- + Elf_Internal_Rela *rel;
- + struct elf_link_hash_entry *h;
- + Elf_Internal_Sym *sym;
- +{
- + if (h != NULL)
- + {
- + switch (ELF32_R_TYPE (rel->r_info))
- + {
- + default:
- + switch (h->root.type)
- + {
- + case bfd_link_hash_defined:
- + case bfd_link_hash_defweak:
- + return h->root.u.def.section;
- +
- + case bfd_link_hash_common:
- + return h->root.u.c.p->section;
- +
- + default:
- + break;
- + }
- + }
- + }
- + else
- + {
- + if (!(elf_bad_symtab (abfd)
- + && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
- + && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
- + && sym->st_shndx != SHN_COMMON))
- + {
- + return bfd_section_from_elf_index (abfd, sym->st_shndx);
- + }
- + }
- + return NULL;
- +}
- +
- +/* Store the machine number in the flags field. */
- +/* Function to keep C33 specific file flags. */
- +static boolean
- +c33_elf_set_private_flags (abfd, flags)
- + bfd * abfd;
- + flagword flags;
- +{
- + BFD_ASSERT (!elf_flags_init (abfd)
- + || elf_elfheader (abfd)->e_flags == flags);
- +
- + elf_elfheader (abfd)->e_flags = flags;
- + elf_flags_init (abfd) = true;
- +
- + return true;
- +}
- +
- +/* Copy backend specific data from one object module to another */
- +static boolean
- +c33_elf_copy_private_bfd_data (ibfd, obfd)
- + bfd * ibfd;
- + bfd * obfd;
- +{
- + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- + || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- + return true;
- +
- + BFD_ASSERT (!elf_flags_init (obfd)
- + || (elf_elfheader (obfd)->e_flags
- + == elf_elfheader (ibfd)->e_flags));
- +
- + elf_gp (obfd) = elf_gp (ibfd);
- + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
- + elf_flags_init (obfd) = true;
- + return true;
- +}
- +
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/01 */
- +static const char* c33_elf_get_mode_string(char mode_flag)
- +{
- + switch (mode_flag) {
- + case 'A': return "ADV";
- + case 'P': return "PE";
- + default : return "STD";
- + }
- +}
- +/* <<<<< ADDED D.Fujimoto 2007/10/01 */
- +
- +/* Merge backend specific data from an object file to the output
- + object file when linking. */
- +static boolean
- +c33_elf_merge_private_bfd_data (ibfd, obfd)
- + bfd * ibfd;
- + bfd * obfd;
- +{
- + flagword out_flags;
- + flagword in_flags;
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
- + unsigned char mode_flag = 0; // STD=0x0, PE='P', ADV='A'
- + static unsigned char initial_mode_flag;
- + static char initial_object_filename[512];
- + static boolean done_once = false;
- +/* <<<<< ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
- +
- + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
- + || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- + return true;
- +
- + in_flags = elf_elfheader (ibfd)->e_flags;
- + out_flags = elf_elfheader (obfd)->e_flags;
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/15 link error when input object files are not for C33 */
- + if (elf_elfheader(ibfd)->e_machine != 0) { // 0 will not be checked because of compatibility
- + if (elf_elfheader(ibfd)->e_machine != EM_SE_C33) {
- + fprintf (stderr, "Error: Input object file %s ", bfd_get_filename(ibfd));
- + if (bfd_my_archive(ibfd) != NULL) {
- + fprintf(stderr, "included from %s ", bfd_my_archive(ibfd)->filename);
- + }
- + fprintf(stderr, "is not for C33.\n");
- +
- + xexit(1);
- + }
- + }
- +/* <<<<< ADDED D.Fujimoto 2007/10/15 link error when input object files are not for C33 */
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
- + // get the flag from the object file
- + mode_flag = (unsigned char) (elf_elfheader(ibfd)->e_flags >> 24);
- +
- + // get initial mode
- + if (!done_once) {
- + initial_mode_flag = mode_flag;
- + strncpy(initial_object_filename, bfd_get_filename(ibfd), 512);
- + done_once = true;
- + }
- +
- + // check mode
- + if (mode_flag != initial_mode_flag) {
- +
- + // show an error and exit without creating executable
- + fprintf(stderr, "Error: Cannot link %s object %s ", c33_elf_get_mode_string(mode_flag), bfd_get_filename(ibfd));
- + if (bfd_my_archive(ibfd) != NULL) {
- + fprintf(stderr, "included from %s ", bfd_my_archive(ibfd)->filename);
- + }
- + fprintf(stderr, "with %s object %s\n", c33_elf_get_mode_string(initial_mode_flag), initial_object_filename);
- + xexit(1);
- +
- + }
- +
- + // set ELF e_flags bit31-28 (e_machine is set in elf.c)
- + elf_elfheader(obfd)->e_flags = initial_mode_flag << 24;
- +/* <<<<< ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
- +
- + if (! elf_flags_init (obfd))
- + {
- + /* If the input is the default architecture then do not
- + bother setting the flags for the output architecture,
- + instead allow future merges to do this. If no future
- + merges ever set these flags then they will retain their
- + unitialised values, which surprise surprise, correspond
- + to the default values. */
- + if (bfd_get_arch_info (ibfd)->the_default)
- + return true;
- +
- + elf_flags_init (obfd) = true;
- + elf_elfheader (obfd)->e_flags = in_flags;
- +
- + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
- + && bfd_get_arch_info (obfd)->the_default)
- + {
- + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
- + }
- +
- + return true;
- + }
- +
- + /* Check flag compatibility. */
- + if (in_flags == out_flags)
- + return true;
- + return true;
- +}
- +/* Display the flags field */
- +
- +static boolean
- +c33_elf_print_private_bfd_data (abfd, ptr)
- + bfd * abfd;
- + PTR ptr;
- +{
- +
- +
- + BFD_ASSERT (abfd != NULL && ptr != NULL);
- +
- + _bfd_elf_print_private_bfd_data (abfd, ptr);
- + return true;
- +}
- +
- +/* C33 ELF uses four common sections. One is the usual one, and the
- + others are for (small) objects in one of the special data areas:
- + small, tiny and zero. All the objects are kept together, and then
- + referenced via the gp register, the ep register or the r0 register
- + respectively, which yields smaller, faster assembler code. This
- + approach is copied from elf32-mips.c. */
- +/* del tazaki
- +static asection c33_elf_scomm_section;
- +static asymbol c33_elf_scomm_symbol;
- +static asymbol * c33_elf_scomm_symbol_ptr;
- +static asection c33_elf_comm_section;
- +static asymbol c33_elf_comm_symbol;
- +static asymbol * c33_elf_comm_symbol_ptr;
- +static asection c33_elf_lcomm_section;
- +static asymbol c33_elf_lcomm_symbol;
- +static asymbol * c33_elf_lcomm_symbol_ptr;
- +*/
- +static asection c33_elf_comm_section;
- +static asymbol c33_elf_comm_symbol;
- +static asymbol * c33_elf_comm_symbol_ptr;
- +static asection c33_elf_gcomm_section;
- +static asymbol c33_elf_gcomm_symbol;
- +static asymbol * c33_elf_gcomm_symbol_ptr;
- +static asection c33_elf_scomm_section;
- +static asymbol c33_elf_scomm_symbol;
- +static asymbol * c33_elf_scomm_symbol_ptr;
- +static asection c33_elf_tcomm_section;
- +static asymbol c33_elf_tcomm_symbol;
- +static asymbol * c33_elf_tcomm_symbol_ptr;
- +static asection c33_elf_zcomm_section;
- +static asymbol c33_elf_zcomm_symbol;
- +static asymbol * c33_elf_zcomm_symbol_ptr;
- +
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- +static asection c33_elf_gbss_section;
- +static asymbol c33_elf_gbss_symbol;
- +static asymbol * c33_elf_gbss_symbol_ptr;
- +static asection c33_elf_sbss_section;
- +static asymbol c33_elf_sbss_symbol;
- +static asymbol * c33_elf_sbss_symbol_ptr;
- +static asection c33_elf_tbss_section;
- +static asymbol c33_elf_tbss_symbol;
- +static asymbol * c33_elf_tbss_symbol_ptr;
- +static asection c33_elf_zbss_section;
- +static asymbol c33_elf_zbss_symbol;
- +static asymbol * c33_elf_zbss_symbol_ptr;
- +#endif
- +
- +/* Given a BFD section, try to locate the corresponding ELF section
- + index. */
- +
- +static boolean
- +c33_elf_section_from_bfd_section (abfd, hdr, sec, retval)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED;
- + asection * sec;
- + int * retval;
- +{
- + if (strcmp (bfd_get_section_name (abfd, sec), ".comm") == 0)
- + *retval = SHN_C33_COMM;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".gcomm") == 0)
- + *retval = SHN_C33_GCOMM;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".scomm") == 0)
- + *retval = SHN_C33_SCOMM;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".tcomm") == 0)
- + *retval = SHN_C33_TCOMM;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".zcomm") == 0)
- + *retval = SHN_C33_ZCOMM;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".gbss") == 0)
- + *retval = SHN_C33_GBSS;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".sbss") == 0)
- + *retval = SHN_C33_SBSS;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".tbss") == 0)
- + *retval = SHN_C33_TBSS;
- + else if (strcmp (bfd_get_section_name (abfd, sec), ".zbss") == 0)
- + *retval = SHN_C33_ZBSS;
- +#endif
- + else
- + return false;
- +
- +
- + return true;
- +}
- +
- +/* Handle the special c33 section numbers that a symbol may use. */
- +
- +static void
- +c33_elf_symbol_processing (abfd, asym)
- + bfd * abfd;
- + asymbol * asym;
- +{
- + elf_symbol_type * elfsym = (elf_symbol_type *) asym;
- + unsigned short index;
- +
- + index = elfsym->internal_elf_sym.st_shndx;
- +
- + /* If the section index is an "ordinary" index, then it may
- + refer to a c33 specific section created by the assembler.
- + Check the section's type and change the index it matches.
- +
- + FIXME: Should we alter the st_shndx field as well ? */
- + /* Modify tazaki 2001.07.25 */
- +
- + if (index < elf_elfheader(abfd)[0].e_shnum)
- + switch (elf_elfsections(abfd)[index]->sh_type)
- + {
- + case SHT_C33_COMM:
- + index = SHN_C33_COMM;
- + break;
- + case SHT_C33_GCOMM:
- + index = SHN_C33_GCOMM;
- + break;
- + case SHT_C33_SCOMM:
- + index = SHN_C33_SCOMM;
- + break;
- + case SHT_C33_TCOMM:
- + index = SHN_C33_TCOMM;
- + break;
- + case SHT_C33_ZCOMM:
- + index = SHN_C33_ZCOMM;
- + break;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + case SHT_C33_GBSS:
- + index = SHN_C33_GBSS;
- + break;
- + case SHT_C33_SBSS:
- + index = SHN_C33_SBSS;
- + break;
- + case SHT_C33_TBSS:
- + index = SHN_C33_TBSS;
- + break;
- + case SHT_C33_ZBSS:
- + index = SHN_C33_ZBSS;
- + break;
- +#endif
- + default:
- + break;
- + }
- +
- + switch (index)
- + {
- + case SHN_C33_COMM:
- + if (c33_elf_comm_section.name == NULL)
- + {
- + /* Initialize the small common section. */
- + c33_elf_comm_section.name = ".comm";
- + c33_elf_comm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_comm_section.output_section = & c33_elf_comm_section;
- + c33_elf_comm_section.symbol = & c33_elf_comm_symbol;
- + c33_elf_comm_section.symbol_ptr_ptr = & c33_elf_comm_symbol_ptr;
- + c33_elf_comm_symbol.name = ".comm";
- + c33_elf_comm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_comm_symbol.section = & c33_elf_comm_section;
- + c33_elf_comm_symbol_ptr = & c33_elf_comm_symbol;
- + }
- + asym->section = & c33_elf_comm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_GCOMM:
- + if (c33_elf_gcomm_section.name == NULL)
- + {
- + /* Initialize the G common section. */
- + c33_elf_gcomm_section.name = ".gcomm";
- + c33_elf_gcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_gcomm_section.output_section = & c33_elf_gcomm_section;
- + c33_elf_gcomm_section.symbol = & c33_elf_gcomm_symbol;
- + c33_elf_gcomm_section.symbol_ptr_ptr = & c33_elf_gcomm_symbol_ptr;
- + c33_elf_gcomm_symbol.name = ".gcomm";
- + c33_elf_gcomm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_gcomm_symbol.section = & c33_elf_gcomm_section;
- + c33_elf_gcomm_symbol_ptr = & c33_elf_gcomm_symbol;
- + }
- + asym->section = & c33_elf_gcomm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_SCOMM:
- + if (c33_elf_scomm_section.name == NULL)
- + {
- + /* Initialize S common section. */
- + c33_elf_scomm_section.name = ".scomm";
- + c33_elf_scomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_scomm_section.output_section = & c33_elf_scomm_section;
- + c33_elf_scomm_section.symbol = & c33_elf_scomm_symbol;
- + c33_elf_scomm_section.symbol_ptr_ptr = & c33_elf_scomm_symbol_ptr;
- + c33_elf_scomm_symbol.name = ".scomm";
- + c33_elf_scomm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_scomm_symbol.section = & c33_elf_scomm_section;
- + c33_elf_scomm_symbol_ptr = & c33_elf_scomm_symbol;
- + }
- + asym->section = & c33_elf_scomm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_TCOMM:
- + if (c33_elf_tcomm_section.name == NULL)
- + {
- + /* Initialize the T common section. */
- + c33_elf_tcomm_section.name = ".tcomm";
- + c33_elf_tcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_tcomm_section.output_section = & c33_elf_tcomm_section;
- + c33_elf_tcomm_section.symbol = & c33_elf_tcomm_symbol;
- + c33_elf_tcomm_section.symbol_ptr_ptr = & c33_elf_tcomm_symbol_ptr;
- + c33_elf_tcomm_symbol.name = ".tcomm";
- + c33_elf_tcomm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_tcomm_symbol.section = & c33_elf_tcomm_section;
- + c33_elf_tcomm_symbol_ptr = & c33_elf_tcomm_symbol;
- + }
- + asym->section = & c33_elf_tcomm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_ZCOMM:
- + if (c33_elf_zcomm_section.name == NULL)
- + {
- + /* Initialize the Z common section. */
- + c33_elf_zcomm_section.name = ".zcomm";
- + c33_elf_zcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_zcomm_section.output_section = & c33_elf_zcomm_section;
- + c33_elf_zcomm_section.symbol = & c33_elf_zcomm_symbol;
- + c33_elf_zcomm_section.symbol_ptr_ptr = & c33_elf_zcomm_symbol_ptr;
- + c33_elf_zcomm_symbol.name = ".zcomm";
- + c33_elf_zcomm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_zcomm_symbol.section = & c33_elf_zcomm_section;
- + c33_elf_zcomm_symbol_ptr = & c33_elf_zcomm_symbol;
- + }
- + asym->section = & c33_elf_zcomm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + case SHN_C33_GBSS:
- + if (c33_elf_gbss_section.name == NULL)
- + {
- + /* Initialize the Local G common section. */
- + c33_elf_gbss_section.name = ".gbss";
- + c33_elf_gbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_gbss_section.output_section = & c33_elf_gbss_section;
- + c33_elf_gbss_section.symbol = & c33_elf_gbss_symbol;
- + c33_elf_gbss_section.symbol_ptr_ptr = & c33_elf_gbss_symbol_ptr;
- + c33_elf_gbss_symbol.name = ".gbss";
- + c33_elf_gbss_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_gbss_symbol.section = & c33_elf_gbss_section;
- + c33_elf_gbss_symbol_ptr = & c33_elf_gbss_symbol;
- + }
- + asym->section = & c33_elf_gbss_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_SBSS:
- + if (c33_elf_sbss_section.name == NULL)
- + {
- + /* Initialize the Local S common section. */
- + c33_elf_sbss_section.name = ".sbss";
- + c33_elf_sbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_sbss_section.output_section = & c33_elf_sbss_section;
- + c33_elf_sbss_section.symbol = & c33_elf_sbss_symbol;
- + c33_elf_sbss_section.symbol_ptr_ptr = & c33_elf_sbss_symbol_ptr;
- + c33_elf_sbss_symbol.name = ".sbss";
- + c33_elf_sbss_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_sbss_symbol.section = & c33_elf_sbss_section;
- + c33_elf_sbss_symbol_ptr = & c33_elf_sbss_symbol;
- + }
- + asym->section = & c33_elf_sbss_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_TBSS:
- + if (c33_elf_tbss_section.name == NULL)
- + {
- + /* Initialize the Local T common section. */
- + c33_elf_tbss_section.name = ".tbss";
- + c33_elf_tbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_tbss_section.output_section = & c33_elf_tbss_section;
- + c33_elf_tbss_section.symbol = & c33_elf_tbss_symbol;
- + c33_elf_tbss_section.symbol_ptr_ptr = & c33_elf_tbss_symbol_ptr;
- + c33_elf_tbss_symbol.name = ".tbss";
- + c33_elf_tbss_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_tbss_symbol.section = & c33_elf_tbss_section;
- + c33_elf_tbss_symbol_ptr = & c33_elf_tbss_symbol;
- + }
- + asym->section = & c33_elf_tbss_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +
- + case SHN_C33_ZBSS:
- + if (c33_elf_zbss_section.name == NULL)
- + {
- + /* Initialize the Local Z common section. */
- + c33_elf_zbss_section.name = ".zbss";
- + c33_elf_zbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_zbss_section.output_section = & c33_elf_zbss_section;
- + c33_elf_zbss_section.symbol = & c33_elf_zbss_symbol;
- + c33_elf_zbss_section.symbol_ptr_ptr = & c33_elf_zbss_symbol_ptr;
- + c33_elf_zbss_symbol.name = ".zbss";
- + c33_elf_zbss_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_zbss_symbol.section = & c33_elf_zbss_section;
- + c33_elf_zbss_symbol_ptr = & c33_elf_zbss_symbol;
- + }
- + asym->section = & c33_elf_zbss_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +#endif
- +
- +/* gp参照用に必要? */
- +/*
- + case SHN_C33_SCOMMON:
- + if (c33_elf_scomm_section.name == NULL)
- + {
- + c33_elf_scomm_section.name = ".scommon";
- + c33_elf_scomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
- + c33_elf_scomm_section.output_section = & c33_elf_scomm_section;
- + c33_elf_scomm_section.symbol = & c33_elf_scomm_symbol;
- + c33_elf_scomm_section.symbol_ptr_ptr = & c33_elf_scomm_symbol_ptr;
- + c33_elf_scomm_symbol.name = ".scommon";
- + c33_elf_scomm_symbol.flags = BSF_SECTION_SYM;
- + c33_elf_scomm_symbol.section = & c33_elf_scomm_section;
- + c33_elf_scomm_symbol_ptr = & c33_elf_scomm_symbol;
- + }
- + asym->section = & c33_elf_scomm_section;
- + asym->value = elfsym->internal_elf_sym.st_size;
- + break;
- +*/
- + }
- +}
- +
- +/* Hook called by the linker routine which adds symbols from an object
- + file. We must handle the special c33 section numbers here. */
- +
- +/*ARGSUSED*/
- +/* Modify tazaki 2001.07.25 */
- +static boolean
- +c33_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- + bfd * abfd;
- + struct bfd_link_info * info ATTRIBUTE_UNUSED;
- + const Elf_Internal_Sym * sym;
- + const char ** namep ATTRIBUTE_UNUSED;
- + flagword * flagsp ATTRIBUTE_UNUSED;
- + asection ** secp;
- + bfd_vma * valp;
- +{
- + int index = sym->st_shndx;
- +
- + /* If the section index is an "ordinary" index, then it may
- + refer to a c33 specific section created by the assembler.
- + Check the section's type and change the index it matches.
- +
- + FIXME: Should we alter the st_shndx field as well ? */
- +
- + if (index < elf_elfheader(abfd)[0].e_shnum)
- + switch (elf_elfsections(abfd)[index]->sh_type)
- + {
- + /* del tazaki 2001.07.25
- + case SHT_C33_SCOMMON:
- + index = SHN_C33_SCOMMON;
- + break;
- + */
- +/* add tazaki 2001.11.19 >>>>> */
- + case SHT_C33_COMM:
- + index = SHN_C33_COMM;
- + break;
- + case SHT_C33_GCOMM:
- + index = SHN_C33_GCOMM;
- + break;
- + case SHT_C33_SCOMM:
- + index = SHN_C33_SCOMM;
- + break;
- + case SHT_C33_TCOMM:
- + index = SHN_C33_TCOMM;
- + break;
- + case SHT_C33_ZCOMM:
- + index = SHN_C33_ZCOMM;
- + break;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + case SHT_C33_GBSS:
- + index = SHN_C33_GBSS;
- + break;
- + case SHT_C33_SBSS:
- + index = SHN_C33_SBSS;
- + break;
- + case SHT_C33_TBSS:
- + index = SHN_C33_TBSS;
- + break;
- + case SHT_C33_ZBSS:
- + index = SHN_C33_ZBSS;
- + break;
- +#endif
- +/* add tazaki 2001.11.19 <<<<< */
- +
- + default:
- + break;
- + }
- +
- + switch (index)
- + {
- +/* del tazaki 2001.07.25
- + case SHN_C33_SCOMMON:
- + *secp = bfd_make_section_old_way (abfd, ".scommon");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +*/
- +/* add tazaki 2001.11.19 >>>>> */
- + case SHN_C33_COMM:
- + *secp = bfd_make_section_old_way (abfd, ".comm");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_GCOMM:
- + *secp = bfd_make_section_old_way (abfd, ".gcomm");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_SCOMM:
- + *secp = bfd_make_section_old_way (abfd, ".scomm");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_TCOMM:
- + *secp = bfd_make_section_old_way (abfd, ".tcomm");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_ZCOMM:
- + *secp = bfd_make_section_old_way (abfd, ".zcomm");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + case SHN_C33_GBSS:
- + *secp = bfd_make_section_old_way (abfd, ".gbss");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_SBSS:
- + *secp = bfd_make_section_old_way (abfd, ".sbss");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_TBSS:
- + *secp = bfd_make_section_old_way (abfd, ".tbss");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +
- + case SHN_C33_ZBSS:
- + *secp = bfd_make_section_old_way (abfd, ".zbss");
- + (*secp)->flags |= SEC_IS_COMMON;
- + *valp = sym->st_size;
- + break;
- +#endif
- +
- +/* add tazaki 2001.11.19 <<<<< */
- + }
- +
- + return true;
- +}
- +
- +/*ARGSIGNORED*/
- +static boolean
- +c33_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + struct bfd_link_info * info ATTRIBUTE_UNUSED;
- + const char * name ATTRIBUTE_UNUSED;
- + Elf_Internal_Sym * sym;
- + asection * input_sec;
- +{
- + /* If we see a common symbol, which implies a relocatable link, then
- + if a symbol was in a special common section in an input file, mark
- + it as a special common in the output file. */
- +
- + if (sym->st_shndx == SHN_COMMON)
- + {
- + if (strcmp (input_sec->name, ".comm") == 0)
- + sym->st_shndx = SHN_C33_COMM;
- + else if (strcmp (input_sec->name, ".gcomm") == 0)
- + sym->st_shndx = SHN_C33_GCOMM;
- + else if (strcmp (input_sec->name, ".scomm") == 0)
- + sym->st_shndx = SHN_C33_SCOMM;
- + else if (strcmp (input_sec->name, ".tcomm") == 0)
- + sym->st_shndx = SHN_C33_TCOMM;
- + else if (strcmp (input_sec->name, ".zcomm") == 0)
- + sym->st_shndx = SHN_C33_ZCOMM;
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + else if (strcmp (input_sec->name, ".gbss") == 0)
- + sym->st_shndx = SHN_C33_GBSS;
- + else if (strcmp (input_sec->name, ".sbss") == 0)
- + sym->st_shndx = SHN_C33_SBSS;
- + else if (strcmp (input_sec->name, ".tbss") == 0)
- + sym->st_shndx = SHN_C33_TBSS;
- + else if (strcmp (input_sec->name, ".zbss") == 0)
- + sym->st_shndx = SHN_C33_ZBSS;
- +#endif
- + }
- +
- + return true;
- +}
- +
- +/* Modify tazaki 2001.07.25 */
- +static boolean
- +c33_elf_section_from_shdr (abfd, hdr, name)
- + bfd * abfd;
- + Elf_Internal_Shdr * hdr;
- + char * name;
- +{
- + /* There ought to be a place to keep ELF backend specific flags, but
- + at the moment there isn't one. We just keep track of the
- + sections by their name, instead. */
- +
- + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
- + return false;
- +
- + switch (hdr->sh_type)
- + {
- +/* case SHT_C33_SCOMMON: */
- + case SHT_C33_COMM:
- + case SHT_C33_GCOMM:
- + case SHT_C33_SCOMM:
- + case SHT_C33_TCOMM:
- + case SHT_C33_ZCOMM:
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + case SHT_C33_GBSS:
- + case SHT_C33_SBSS:
- + case SHT_C33_TBSS:
- + case SHT_C33_ZBSS:
- +#endif
- + if (! bfd_set_section_flags (abfd, hdr->bfd_section,
- + (bfd_get_section_flags (abfd,
- + hdr->bfd_section)
- + | SEC_IS_COMMON)))
- + return false;
- + }
- +
- + return true;
- +}
- +
- +/* Set the correct type for a C33 ELF section. We do this by the
- + section name, which is a hack, but ought to work. */
- +
- +/* Modify tazaki 2001.11.19 >>>>> */
- +
- +static boolean
- +c33_elf_fake_sections (abfd, hdr, sec)
- + bfd * abfd ATTRIBUTE_UNUSED;
- + Elf32_Internal_Shdr * hdr;
- + asection * sec;
- +{
- + register const char * name;
- +
- + name = bfd_get_section_name (abfd, sec);
- +
- + if (strcmp (name, ".comm") == 0)
- + {
- + hdr->sh_type = SHT_C33_COMM;
- + }
- + else if (strcmp (name, ".gcomm") == 0)
- + {
- + hdr->sh_type = SHT_C33_GCOMM;
- + }
- + else if (strcmp (name, ".scomm") == 0)
- + {
- + hdr->sh_type = SHT_C33_SCOMM;
- + }
- + else if (strcmp (name, ".tcomm") == 0)
- + {
- + hdr->sh_type = SHT_C33_TCOMM;
- + }
- + else if (strcmp (name, ".zcomm") == 0)
- + {
- + hdr->sh_type = SHT_C33_ZCOMM;
- + }
- +/* del 2002/07/17 T.Tazaki >>> */
- +#if 0
- + else if (strcmp (name, ".gbss") == 0)
- + {
- + hdr->sh_type = SHT_C33_GBSS;
- + }
- + else if (strcmp (name, ".sbss") == 0)
- + {
- + hdr->sh_type = SHT_C33_SBSS;
- + }
- + else if (strcmp (name, ".tbss") == 0)
- + {
- + hdr->sh_type = SHT_C33_TBSS;
- + }
- + else if (strcmp (name, ".zbss") == 0)
- + {
- + hdr->sh_type = SHT_C33_ZBSS;
- + }
- +#endif
- +
- + return true;
- +}
- +/* Modify tazaki 2001.11.19 <<<<< */
- +
- +
- +
- +#define TARGET_LITTLE_SYM bfd_elf32_c33_vec
- +#define TARGET_LITTLE_NAME "elf32-c33"
- +#define ELF_ARCH bfd_arch_c33
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/15 machine code */
- +#define ELF_MACHINE_CODE EM_NONE // do not change to EM_SE_C33
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/15 machine code */
- +#define ELF_MAXPAGESIZE 0x1000
- +
- +#define elf_info_to_howto c33_elf_info_to_howto_rela
- +#define elf_info_to_howto_rel c33_elf_info_to_howto_rel
- +
- +#define elf_backend_check_relocs c33_elf_check_relocs
- +#define elf_backend_relocate_section c33_elf_relocate_section
- +
- +#if 0
- +#define elf_backend_object_p c33_elf_object_p
- +#define elf_backend_final_write_processing c33_elf_final_write_processing
- +#endif
- +
- +#define elf_backend_section_from_bfd_section c33_elf_section_from_bfd_section
- +#define elf_backend_symbol_processing c33_elf_symbol_processing
- +#define elf_backend_add_symbol_hook c33_elf_add_symbol_hook
- +#define elf_backend_link_output_symbol_hook c33_elf_link_output_symbol_hook
- +#define elf_backend_section_from_shdr c33_elf_section_from_shdr
- +#define elf_backend_fake_sections c33_elf_fake_sections
- +#define elf_backend_gc_mark_hook c33_elf_gc_mark_hook
- +#define elf_backend_gc_sweep_hook c33_elf_gc_sweep_hook
- +
- +#define elf_backend_can_gc_sections 1
- +
- +
- +#define bfd_elf32_bfd_is_local_label_name c33_elf_is_local_label_name
- +#define bfd_elf32_bfd_reloc_type_lookup c33_elf_reloc_type_lookup
- +#define bfd_elf32_bfd_copy_private_bfd_data c33_elf_copy_private_bfd_data
- +#define bfd_elf32_bfd_merge_private_bfd_data c33_elf_merge_private_bfd_data
- +#define bfd_elf32_bfd_set_private_flags c33_elf_set_private_flags
- +#define bfd_elf32_bfd_print_private_bfd_data c33_elf_print_private_bfd_data
- +
- +/* change leading_char for map file T.Tazaki 2003/12/09 >>> */
- +//#define elf_symbol_leading_char '_'
- +#define elf_symbol_leading_char '#'
- +/* change T.Tazaki 2003/12/09 <<< */
- +
- +#include "elf32-target.h"
- diff --git a/bfd/syms.c b/bfd/syms.c
- index 6546f58..944c73b 100644
- --- a/bfd/syms.c
- +++ b/bfd/syms.c
- @@ -1234,7 +1234,18 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
- case N_BSLINE:
- /* A line number. The value is relative to the start of the
- current function. */
- + /* >>>>> change T.Tazaik 2002/01/29 */
- + /*
- val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
- + */
- + if ( strncmp(
- + ( indexentry->file_name ) + strlen( indexentry->file_name ) - 2 ,
- + ".c", 2 ) == 0 ) {
- + val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
- + } else {
- + val = bfd_get_32 (abfd, stab + VALOFF);
- + }
- + /* <<<<< change T.Tazaik 2002/01/29 */
- if (val <= offset)
- {
- *pline = bfd_get_16 (abfd, stab + DESCOFF);
- diff --git a/bfd/targets.c b/bfd/targets.c
- index 1f2217b..711025e 100644
- --- a/bfd/targets.c
- +++ b/bfd/targets.c
- @@ -539,6 +539,7 @@ extern const bfd_target bfd_elf32_sh_vec;
- extern const bfd_target bfd_elf32_shl_vec;
- extern const bfd_target bfd_elf32_sparc_vec;
- extern const bfd_target bfd_elf32_v850_vec;
- +extern const bfd_target bfd_elf32_c33_vec;
- extern const bfd_target bfd_elf32_fr30_vec;
- extern const bfd_target bfd_elf32_mcore_big_vec;
- extern const bfd_target bfd_elf32_mcore_little_vec;
- diff --git a/binutils/Makefile.am b/binutils/Makefile.am
- index a6eb22a..34fd193 100644
- --- a/binutils/Makefile.am
- +++ b/binutils/Makefile.am
- @@ -474,6 +474,7 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \
- + $(INCDIR)/elf/c33.h \
- $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \
- $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
- $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
- diff --git a/binutils/Makefile.in b/binutils/Makefile.in
- index f4178de..d947a9b 100644
- --- a/binutils/Makefile.in
- +++ b/binutils/Makefile.in
- @@ -1299,6 +1299,7 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
- $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \
- + $(INCDIR)/elf/c33.h \
- $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \
- $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
- $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
- diff --git a/binutils/objdump.c b/binutils/objdump.c
- index 4832e9d..f972ec3 100644
- --- a/binutils/objdump.c
- +++ b/binutils/objdump.c
- @@ -119,6 +119,9 @@ display_file PARAMS ((char *filename, char *target));
- static void
- dump_section_header PARAMS ((bfd *, asection *, PTR));
-
- +static int
- +has_debug_sections(bfd *abfd); /* add D.Fujimoto 2006.06.12 */
- +
- static void
- dump_headers PARAMS ((bfd *));
-
- @@ -343,8 +346,15 @@ dump_section_header (abfd, section, ignored)
- printf_vma (bfd_get_section_vma (abfd, section));
- printf (" ");
- printf_vma (section->lma);
- - printf (" %08lx 2**%u", section->filepos,
- - bfd_get_section_alignment (abfd, section));
- + /* .comm ---> alignment 2**2 fixed add tazaki 2001.11.06 */
- +/* if ( strcmp( bfd_get_section_name (abfd, section),".comm" ) ){ */
- + printf (" %08lx 2**%u", section->filepos,
- + bfd_get_section_alignment (abfd, section));
- +/*
- + }else{
- + printf (" %08lx 2**2", section->filepos );
- + }
- +*/
- if (! wide_output)
- printf ("\n ");
- printf (" ");
- @@ -405,9 +415,34 @@ dump_section_header (abfd, section, ignored)
- }
-
- printf ("\n");
- +
- #undef PF
- }
-
- +/* >>>>> check if debugging sections are present add D.Fujimoto 2006.06.12 */
- +static int has_debug_sections(abfd)
- + bfd *abfd ATTRIBUTE_UNUSED;
- +{
- + int ret = 0;
- + const char *section_name;
- + asection *p;
- +
- + for (p = abfd->sections; p != NULL; p = p->next) {
- + section_name = p->name;
- +
- + // search for section names starting with .stab or .comment
- + if (strncmp(section_name, ".stab", sizeof(".stab") - 1) == 0 ||
- + strncmp(section_name, ".comment", sizeof(".comment") - 1) == 0) {
- + ret = 1;
- + break;
- + }
- +
- + }
- +
- + return ret;
- +}
- +/* <<<<< check if debugging sections are present add D.Fujimoto 2006.06.12 */
- +
- static void
- dump_headers (abfd)
- bfd *abfd;
- @@ -425,6 +460,13 @@ dump_headers (abfd)
- printf ("\n");
-
- bfd_map_over_sections (abfd, dump_section_header, (PTR) NULL);
- +
- + /* >>>>> display message concerning debugging sections add D.Fujimoto 2006.06.12 */
- + if (has_debug_sections(abfd)) {
- + printf ("\n*** Debugging sections will not be loaded to the target ***\n\n");
- + }
- + /* <<<<< display message concerning debugging sections add D.Fujimoto 2006.06.12 */
- +
- }
-
- static asymbol **
- @@ -1251,6 +1293,9 @@ disassemble_bytes (info, disassemble_fn, insns, data,
- bfd_vma addr_offset;
- int opb = info->octets_per_byte;
-
- + bfd_byte iData1,iData2; /* add tazaki 2001.07.31 */
- + int iFlag; /* add tazaki 2001.07.31 */
- +
- aux = (struct objdump_disasm_info *) info->application_data;
- section = aux->sec;
-
- @@ -1334,7 +1379,8 @@ disassemble_bytes (info, disassemble_fn, insns, data,
- *s = ' ';
- if (*s == '\0')
- *--s = '0';
- - printf ("%s:\t", buf + skip_addr_chars);
- +/* printf ("%s:\t", buf + skip_addr_chars); */
- + printf ("%s: ", buf + skip_addr_chars); /* tazaki 2001.11.02 */
- }
- else
- {
- @@ -1411,24 +1457,39 @@ disassemble_bytes (info, disassemble_fn, insns, data,
- else
- bpc = 1;
-
- - for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
- + iFlag = 0; /* add tazaki 2001.07.31 */
- +
- + for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
- {
- int k;
- +/* del tazaki 2001.07.31 >>>>>
- if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
- - {
- + {
- for (k = bpc - 1; k >= 0; k--)
- - printf ("%02x", (unsigned) data[j + k]);
- + printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
- - }
- - else
- - {
- + }
- + else{
- for (k = 0; k < bpc; k++)
- - printf ("%02x", (unsigned) data[j + k]);
- + printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
- - }
- + }
- +<<<< del */
- +/* add tazaki 2001.07.31 >>>> */
- + if( iFlag == 0 ){
- + iData2 = data[j + 0];
- + iFlag = 1;
- + }else{
- + iData1 = data[j + 0];
- + iFlag = 0;
- + }
- +/* add <<<< */
- }
- +
- + printf( "%02x%02x",iData1,iData2 ); /* add tazaki 2001.07.31 */
-
- - for (; pb < octets_per_line; pb += bpc)
- +/* del tazaki 2001.11.06 >>>>>>>>>>>>>
- + for (; pb < octets_per_line; pb += bpc)
- {
- int k;
-
- @@ -1437,12 +1498,12 @@ disassemble_bytes (info, disassemble_fn, insns, data,
- putchar (' ');
- }
-
- - /* Separate raw data from instruction by extra space. */
- if (insns)
- - putchar ('\t');
- + putchar ('\t');
- else
- - printf (" ");
- - }
- + printf (" ");
- +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
- + }
-
- if (! insns)
- printf ("%s", buf);
- @@ -1512,7 +1573,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
- q = **relppp;
-
- if (wide_output)
- - putchar ('\t');
- + putchar ('\t');
- else
- printf ("\t\t\t");
-
- diff --git a/binutils/stabs.c b/binutils/stabs.c
- index 5f60035..04031cc 100644
- --- a/binutils/stabs.c
- +++ b/binutils/stabs.c
- @@ -556,6 +556,13 @@ parse_stab (dhandle, handle, type, desc, value, string)
- if (*string == '\0')
- return true;
-
- + /* >>>>> add T.Tazaki 2002/01/29 */
- + if ( strncmp( string +strlen( string ) - 2 , ".c", 2 )
- + != 0 ){
- + info->function_start_offset = 0x0;
- + }
- + /* <<<<< add T.Tazaki 2002/01/29 */
- +
- /* Just accumulate strings until we see a non N_SO symbol. If
- the string starts with a directory separator or some other
- form of absolute path specification, we discard the previously
- diff --git a/binutils/version.c b/binutils/version.c
- index cb893cf..da274a8 100644
- --- a/binutils/version.c
- +++ b/binutils/version.c
- @@ -21,6 +21,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- #include "bfd.h"
- #include "bucomm.h"
-
- +#define BINUTILS_REVISION "2.15 <2008/05/22>"
- +
- /* This is the version numbers for the binutils. They all change in
- lockstep -- it's easier that way. */
-
- @@ -35,7 +37,12 @@ print_version (name)
- {
- /* This output is intended to follow the GNU standards document. */
- /* xgettext:c-format */
- +/* change T.Tazaki 2002.01.31 >>> */
- +/*
- printf ("GNU %s %s\n", name, program_version);
- +*/
- + printf ("GNU %s %s (rev %s)\n", name, program_version, BINUTILS_REVISION);
- +/* change T.Tazaki 2002.01.31 <<< */
- printf (_("Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.\n"));
- printf (_("\
- This program is free software; you may redistribute it under the terms of\n\
- diff --git a/config.sub b/config.sub
- index 42fc991..884470f 100755
- --- a/config.sub
- +++ b/config.sub
- @@ -218,7 +218,7 @@ case $basic_machine in
- | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
- | mips64vr5000 | miprs64vr5000el | mcore \
- | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
- - | thumb | d10v | d30v | fr30 | avr)
- + | thumb | d10v | d30v | fr30 | c33 | avr )
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- @@ -261,7 +261,7 @@ case $basic_machine in
- | mipstx39-* | mipstx39el-* | mcore-* \
- | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
- | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
- - | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
- + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* | c33-* \
- | bs2000-* | tic54x-* | c54x-* | x86_64-*)
- ;;
- # Recognize the various machine names and aliases which stand
- diff --git a/configure.in b/configure.in
- index 8171c53..2ce6d70 100644
- --- a/configure.in
- +++ b/configure.in
- @@ -861,6 +861,9 @@ case "${target}" in
- v850-*-*)
- noconfigdirs="$noconfigdirs target-libgloss"
- ;;
- + c33-*-*)
- + noconfigdirs="$noconfigdirs target-libgloss"
- + ;;
- v850e-*-*)
- noconfigdirs="$noconfigdirs target-libgloss"
- ;;
- diff --git a/gas/Makefile.am b/gas/Makefile.am
- index 49b52f7..136f719 100644
- --- a/gas/Makefile.am
- +++ b/gas/Makefile.am
- @@ -67,6 +67,7 @@ CPU_TYPES = \
- vax \
- w65 \
- v850 \
- + c33 \
- z8k
-
- # Object format types. This is only used for dependency information.
- @@ -169,7 +170,8 @@ GAS_CFILES = \
- stabs.c \
- subsegs.c \
- symbols.c \
- - write.c
- + write.c \
- + ext_remove.c
-
- CFILES = $(GAS_CFILES) gasp.c itbl-ops.c
-
- @@ -199,7 +201,8 @@ HFILES = \
- subsegs.h \
- symbols.h \
- tc.h \
- - write.h
- + write.h \
- + ext_remove.h
-
- # CPU files in config.
-
- @@ -237,6 +240,7 @@ TARGET_CPU_CFILES = \
- config/tc-vax.c \
- config/tc-w65.c \
- config/tc-v850.c \
- + config/tc-c33.c \
- config/tc-z8k.c
-
- TARGET_CPU_HFILES = \
- @@ -273,6 +277,7 @@ TARGET_CPU_HFILES = \
- config/tc-vax.h \
- config/tc-w65.h \
- config/tc-v850.h \
- + config/tc-c33.h \
- config/tc-z8k.h
-
- # OBJ files in config
- @@ -378,7 +383,9 @@ GENERIC_OBJS = \
- ecoff.o \
- stabs.o \
- sb.o \
- - macro.o
- + macro.o \
- + ext_remove.o
- +
-
- OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
-
- @@ -1291,6 +1298,10 @@ DEPTC_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
- emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
- +DEPTC_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
- + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/c33.h
- DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/bin-bugs.h \
- $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
- @@ -1632,6 +1643,10 @@ DEPOBJ_z8k_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \
- emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
- +DEPOBJ_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
- + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
- DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
- $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
- @@ -1849,6 +1864,9 @@ DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
- DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h
- +DEP_c33_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
- + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h
- DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h
- diff --git a/gas/Makefile.in b/gas/Makefile.in
- index 569b98e..4dd7c89 100644
- --- a/gas/Makefile.in
- +++ b/gas/Makefile.in
- @@ -171,6 +171,7 @@ CPU_TYPES = \
- vax \
- w65 \
- v850 \
- + c33 \
- z8k
-
-
- @@ -277,7 +278,8 @@ GAS_CFILES = \
- stabs.c \
- subsegs.c \
- symbols.c \
- - write.c
- + write.c \
- + ext_remove.c
-
-
- CFILES = $(GAS_CFILES) gasp.c itbl-ops.c
- @@ -308,7 +310,8 @@ HFILES = \
- subsegs.h \
- symbols.h \
- tc.h \
- - write.h
- + write.h \
- + ext_remove.h
-
-
- # CPU files in config.
- @@ -347,6 +350,7 @@ TARGET_CPU_CFILES = \
- config/tc-vax.c \
- config/tc-w65.c \
- config/tc-v850.c \
- + config/tc-c33.c \
- config/tc-z8k.c
-
-
- @@ -384,6 +388,7 @@ TARGET_CPU_HFILES = \
- config/tc-vax.h \
- config/tc-w65.h \
- config/tc-v850.h \
- + config/tc-c33.h \
- config/tc-z8k.h
-
-
- @@ -466,7 +471,6 @@ CONFIG_OBJS = \
- $(ATOF_TARG_O) \
- $(extra_objects)
-
- -
- GENERIC_OBJS = \
- app.o \
- as.o \
- @@ -495,7 +499,8 @@ GENERIC_OBJS = \
- ecoff.o \
- stabs.o \
- sb.o \
- - macro.o
- + macro.o \
- + ext_remove.o
-
-
- OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
- @@ -1034,6 +1039,11 @@ DEPTC_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
- emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
-
- +DEPTC_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
- + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/c33.h
- +
- DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/bin-bugs.h \
- $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
- @@ -1454,6 +1464,11 @@ DEPOBJ_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
- emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
-
- +DEPOBJ_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
- + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
- + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
- + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
- +
- DEPOBJ_z8k_coff = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-coff.h \
- $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
- @@ -1764,6 +1779,10 @@ DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
- $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h
-
- +DEP_c33_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
- + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h
- +
- DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
- $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h
- @@ -1795,11 +1814,12 @@ itbl_test_OBJECTS = itbl-parse.o itbl-lex.o
- itbl_test_DEPENDENCIES = itbl-tops.o itbl-test.o \
- ../libiberty/libiberty.a
- itbl_test_LDFLAGS =
- +
- as_new_OBJECTS = app.o as.o atof-generic.o bignum-copy.o cond.o \
- depend.o dwarf2dbg.o ecoff.o ehopt.o expr.o flonum-copy.o \
- flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o \
- listing.o literal.o macro.o messages.o output-file.o read.o sb.o \
- -stabs.o subsegs.o symbols.o write.o
- +stabs.o subsegs.o symbols.o write.o ext_remove.o
- as_new_LDFLAGS =
- gasp_new_OBJECTS = gasp.o macro.o sb.o hash.o
- gasp_new_LDFLAGS =
- @@ -2668,6 +2688,7 @@ e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c $(INCDIR)/bin-bugs.h \
- emul.h emul-target.h
- e-mipself.o: $(srcdir)/config/e-mipself.c $(INCDIR)/bin-bugs.h \
- emul.h emul-target.h
- +ext_remove.o: ext_remove.c ext_remove.h
- $(OBJS): $(DEP_@target_cpu_type@_@obj_format@)
- $(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@)
- $(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@)
- diff --git a/gas/as.c b/gas/as.c
- index f02c42a..6ddea62 100644
- --- a/gas/as.c
- +++ b/gas/as.c
- @@ -1,5 +1,5 @@
- /* as.c - GAS main program.
- - Copyright (C) 1987, 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
- + Copyright (C) 1987, 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
- Free Software Foundation, Inc.
-
- This file is part of GAS, the GNU Assembler.
- @@ -26,16 +26,22 @@
- * are shared.
- *
- *
- - * bugs
- + * bugs
- *
- * : initialisers
- - * Since no-one else says they will support them in future: I
- + * Since no-one else says they will support them in future: I
- * don't support them now.
- *
- */
-
- #include "ansidecl.h"
-
- +#define C33_AS_REVISION "2.15 <2008/05/22>"
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +//#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor add T.Tazaki 2003/05/14*/
- +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +
- #define COMMON
-
- #include "as.h"
- @@ -43,6 +49,7 @@
- #include "output-file.h"
- #include "sb.h"
- #include "macro.h"
- +#include "ext_remove.h" // add D.Fujimoto 2007/02/28
-
- #ifdef HAVE_ITBL_CPU
- #include "itbl-ops.h"
- @@ -63,9 +70,13 @@ static void dump_statistics PARAMS ((void));
- static void perform_an_assembly_pass PARAMS ((int argc, char **argv));
- static int macro_expr PARAMS ((const char *, int, sb *, int *));
-
- -int listing; /* true if a listing is wanted */
- +int listing; /* true if a listing is wanted */
-
- -static char *listing_filename = NULL; /* Name of listing file. */
- +/* add T.Tazaki 2002.04.26 >>> */
- +int g_listing = 0;
- +/* add T.Tazaki 2002.04.26 <<< */
- +
- +static char *listing_filename = NULL; /* Name of listing file. */
-
- /* Type of debugging to generate. */
-
- @@ -75,7 +86,7 @@ enum debug_info_type debug_type = DEBUG_NONE;
-
- int max_macro_nest = 100;
-
- -char *myname; /* argv[0] */
- +char *myname; /* argv[0] */
- #ifdef BFD_ASSEMBLER
- segT reg_section, expr_section;
- segT text_section, data_section, bss_section;
- @@ -157,10 +168,10 @@ select_emulation_mode (argc, argv)
- if (em)
- {
- for (i = 0; i < n_emulations; i++)
- - if (!strcmp (emulations[i]->name, em))
- - break;
- + if (!strcmp (emulations[i]->name, em))
- + break;
- if (i == n_emulations)
- - as_fatal (_("unrecognized emulation name `%s'"), em);
- + as_fatal (_("unrecognized emulation name `%s'"), em);
- this_emulation = emulations[i];
- }
- else
- @@ -190,10 +201,10 @@ common_emul_init ()
- if (this_emulation->fake_label_name == 0)
- {
- if (this_emulation->leading_underscore)
- - this_emulation->fake_label_name = "L0\001";
- + this_emulation->fake_label_name = "L0\001";
- else
- - /* What other parameters should we test? */
- - this_emulation->fake_label_name = ".L0\001";
- + /* What other parameters should we test? */
- + this_emulation->fake_label_name = ".L0\001";
- }
- }
- #endif
- @@ -207,8 +218,14 @@ print_version_id ()
- printed = 1;
-
- #ifdef BFD_ASSEMBLER
- +/* change T.Tazaki 2002.01.31 >>> */
- +/*
- fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"),
- - VERSION, TARGET_ALIAS, BFD_VERSION);
- + VERSION, TARGET_ALIAS, BFD_VERSION);
- +*/
- + fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s(rev %s)"),
- + VERSION, TARGET_ALIAS, BFD_VERSION, C33_AS_REVISION);
- +/* change T.Tazaki 2002.01.31 <<< */
- #else
- fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS);
- #endif
- @@ -223,17 +240,17 @@ show_usage (stream)
-
- fprintf (stream, _("\
- Options:\n\
- - -a[sub-option...] turn on listings\n\
- - Sub-options [default hls]:\n\
- - c omit false conditionals\n\
- - d omit debugging directives\n\
- - h include high-level source\n\
- - l include assembly\n\
- - m include macro expansions\n\
- - n omit forms processing\n\
- - s include symbols\n\
- - L include line debug statistics (if applicable)\n\
- - =FILE list to FILE (must be last sub-option)\n"));
- + -a[sub-option...] turn on listings\n\
- + Sub-options [default hls]:\n\
- + c omit false conditionals\n\
- + d omit debugging directives\n\
- + h include high-level source\n\
- + l include assembly\n\
- + m include macro expansions\n\
- + n omit forms processing\n\
- + s include symbols\n\
- + L include line debug statistics (if applicable)\n\
- + =FILE list to FILE (must be last sub-option)\n"));
-
- fprintf (stream, _("\
- -D produce assembler debugging messages\n"));
- @@ -320,6 +337,26 @@ Options:\n\
- --listing-cont-lines set the maximum number of continuation lines used\n\
- for the output data column of the listing\n"));
-
- +/* add 2002.01.25 >>>> */
- +
- + fprintf (stream, _("\
- + -mc33adv set advanced macro assemble mode\n"));
- +
- +/* add 2002.01.25 <<<< */
- +
- +/* add T.Tazaki 2003/11/18 >>>> */
- +
- + fprintf (stream, _("\
- + -mc33pe set PE macro assemble mode\n"));
- +
- +/* add T.Tazaki 2003/11/18 <<<< */
- +
- +
- +// ADD D.Fujimoto usage for -mc33_ext option 2007/02/28 >>>>>>>
- + fprintf (stream, _("\
- + -mc33_ext optimize ext code\n"));
- +// ADD D.Fujimoto usage for -mc33_ext option 2007/02/28 <<<<<<<
- +
- md_show_usage (stream);
-
- fputc ('\n', stream);
- @@ -337,6 +374,19 @@ Options:\n\
- * md_parse_option definitions in config/tc-*.c
- */
-
- +/* >>>>>>> add tazaki 2001.11.02 */
- +int g_iAdvance = 0; /* 0=STANDARD Architecture Mode */
- + /* 1=Advanced Architecture Mode */
- +/* <<<<<<< add tazaki 2001.11.02 */
- +
- +/* add T.Tazaki 2003/11/18 >>> */
- +int g_iPE = 0; /* 1=PE Architecture Mode */
- +/* add T.Tazaki 2003/11/18 <<< */
- +/* add T.Tazaki 2004/07/30 >>> */
- +int g_iMedda32 = 0; /* 1= No use default data area Mode */
- +/* add T.Tazaki 2004/07/30 <<< */
- +
- +
- static void
- parse_args (pargc, pargv)
- int *pargc;
- @@ -345,6 +395,14 @@ parse_args (pargc, pargv)
- int old_argc, new_argc;
- char **old_argv, **new_argv;
-
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- + int flag_plural_src = 0; // specified plural source files
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +// ADD D.Fujimoto 2008/01/07 >>>>>>>
- + int check_all_dump_flg = 0; // flag whether to check the all objects' dump file
- + int i_len;
- +// ADD D.Fujimoto 2008/01/07 <<<<<<<
- +
- /* Starting the short option string with '-' is for programs that
- expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- @@ -422,7 +480,32 @@ parse_args (pargc, pargv)
- #define OPTION_WARN (OPTION_STD_BASE + 18)
- {"warn", no_argument, NULL, OPTION_WARN},
- #define OPTION_WARN_FATAL (OPTION_STD_BASE + 19)
- - {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
- + {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
- +
- +/* add tazaki 2001.12.11 Avdanced Option >>>>>> */
- +
- +#define OPTION_ADVANCE (OPTION_STD_BASE + 20)
- + {"mc33adv", no_argument, NULL, OPTION_ADVANCE},
- +
- +/* <<<<<<<< add tazaki 2001.12.11 */
- +/* add T.Tazaki 2003/11/18 PE Option >>>>>> */
- +
- +#define OPTION_PE (OPTION_STD_BASE + 21)
- + {"mc33pe", no_argument, NULL, OPTION_PE},
- +
- +/* <<<<<<<< add T.Tazaki 2003/11/18 */
- +
- +/* -medda32 add T.Tazaki 2004/07/30 >>> */
- +#define OPTION_MEDDA32 (OPTION_STD_BASE + 22)
- + {"medda32", no_argument, NULL, OPTION_MEDDA32},
- +/* -medda32 add T.Tazaki 2004/07/30 <<< */
- +
- +// ADD D.Fujimoto mc33_ext option 2007/03/01 >>>>>>>
- +#define OPTION_C33_EXT (OPTION_STD_BASE + 23)
- + {"mc33_ext", required_argument, NULL, OPTION_C33_EXT}
- +// ADD D.Fujimoto mc33_ext option 2007/03/01 <<<<<<<
- +
- +
- };
-
- /* Construct the option lists from the standard list and the
- @@ -431,7 +514,7 @@ parse_args (pargc, pargv)
- longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
- memcpy (longopts, std_longopts, sizeof (std_longopts));
- memcpy ((char *) longopts + sizeof (std_longopts),
- - md_longopts, md_longopts_size);
- + md_longopts, md_longopts_size);
-
- /* Make a local copy of the old argv. */
- old_argc = *pargc;
- @@ -446,300 +529,381 @@ parse_args (pargc, pargv)
- while (1)
- {
- /* getopt_long_only is like getopt_long, but '-' as well as '--' can
- - indicate a long option. */
- + indicate a long option. */
- int longind;
- int optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,
- - &longind);
- + &longind);
- +
- +// ADD D.Fujimoto 2008/01/07 >>>>>>>
- + // check the all objects' dump file from command line
- + if( check_all_dump_flg == 1 ){
- + check_all_dump_flg = 0;
- +
- + // save the dump file name
- + if( optarg == 0 ){
- + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n") );
- + xexit (EXIT_FAILURE);
- + } else {
- + i_len = strlen( optarg );
- + if( 0 == memcmp( ".dump",&(optarg[i_len-5]),5 ) ){
- + cp_All_Dump_File_Name = optarg;
- + optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,&longind);
- + } else {
- + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n") );
- + xexit (EXIT_FAILURE);
- + }
- + }
- + }
- +// ADD D.Fujimoto 2008/01/07 <<<<<<<
- +
-
- if (optc == -1)
- - break;
- + break;
-
- switch (optc)
- - {
- - default:
- - /* md_parse_option should return 1 if it recognizes optc,
- - 0 if not. */
- - if (md_parse_option (optc, optarg) != 0)
- - break;
- - /* `-v' isn't included in the general short_opts list, so check for
- - it explicity here before deciding we've gotten a bad argument. */
- - if (optc == 'v')
- - {
- + {
- + default:
- + /* md_parse_option should return 1 if it recognizes optc,
- + 0 if not. */
- + if (md_parse_option (optc, optarg) != 0)
- + break;
- + /* `-v' isn't included in the general short_opts list, so check for
- + it explicity here before deciding we've gotten a bad argument. */
- + if (optc == 'v')
- + {
- #ifdef VMS
- - /* Telling getopt to treat -v's value as optional can result
- - in it picking up a following filename argument here. The
- - VMS code in md_parse_option can return 0 in that case,
- - but it has no way of pushing the filename argument back. */
- - if (optarg && *optarg)
- - new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
- - else
- + /* Telling getopt to treat -v's value as optional can result
- + in it picking up a following filename argument here. The
- + VMS code in md_parse_option can return 0 in that case,
- + but it has no way of pushing the filename argument back. */
- + if (optarg && *optarg)
- + new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
- + else
- #else
- - case 'v':
- + case 'v':
- #endif
- - case OPTION_VERBOSE:
- - print_version_id ();
- - break;
- - }
- - /*FALLTHRU*/
- -
- - case '?':
- - exit (EXIT_FAILURE);
- -
- - case 1: /* File name. */
- - if (!strcmp (optarg, "-"))
- - optarg = "";
- - new_argv[new_argc++] = optarg;
- - new_argv[new_argc] = NULL;
- - break;
- -
- - case OPTION_HELP:
- - show_usage (stdout);
- - exit (EXIT_SUCCESS);
- -
- - case OPTION_NOCPP:
- - break;
- -
- - case OPTION_STATISTICS:
- - flag_print_statistics = 1;
- - break;
- -
- - case OPTION_STRIP_LOCAL_ABSOLUTE:
- - flag_strip_local_absolute = 1;
- - break;
- -
- - case OPTION_TRADITIONAL_FORMAT:
- - flag_traditional_format = 1;
- - break;
- -
- - case OPTION_VERSION:
- - /* This output is intended to follow the GNU standards document. */
- - printf (_("GNU assembler %s\n"), VERSION);
- - printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
- - printf (_("\
- + case OPTION_VERBOSE:
- + print_version_id ();
- + break;
- + }
- + /*FALLTHRU*/
- +
- + case '?':
- + exit (EXIT_FAILURE);
- +
- + case 1: /* File name. */
- + if (!strcmp (optarg, "-"))
- + optarg = "";
- + new_argv[new_argc++] = optarg;
- + new_argv[new_argc] = NULL;
- +
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // save the source file name
- + if( cp_Current_File_Name == 0 ){
- + cp_Current_File_Name = xstrdup(optarg);
- + } else {
- + flag_plural_src = 1;
- + }
- +#endif
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + break;
- +
- +/* add tazaki 2001.11.02 Avdanced Option >>>>>> */
- + case OPTION_ADVANCE:
- + g_iAdvance = 1;
- + break;
- +
- +/* add tazaki 2001.11.02 Avdanced Option <<<<<< */
- +
- +/* add T.Tazaki 2003/11/18 PE Option >>>>>> */
- + case OPTION_PE:
- + g_iPE = 1;
- + break;
- +
- +/* add T.Tazaki 2003/11/18 PE Option <<<<<< */
- +/* add T.Tazaki 2004/07/30 -medda32 Option >>> */
- + case OPTION_MEDDA32:
- + g_iMedda32 = 1;
- + break;
- +
- +/* add T.Tazaki 2004/07/30 -medda32 Option <<< */
- +
- +// ADD D.Fujimoto check mc33_ext argument file 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + case OPTION_C33_EXT:
- + if( optarg != NULL ){
- + int i_len = strlen( optarg );
- + if( 0 != memcmp( ".dump",&(optarg[i_len-5]),5 ) ){
- + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
- + xexit (EXIT_FAILURE);
- + } else {
- + cp_Dump_File_Name = xstrdup(optarg);
- +// ADD D.Fujimoto 2008/01/07 >>>>>>>
- + check_all_dump_flg = 1;
- +// ADD D.Fujimoto 2008/01/07 <<<<<<<
- + }
- + } else {
- + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + break;
- +#endif
- +// ADD D.Fujimoto check mc33_ext argument file 2007/06/25 <<<<<<<
- +
- + case OPTION_HELP:
- + show_usage (stdout);
- + exit (EXIT_SUCCESS);
- +
- + case OPTION_NOCPP:
- + break;
- +
- + case OPTION_STATISTICS:
- + flag_print_statistics = 1;
- + break;
- +
- + case OPTION_STRIP_LOCAL_ABSOLUTE:
- + flag_strip_local_absolute = 1;
- + break;
- +
- + case OPTION_TRADITIONAL_FORMAT:
- + flag_traditional_format = 1;
- + break;
- +
- + case OPTION_VERSION:
- + /* This output is intended to follow the GNU standards document. */
- + printf (_("GNU assembler %s\n"), VERSION);
- + printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
- + printf (_("\
- This program is free software; you may redistribute it under the terms of\n\
- the GNU General Public License. This program has absolutely no warranty.\n"));
- - printf (_("This assembler was configured for a target of `%s'.\n"),
- - TARGET_ALIAS);
- - exit (EXIT_SUCCESS);
- + printf (_("This assembler was configured for a target of `%s'.\n"),
- + TARGET_ALIAS);
- + exit (EXIT_SUCCESS);
-
- - case OPTION_EMULATION:
- + case OPTION_EMULATION:
- #ifdef USE_EMULATIONS
- - if (strcmp (optarg, this_emulation->name))
- - as_fatal (_("multiple emulation names specified"));
- + if (strcmp (optarg, this_emulation->name))
- + as_fatal (_("multiple emulation names specified"));
- #else
- - as_fatal (_("emulations not handled in this configuration"));
- + as_fatal (_("emulations not handled in this configuration"));
- #endif
- - break;
- + break;
-
- - case OPTION_DUMPCONFIG:
- - fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
- - fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
- - fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
- + case OPTION_DUMPCONFIG:
- + fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
- + fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
- + fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
- #ifdef TARGET_OBJ_FORMAT
- - fprintf (stderr, _("format = %s\n"), TARGET_OBJ_FORMAT);
- + fprintf (stderr, _("format = %s\n"), TARGET_OBJ_FORMAT);
- #endif
- #ifdef TARGET_FORMAT
- - fprintf (stderr, _("bfd-target = %s\n"), TARGET_FORMAT);
- + fprintf (stderr, _("bfd-target = %s\n"), TARGET_FORMAT);
- #endif
- - exit (EXIT_SUCCESS);
- -
- - case OPTION_DEFSYM:
- - {
- - char *s;
- - long i;
- - struct defsym_list *n;
- -
- - for (s = optarg; *s != '\0' && *s != '='; s++)
- - ;
- - if (*s == '\0')
- - as_fatal (_("bad defsym; format is --defsym name=value"));
- - *s++ = '\0';
- - i = strtol (s, (char **) NULL, 0);
- - n = (struct defsym_list *) xmalloc (sizeof *n);
- - n->next = defsyms;
- - n->name = optarg;
- - n->value = i;
- - defsyms = n;
- - }
- - break;
- -
- - case OPTION_INSTTBL:
- - case 't':
- - {
- - /* optarg is the name of the file containing the instruction
- - formats, opcodes, register names, etc. */
- - struct itbl_file_list *n;
- -
- - if (optarg == NULL)
- - {
- - as_warn ( _("No file name following -t option\n") );
- - break;
- - }
- -
- - n = (struct itbl_file_list *) xmalloc (sizeof *n);
- - n->next = itbl_files;
- - n->name = optarg;
- - itbl_files = n;
- -
- - /* Parse the file and add the new instructions to our internal
- - table. If multiple instruction tables are specified, the
- - information from this table gets appended onto the existing
- - internal table. */
- - itbl_files->name = xstrdup (optarg);
- - if (itbl_parse (itbl_files->name) != 0)
- - {
- - fprintf (stderr, _("Failed to read instruction table %s\n"),
- - itbl_files->name);
- - exit (EXIT_SUCCESS);
- - }
- - }
- - break;
- + exit (EXIT_SUCCESS);
- +
- + case OPTION_DEFSYM:
- + {
- + char *s;
- + long i;
- + struct defsym_list *n;
- +
- + for (s = optarg; *s != '\0' && *s != '='; s++)
- + ;
- + if (*s == '\0')
- + as_fatal (_("bad defsym; format is --defsym name=value"));
- + *s++ = '\0';
- + i = strtol (s, (char **) NULL, 0);
- + n = (struct defsym_list *) xmalloc (sizeof *n);
- + n->next = defsyms;
- + n->name = optarg;
- + n->value = i;
- + defsyms = n;
- + }
- + break;
-
- - case OPTION_DEPFILE:
- - start_dependencies (optarg);
- - break;
- + case OPTION_INSTTBL:
- + case 't':
- + {
- + /* optarg is the name of the file containing the instruction
- + formats, opcodes, register names, etc. */
- + struct itbl_file_list *n;
- +
- + if (optarg == NULL)
- + {
- + as_warn ( _("No file name following -t option\n") );
- + break;
- + }
- +
- + n = (struct itbl_file_list *) xmalloc (sizeof *n);
- + n->next = itbl_files;
- + n->name = optarg;
- + itbl_files = n;
- +
- + /* Parse the file and add the new instructions to our internal
- + table. If multiple instruction tables are specified, the
- + information from this table gets appended onto the existing
- + internal table. */
- + itbl_files->name = xstrdup (optarg);
- + if (itbl_parse (itbl_files->name) != 0)
- + {
- + fprintf (stderr, _("Failed to read instruction table %s\n"),
- + itbl_files->name);
- + exit (EXIT_SUCCESS);
- + }
- + }
- + break;
-
- - case OPTION_GSTABS:
- - debug_type = DEBUG_STABS;
- - break;
- + case OPTION_DEPFILE:
- + start_dependencies (optarg);
- + break;
- +
- + case OPTION_GSTABS:
- + debug_type = DEBUG_STABS;
- + break;
-
- - case OPTION_GDWARF2:
- - debug_type = DEBUG_DWARF2;
- - break;
- + case OPTION_GDWARF2:
- + debug_type = DEBUG_DWARF2;
- + break;
-
- - case 'J':
- - flag_signed_overflow_ok = 1;
- - break;
- + case 'J':
- + flag_signed_overflow_ok = 1;
- + break;
-
- #ifndef WORKING_DOT_WORD
- - case 'K':
- - flag_warn_displacement = 1;
- - break;
- + case 'K':
- + flag_warn_displacement = 1;
- + break;
- #endif
-
- - case 'L':
- - flag_keep_locals = 1;
- - break;
- -
- - case OPTION_LISTING_LHS_WIDTH:
- - listing_lhs_width = atoi(optarg);
- - if (listing_lhs_width_second < listing_lhs_width)
- - listing_lhs_width_second = listing_lhs_width;
- - break;
- - case OPTION_LISTING_LHS_WIDTH2:
- - {
- - int tmp = atoi(optarg);
- - if (tmp > listing_lhs_width)
- - listing_lhs_width_second = tmp;
- - }
- - break;
- - case OPTION_LISTING_RHS_WIDTH:
- - listing_rhs_width = atoi(optarg);
- - break;
- - case OPTION_LISTING_CONT_LINES:
- - listing_lhs_cont_lines = atoi(optarg);
- - break;
- -
- - case 'M':
- - flag_mri = 1;
- + case 'L':
- + flag_keep_locals = 1;
- + break;
- +
- + case OPTION_LISTING_LHS_WIDTH:
- + listing_lhs_width = atoi(optarg);
- + if (listing_lhs_width_second < listing_lhs_width)
- + listing_lhs_width_second = listing_lhs_width;
- + break;
- + case OPTION_LISTING_LHS_WIDTH2:
- + {
- + int tmp = atoi(optarg);
- + if (tmp > listing_lhs_width)
- + listing_lhs_width_second = tmp;
- + }
- + break;
- + case OPTION_LISTING_RHS_WIDTH:
- + listing_rhs_width = atoi(optarg);
- + break;
- + case OPTION_LISTING_CONT_LINES:
- + listing_lhs_cont_lines = atoi(optarg);
- + break;
- +
- + case 'M':
- + flag_mri = 1;
- #ifdef TC_M68K
- - flag_m68k_mri = 1;
- + flag_m68k_mri = 1;
- #endif
- - break;
- -
- - case 'R':
- - flag_readonly_data_in_text = 1;
- - break;
- -
- - case 'W':
- - flag_no_warnings = 1;
- - break;
- -
- - case OPTION_WARN:
- - flag_no_warnings = 0;
- - flag_fatal_warnings = 0;
- - break;
- -
- - case OPTION_WARN_FATAL:
- - flag_no_warnings = 0;
- - flag_fatal_warnings = 1;
- - break;
- -
- - case 'Z':
- - flag_always_generate_output = 1;
- - break;
- -
- - case 'a':
- - if (optarg)
- - {
- - while (*optarg)
- - {
- - switch (*optarg)
- - {
- - case 'c':
- - listing |= LISTING_NOCOND;
- - break;
- - case 'd':
- - listing |= LISTING_NODEBUG;
- - break;
- - case 'h':
- - listing |= LISTING_HLL;
- - break;
- - case 'l':
- - listing |= LISTING_LISTING;
- - break;
- - case 'm':
- - listing |= LISTING_MACEXP;
- - break;
- - case 'n':
- - listing |= LISTING_NOFORM;
- - break;
- - case 's':
- - listing |= LISTING_SYMBOLS;
- - break;
- - case '=':
- - listing_filename = xstrdup (optarg + 1);
- - optarg += strlen (listing_filename);
- - break;
- - default:
- - as_fatal (_("invalid listing option `%c'"), *optarg);
- - break;
- - }
- - optarg++;
- - }
- - }
- - if (!listing)
- - listing = LISTING_DEFAULT;
- - break;
- -
- - case 'D':
- - /* DEBUG is implemented: it debugs different */
- - /* things from other people's assemblers. */
- - flag_debug = 1;
- - break;
- -
- - case 'f':
- - flag_no_comments = 1;
- - break;
- -
- - case 'I':
- - { /* Include file directory */
- - char *temp = xstrdup (optarg);
- - add_include_dir (temp);
- - break;
- - }
- + break;
- +
- + case 'R':
- + flag_readonly_data_in_text = 1;
- + break;
-
- - case 'o':
- - out_file_name = xstrdup (optarg);
- - break;
- + case 'W':
- + flag_no_warnings = 1;
- + break;
-
- - case 'w':
- - break;
- + case OPTION_WARN:
- + flag_no_warnings = 0;
- + flag_fatal_warnings = 0;
- + break;
-
- - case 'X':
- - /* -X means treat warnings as errors */
- - break;
- - }
- + case OPTION_WARN_FATAL:
- + flag_no_warnings = 0;
- + flag_fatal_warnings = 1;
- + break;
- +
- + case 'Z':
- + flag_always_generate_output = 1;
- + break;
- +
- + case 'a':
- + if (optarg)
- + {
- + while (*optarg)
- + {
- + switch (*optarg)
- + {
- + case 'c':
- + listing |= LISTING_NOCOND;
- + break;
- + case 'd':
- + listing |= LISTING_NODEBUG;
- + break;
- + case 'h':
- + listing |= LISTING_HLL;
- + break;
- + case 'l':
- + listing |= LISTING_LISTING;
- + break;
- + case 'm':
- + listing |= LISTING_MACEXP;
- + break;
- + case 'n':
- + listing |= LISTING_NOFORM;
- + break;
- + case 's':
- + listing |= LISTING_SYMBOLS;
- + break;
- + case '=':
- + listing_filename = xstrdup (optarg + 1);
- + optarg += strlen (listing_filename);
- + break;
- + default:
- + as_fatal (_("invalid listing option `%c'"), *optarg);
- + break;
- + }
- + optarg++;
- + }
- + }
- + if (!listing)
- + listing = LISTING_DEFAULT;
- +
- + g_listing = 1; /* -a option exist: @rm,@rl Warning */
- + /* add T.Tazaki 2002.04.26 */
- + break;
- +
- + case 'D':
- + /* DEBUG is implemented: it debugs different */
- + /* things from other people's assemblers. */
- + flag_debug = 1;
- + break;
- +
- + case 'f':
- + flag_no_comments = 1;
- + break;
- +
- + case 'I':
- + { /* Include file directory */
- + char *temp = xstrdup (optarg);
- + add_include_dir (temp);
- + break;
- + }
- +
- + case 'o':
- + out_file_name = xstrdup (optarg);
- + break;
- +
- + case 'w':
- + break;
- +
- + case 'X':
- + /* -X means treat warnings as errors */
- + break;
- + }
- }
-
- free (shortopts);
- @@ -747,6 +911,48 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
-
- *pargc = new_argc;
- *pargv = new_argv;
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // process of -mc33ext option
- + if( flag_plural_src == 1 ){
- + fprintf (stderr, _("Error : Cannot specify plurality source files.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + if( cp_Current_File_Name != NULL ){
- + if( strlen(cp_Current_File_Name) > 0 ){
- + chk_is_file_inf( cp_Current_File_Name ); // check whether ".file" exists
- + }
- + }
- +
- + if( ( cp_Current_File_Name != NULL )
- + && ( cp_Dump_File_Name != NULL ) && ( out_file_name != NULL ) ){
- + if( strlen(cp_Current_File_Name) > 0 ){
- + xatexit( free_ext_heap_area ); // register "free_ext_heap_area()" into "xexit()"
- + read_cur_file_info( cp_Current_File_Name );
- + read_dump_info( cp_Dump_File_Name,out_file_name );
- +
- +// ADD D.Fujimoto 2008/01/07 >>>>>>>
- + // read all object dump file
- + read_all_dump_info(cp_All_Dump_File_Name, out_file_name);
- +
- + // count duplicate symbols using the all object dump file
- + countDuplicateSymbols(stpp_All_Dump_Inf, ul_All_Dump_Symbol_Cnt);
- +// ADD D.Fujimoto 2008/01/07 <<<<<<<
- +
- + // get data pointer address
- + if (!g_iMedda32) {
- + g_dpAddress = getDataPointerAddress(DATA_POINTER_SYMBOL);
- + }
- +
- + g_c33_ext = 1;
- + }
- + }
- +#endif
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- +
- }
-
- static long start_time;
- @@ -759,6 +965,10 @@ main (argc, argv)
- int macro_alternate;
- int macro_strip_at;
- int keep_it;
- +
- + /* add T.Tazaki 2003/05/14 >>> */
- + FILE *fpOut;
- + /* add T.Tazaki 2003/05/14 <<< */
-
- start_time = get_run_time ();
-
- @@ -850,7 +1060,7 @@ main (argc, argv)
- struct defsym_list *next;
-
- sym = symbol_new (defsyms->name, absolute_section, defsyms->value,
- - &zero_address_frag);
- + &zero_address_frag);
- symbol_table_insert (sym);
- next = defsyms->next;
- free (defsyms);
- @@ -859,7 +1069,7 @@ main (argc, argv)
-
- PROGRESS (1);
-
- - perform_an_assembly_pass (argc, argv); /* Assemble it. */
- + perform_an_assembly_pass (argc, argv); /* Assemble it. */
-
- cond_finish_check (-1);
-
- @@ -893,6 +1103,35 @@ main (argc, argv)
- if (keep_it)
- #endif
- output_file_close (out_file_name);
- +
- +/* add T.Tazaki 2003/05/14 >>> */
- + fpOut = fopen( out_file_name,"r+b" );
- + if( fpOut != NULL )
- + {
- + /* e_machine number set */
- +// fseek( fpOut, 18, SEEK_SET );
- +// fputc( EM_SE_C33, fpOut );
- +
- + /* ELF header : e_flags bit31-28=CPU flag set */
- + /* flag = 0x0 : Standard macro */
- + /* flag = 'A' : Advanced macro */
- + /* flag = 'P' : PE macro */
- +
- + /* Advanced macro mode ? */
- + if( g_iAdvance == 1 )
- + {
- + fseek( fpOut, 39, SEEK_SET );
- + fputc( 'A', fpOut );
- + }
- + else if ( g_iPE == 1 ) /* add T.Tazaki 2003/11/18 */
- + {
- + fseek( fpOut, 39, SEEK_SET );
- + fputc( 'P', fpOut );
- + }
- + fclose( fpOut );
- + }
- +/* add T.Tazaki 2003/05/14 <<< */
- +
- #endif
-
- if (flag_fatal_warnings && had_warnings() > 0 && had_errors () == 0)
- @@ -928,10 +1167,10 @@ dump_statistics ()
- long run_time = get_run_time () - start_time;
-
- fprintf (stderr, _("%s: total time in assembly: %ld.%06ld\n"),
- - myname, run_time / 1000000, run_time % 1000000);
- + myname, run_time / 1000000, run_time % 1000000);
- #ifdef HAVE_SBRK
- fprintf (stderr, _("%s: data size %ld\n"),
- - myname, (long) (lim - (char *) &environ));
- + myname, (long) (lim - (char *) &environ));
- #endif
-
- subsegs_print_statistics (stderr);
- @@ -948,7 +1187,7 @@ dump_statistics ()
- }
-
-
- -/* perform_an_assembly_pass()
- +/* perform_an_assembly_pass()
- *
- * Here to attempt 1 pass over each input file.
- * We scan argv[*] looking for filenames or exactly "" which is
- @@ -1012,11 +1251,11 @@ perform_an_assembly_pass (argc, argv)
- to have relocs, otherwise we don't find out in time. */
- applicable = bfd_applicable_section_flags (stdoutput);
- bfd_set_section_flags (stdoutput, text_section,
- - applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- - | SEC_CODE | SEC_READONLY));
- + applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- + | SEC_CODE | SEC_READONLY));
- bfd_set_section_flags (stdoutput, data_section,
- - applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- - | SEC_DATA));
- + applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
- + | SEC_DATA));
- bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
- seg_info (bss_section)->bss = 1;
- subseg_new (BFD_ABS_SECTION_NAME, 0);
- @@ -1036,22 +1275,22 @@ perform_an_assembly_pass (argc, argv)
- obj_begin ();
- #endif
-
- - argv++; /* skip argv[0] */
- - argc--; /* skip argv[0] */
- + argv++; /* skip argv[0] */
- + argc--; /* skip argv[0] */
- while (argc--)
- {
- if (*argv)
- - { /* Is it a file-name argument? */
- - PROGRESS (1);
- - saw_a_file++;
- - /* argv->"" if stdin desired, else->filename */
- - read_a_source_file (*argv);
- - }
- - argv++; /* completed that argv */
- + { /* Is it a file-name argument? */
- + PROGRESS (1);
- + saw_a_file++;
- + /* argv->"" if stdin desired, else->filename */
- + read_a_source_file (*argv);
- + }
- + argv++; /* completed that argv */
- }
- if (!saw_a_file)
- read_a_source_file ("");
- -} /* perform_an_assembly_pass() */
- +} /* perform_an_assembly_pass() */
-
- /* The interface between the macro code and gas expression handling. */
-
- diff --git a/gas/config/gas/config/tc-c33.c b/gas/config/gas/config/tc-c33.c
- new file mode 100644
- index 0000000..f247b49
- --- /dev/null
- +++ b/gas/config/gas/config/tc-c33.c
- @@ -0,0 +1,4382 @@
- +/* tc-c33.c -- Assembler code for the EPSON EOC33
- + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
- +
- + This file is part of GAS, the GNU Assembler.
- +
- + GAS is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2, or (at your option)
- + any later version.
- +
- + GAS is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with GAS; see the file COPYING. If not, write to
- + the Free Software Foundation, 59 Temple Place - Suite 330,
- + Boston, MA 02111-1307, USA. */
- +
- +#include <stdio.h>
- +#include <ctype.h>
- +#include "as.h"
- +#include "subsegs.h"
- +#include "opcode/c33.h"
- +
- +#define AREA_CDA 0
- +#define AREA_GDA 1
- +#define AREA_ZDA 2
- +#define AREA_SDA 3
- +#define AREA_TDA 4
- +#define AREA_LCDA 5
- +#define AREA_LGDA 6
- +#define AREA_LZDA 7
- +#define AREA_LSDA 8
- +#define AREA_LTDA 9
- +
- +
- +#define O_spregister O_md1 /* for c33 %sp */
- +#define O_dpregister O_md2 /* for c33 %dp */
- +#define O_cond O_md3 /* for c33 ext cond */
- +#define O_op_shift O_md4 /* for c33 ext OP */
- +
- +#define SGP_REG 12 /* GP register */
- +#define TGP_REG 13 /* GP register */
- +#define ZGP_REG 14 /* GP register */
- +#define GP_REG 15 /* GP register */
- +
- +/* Temporarily holds the reloc in a cons expression. */
- +static bfd_reloc_code_real_type hold_cons_reloc;
- +
- +
- +
- +/* Structure to hold information about predefined registers. */
- +struct reg_name
- +{
- + const char * name;
- + int value;
- +};
- +
- +/* Generic assembler global variables which must be defined by all targets. */
- +
- +/* Characters which always start a comment. */
- +const char comment_chars[] = ";";
- +
- +/* Characters which start a comment at the beginning of a line. */
- +const char line_comment_chars[] = "";
- +
- +/* Characters which may be used to separate multiple commands on a
- + single line. */
- +const char line_separator_chars[] = "";
- +
- +/* Characters which are used to indicate an exponent in a floating
- + point number. */
- +const char EXP_CHARS[] = "eE";
- +
- +/* Characters which mean that a number is a floating point constant,
- + as in 0d1.0. */
- +const char FLT_CHARS[] = "dD";
- +
- +
- +const relax_typeS md_relax_table[] =
- +{
- + /* Conditional branches. */
- + {0xff, -0x100, 2, 1},
- + {0x1fffff, -0x200000, 6, 0},
- + /* Unconditional branches. */
- + {0xff, -0x100, 2, 3},
- + {0x1fffff, -0x200000, 4, 0},
- +};
- +
- +/* add tazaki 2001.12.03 */
- +static segT comm_section = NULL;
- +static segT gcomm_section = NULL;
- +static segT scomm_section = NULL;
- +static segT tcomm_section = NULL;
- +static segT zcomm_section = NULL;
- +static segT gbss_section = NULL;
- +static segT sbss_section = NULL;
- +static segT tbss_section = NULL;
- +static segT zbss_section = NULL;
- +/* add tazaki 2001.12.03 */
- +
- +/* add T.Tazaki 2002.04.26 >>> */
- +extern int g_listing;
- +/* add T.Tazaki 2002.04.26 <<< */
- +
- +/* fixups */
- +#define MAX_INSN_FIXUPS (5)
- +struct c33_fixup
- +{
- + expressionS exp;
- + int opindex;
- + bfd_reloc_code_real_type reloc;
- +};
- +
- +struct c33_fixup fixups [MAX_INSN_FIXUPS];
- +static int fc;
- +
- +
- +
- +/******************************************************************************
- + INPUT int area of symbol
- + RETURN void
- + Explanation assembler false instruction(.gcomm/.scomm/.tcomm/.zcomm) Evaluation
- +******************************************************************************/
- +/* Copied from obj_elf_common() in gas/config/obj-elf.c */
- +static void
- +c33_comm (area)
- + int area;
- +{
- + char * name;
- + char c;
- + char * p;
- + int temp;
- + int size;
- + symbolS * symbolP;
- + int have_align;
- + char * pfrag;
- +
- + name = input_line_pointer;
- + c = get_symbol_end ();
- +
- + /* just after name is now '\0' */
- + p = input_line_pointer;
- + *p = c;
- +
- + /* skip space */
- + SKIP_WHITESPACE ();
- +
- + /* Is the character after ".comm" a pause character? */
- + if (*input_line_pointer != ',')
- + {
- + as_bad (_("Expected comma after symbol-name"));
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + input_line_pointer ++; /* skip ',' */
- +
- + if ((temp = get_absolute_expression ()) < 0)
- + {
- + /* xgettext:c-format */
- + as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp);
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + size = temp;
- + *p = 0;
- + symbolP = symbol_find_or_make (name);
- + *p = c;
- +
- +/* if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) */
- + if (S_IS_DEFINED (symbolP) )
- + {
- + as_bad (_("Ignoring attempt to re-define symbol"));
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + if (S_GET_VALUE (symbolP) != 0)
- + {
- + if (S_GET_VALUE (symbolP) != size)
- + {
- + /* xgettext:c-format */
- + as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
- + S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
- + }
- + }
- +
- + know (symbol_get_frag (symbolP) == & zero_address_frag);
- +
- + if (*input_line_pointer != ',')
- + have_align = 0;
- + else
- + {
- + have_align = 1;
- + input_line_pointer++;
- + SKIP_WHITESPACE ();
- + }
- +
- + if (! have_align || *input_line_pointer != '"')
- + {
- + if (! have_align)
- + temp = 0;
- + else
- + {
- + temp = get_absolute_expression ();
- +
- + if (temp < 0)
- + {
- + temp = 0;
- + as_warn (_("Common alignment negative; 0 assumed"));
- + }
- + }
- +
- +
- +/* if (symbol_get_obj (symbolP)->local)*/
- + if (!(area == AREA_CDA || area == AREA_GDA || area == AREA_SDA || area == AREA_TDA || area == AREA_ZDA ))
- + {
- + /* NOT EXIST ROUTINE */
- +
- + segT old_sec;
- + int old_subsec;
- + int align;
- + flagword applicable;
- +
- + old_sec = now_seg;
- + old_subsec = now_subseg;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + applicable &= SEC_ALLOC;
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (comm_section == NULL)
- + {
- +
- + comm_section = subseg_new (".comm", 0);
- +
- + bfd_set_section_flags (stdoutput, comm_section, applicable);
- +
- + seg_info (comm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_GDA:
- + if (gcomm_section == NULL)
- + {
- + gcomm_section = subseg_new (".gcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, gcomm_section, applicable);
- +
- + seg_info (gcomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_SDA:
- + if (scomm_section == NULL)
- + {
- + scomm_section = subseg_new (".scomm", 0);
- +
- + bfd_set_section_flags (stdoutput, scomm_section, applicable);
- +
- + seg_info (scomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_TDA:
- + if (tcomm_section == NULL)
- + {
- + tcomm_section = subseg_new (".tcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, tcomm_section, applicable);
- +
- + seg_info (tcomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_ZDA:
- + if (zcomm_section == NULL)
- + {
- + zcomm_section = subseg_new (".zcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, zcomm_section, applicable);
- +
- + seg_info (zcomm_section)->bss = 1;
- + }
- + break;
- +
- + }
- +
- + if (temp)
- + {
- + /* convert to a power of 2 alignment */
- + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
- + ;
- +
- + if (temp != 1)
- + {
- + as_bad (_("Common alignment not a power of 2"));
- + ignore_rest_of_line ();
- + return;
- + }
- + }
- + else
- + align = 0;
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + record_alignment (comm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (comm_section, 0);
- + break;
- +
- + case AREA_GDA:
- + record_alignment (gcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (gcomm_section, 0);
- + break;
- +
- + case AREA_SDA:
- + record_alignment (scomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (scomm_section, 0);
- + break;
- +
- + case AREA_TDA:
- + record_alignment (tcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (tcomm_section, 0);
- + break;
- +
- + case AREA_ZDA:
- + record_alignment (zcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (zcomm_section, 0);
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (S_GET_SEGMENT (symbolP) == comm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_GDA:
- + if (S_GET_SEGMENT (symbolP) == gcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_SDA:
- + if (S_GET_SEGMENT (symbolP) == scomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_TDA:
- + if (S_GET_SEGMENT (symbolP) == tcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_ZDA:
- + if (S_GET_SEGMENT (symbolP) == zcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + default:
- + abort ();
- + }
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + S_SET_SEGMENT (symbolP, comm_section);
- + break;
- +
- + case AREA_GDA:
- + S_SET_SEGMENT (symbolP, gcomm_section);
- + break;
- +
- + case AREA_SDA:
- + S_SET_SEGMENT (symbolP, scomm_section);
- + break;
- +
- + case AREA_TDA:
- + S_SET_SEGMENT (symbolP, tcomm_section);
- + break;
- +
- + case AREA_ZDA:
- + S_SET_SEGMENT (symbolP, zcomm_section);
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (symbol_get_obj (symbolP)->local)
- + S_CLEAR_EXTERNAL (symbolP);
- + else
- + S_SET_EXTERNAL (symbolP);
- +
- + obj_elf_section_change_hook();
- + subseg_set (old_sec, old_subsec);
- + }
- + else
- + {
- + /*==========================================================================*/
- + /* Evaluation of .comm */
- + /*==========================================================================*/
- + segT old_sec;
- + int old_subsec;
- + int align;
- + int i_now_align; /* add 2002.01.21 */
- + i_now_align = temp; /* add 2002.01.21 */
- +
- + /* computing of alignment */
- + if (temp)
- + {
- + /* convert to a power of 2 alignment */
- + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
- + ;
- +
- + if (temp != 1)
- + {
- + as_bad (_("Common alignment not a power of 2"));
- + ignore_rest_of_line ();
- + return;
- + }
- + }
- + else
- + align = 0;
- +
- + old_sec = now_seg;
- + old_subsec = now_subseg;
- +
- + allocate_common:
- +
- + /* Convert .local + .xcomm to local section. */
- +
- + if (symbol_get_obj (symbolP)->local){
- + switch (area)
- + {
- + case AREA_CDA:
- + area = AREA_LCDA;
- + break;
- + case AREA_GDA:
- + area = AREA_LGDA;
- + break;
- + case AREA_SDA:
- + area = AREA_LSDA;
- + break;
- + case AREA_TDA:
- + area = AREA_LTDA;
- + break;
- + case AREA_ZDA:
- + area = AREA_LZDA;
- + break;
- + }
- + }
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (comm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + comm_section = subseg_new (".comm", 0);
- +
- + bfd_set_section_flags (stdoutput, comm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, comm_section);
- + record_alignment (comm_section, align);
- +
- + break;
- +
- + case AREA_GDA:
- + if (gcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + gcomm_section = subseg_new (".gcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, gcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, gcomm_section);
- + record_alignment (gcomm_section, align);
- + break;
- +
- + case AREA_SDA:
- + if (scomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + scomm_section = subseg_new (".scomm", 0);
- +
- + bfd_set_section_flags (stdoutput, scomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, scomm_section);
- + record_alignment (scomm_section, align);
- + break;
- +
- + case AREA_TDA:
- + if (tcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + tcomm_section = subseg_new (".tcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, tcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, tcomm_section);
- + record_alignment (tcomm_section, align);
- + break;
- +
- + case AREA_ZDA:
- + if (zcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + zcomm_section = subseg_new (".zcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, zcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, zcomm_section);
- + record_alignment (zcomm_section, align);
- + break;
- +
- +
- + case AREA_LCDA:
- + /* Convert local comm to .bss section. */
- + obj_elf_section_change_hook();
- + subseg_set (bss_section, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == bss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- +
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, bss_section);
- + record_alignment (bss_section, align);
- +
- + break;
- +
- + case AREA_LGDA:
- + if (gbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + gbss_section = subseg_new (".gbss", 0);
- +
- + bfd_set_section_flags (stdoutput, gbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (gbss_section)->bss = 1;
- + }
- +
- + record_alignment (gbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (gbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == gbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, gbss_section);
- +
- + break;
- +
- + case AREA_LSDA:
- + if (sbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + sbss_section = subseg_new (".sbss", 0);
- +
- + bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (sbss_section)->bss = 1;
- + }
- +
- + record_alignment (sbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (sbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == sbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, sbss_section);
- +
- + break;
- +
- + case AREA_LTDA:
- + if (tbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + tbss_section = subseg_new (".tbss", 0);
- +
- + bfd_set_section_flags (stdoutput, tbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (tbss_section)->bss = 1;
- + }
- +
- + record_alignment (tbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (tbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == tbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, tbss_section);
- +
- + break;
- +
- + case AREA_LZDA:
- + if (zbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + zbss_section = subseg_new (".zbss", 0);
- +
- + bfd_set_section_flags (stdoutput, zbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (zbss_section)->bss = 1;
- + }
- +
- + record_alignment (zbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (zbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == zbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, zbss_section);
- +
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (area == AREA_LCDA || area == AREA_LGDA || area == AREA_LSDA || area == AREA_LTDA || area == AREA_LZDA) /* ローカル? */
- + {
- + S_CLEAR_EXTERNAL (symbolP);
- + }else{
- + S_SET_VALUE (symbolP, (valueT) size);
- +// S_SET_ALIGN (symbolP, temp);
- + if( i_now_align )
- + S_SET_ALIGN (symbolP, i_now_align);
- + S_SET_EXTERNAL (symbolP);
- + }
- +
- + obj_elf_section_change_hook();
- + subseg_set (old_sec, old_subsec);
- +
- + }
- +}
- + else
- + {
- + input_line_pointer++;
- + /* @@ Some use the dot, some don't. Can we get some consistency?? */
- + if (*input_line_pointer == '.')
- + input_line_pointer++;
- + /* @@ Some say data, some say bss. */
- + if (strncmp (input_line_pointer, "bss\"", 4)
- + && strncmp (input_line_pointer, "data\"", 5))
- + {
- + while (*--input_line_pointer != '"')
- + ;
- + input_line_pointer--;
- + goto bad_common_segment;
- + }
- + while (*input_line_pointer++ != '"')
- + ;
- + goto allocate_common;
- + }
- +
- + symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
- +
- + demand_empty_rest_of_line ();
- + return;
- +
- + {
- + bad_common_segment:
- + p = input_line_pointer;
- + while (*p && *p != '\n')
- + p++;
- + c = *p;
- + *p = '\0';
- + as_bad (_("bad .common segment %s"), input_line_pointer + 1);
- + *p = c;
- + input_line_pointer = p;
- + ignore_rest_of_line ();
- + return;
- + }
- +}
- +
- +/* The target specific pseudo-ops which we support. */
- +const pseudo_typeS md_pseudo_table[] =
- +{
- + {"comm", c33_comm, AREA_CDA},
- + {"gcomm", c33_comm, AREA_GDA},
- + {"scomm", c33_comm, AREA_SDA},
- + {"tcomm", c33_comm, AREA_TDA},
- + {"zcomm", c33_comm, AREA_ZDA},
- + { NULL, NULL, 0}
- +};
- +
- +/*****************************************************************************/
- +
- +
- +
- +/* Opcode hash table. */
- +static struct hash_control *c33_hash;
- +
- +/* This table is sorted. Suitable for searching by a binary search. */
- +static const struct reg_name pre_defined_registers[] =
- +{
- + { "%r0", 0 },
- + { "%r1", 1 },
- + { "%r10", 10 },
- + { "%r11", 11 },
- + { "%r12", 12 },
- + { "%r13", 13 },
- + { "%r14", 14 },
- + { "%r15", 15 },
- + { "%r2", 2 },
- + { "%r3", 3 },
- + { "%r4", 4 },
- + { "%r5", 5 },
- + { "%r6", 6 },
- + { "%r7", 7 },
- + { "%r8", 8 },
- + { "%r9", 9 },
- +};
- +#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct reg_name))
- +
- +/* standard macro spesial registers */
- +static const struct reg_name system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%psr", 0 },
- + { "%sp", 1 },
- +};
- +
- +/* advanced macro spesial registers */
- +static const struct reg_name adv_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%pc", 15},
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* ld.w %sd,%rs special registers */
- +static const struct reg_name adv_load_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* pushs , pops special registers */
- +static const struct reg_name adv_pushs_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%pc", 15 },
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* PE add T.Tazaki 2003/11/18 >>> */
- +
- +/* PE macro spesial registers */
- +static const struct reg_name pe_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 },
- + { "%idir", 10 },
- + { "%pc", 15},
- + { "%psr", 0 },
- + { "%sp", 1 },
- + { "%ttbr", 8 },
- +};
- +
- +/* ld.w %sd,%rs special registers */
- +static const struct reg_name pe_load_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%psr", 0 },
- + { "%sp", 1 },
- + { "%ttbr", 8 },
- +};
- +
- +/* pushs , pops special registers */
- +static const struct reg_name pe_pushs_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- +};
- +
- +/* PE add T.Tazaki 2003/11/18 <<< */
- +
- +#define SYSREG_NAME_CNT (sizeof (system_registers) / sizeof (struct reg_name))
- +#define ADV_SYSREG_NAME_CNT (sizeof (adv_system_registers) / sizeof (struct reg_name))
- +#define ADV_LOAD_SYSREG_NAME_CNT (sizeof (adv_load_system_registers) / sizeof (struct reg_name))
- +#define ADV_PUSHS_SYSREG_NAME_CNT (sizeof (adv_pushs_system_registers) / sizeof (struct reg_name))
- +
- +/* PE add T.Tazaki 2003/11/18 >>> */
- +#define PE_SYSREG_NAME_CNT (sizeof (pe_system_registers) / sizeof (struct reg_name))
- +#define PE_LOAD_SYSREG_NAME_CNT (sizeof (pe_load_system_registers) / sizeof (struct reg_name))
- +#define PE_PUSHS_SYSREG_NAME_CNT (sizeof (pe_pushs_system_registers) / sizeof (struct reg_name))
- +/* PE add T.Tazaki 2003/11/18 <<< */
- +
- +/******************************************************************************
- + INPUT const struct reg_name * register name
- + int register string size
- + const char * check register string
- + boolean not used
- + RETURN int register number
- + Explanation Get register number
- +******************************************************************************/
- +/* reg_name_search does a binary search of the given register table
- + to see if "name" is a valid regiter name. Returns the register
- + number from the array on success, or -1 on failure. */
- +
- +static int
- +reg_name_search (regs, regcount, name, accept_numbers)
- + const struct reg_name * regs;
- + int regcount;
- + const char * name;
- + boolean accept_numbers;
- +{
- + int middle, low, high;
- + int cmp;
- + symbolS * symbolP;
- +#if 0
- + /* If the register name is a symbol, then evaluate it. */
- + if ((symbolP = symbol_find (name)) != NULL)
- + {
- + /* If the symbol is an alias for another name then use that.
- + If the symbol is an alias for a number, then return the number. */
- + if (symbol_equated_p (symbolP))
- + {
- + name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
- + }
- + else if (accept_numbers)
- + {
- + int reg = S_GET_VALUE (symbolP);
- +
- + if (reg >= 0 && reg <= 31)
- + return reg;
- + }
- +#endif
- +
- + low = 0;
- + high = regcount - 1;
- +
- + do
- + {
- + middle = (low + high) / 2;
- + cmp = strcasecmp (name, regs[middle].name);
- + if (cmp < 0)
- + high = middle - 1;
- + else if (cmp > 0)
- + low = middle + 1;
- + else
- + return regs[middle].value;
- + }
- + while (low <= high);
- +
- + return -1;
- +}
- +
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A register operand is changed into a command code.
- +******************************************************************************/
- +/* Summary of register_name().
- + *
- + * in: Input_line_pointer points to 1st char of operand.
- + *
- + * out: A expressionS.
- + * The operand may have been a register: in this case, X_op == O_register,
- + * X_add_number is set to the register number, and truth is returned.
- + * Input_line_pointer->(next non-blank) char after operand, or is in
- + * its original state.
- + */
- +static boolean
- +register_name (expressionP)
- + expressionS * expressionP;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- + char *pNameEnd;
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* Get register number */
- + reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
- + name, FALSE);
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + /* YES The right register number was acquirable. */
- +
- + /* That it is a register and a register number are saved. */
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* 不正 */
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- +******************************************************************************/
- +/* Summary of system_register_name().
- + *
- + * in: Input_line_pointer points to 1st char of operand.
- + * expressionP points to an expression structure to be filled in.
- + * accept_numbers is true iff numerical register names may be used.
- + * accept_list_names is true iff the special names PS and SR may be
- + * accepted.
- + *
- + * out: A expressionS structure in expressionP.
- + * The operand may have been a register: in this case, X_op == O_register,
- + * X_add_number is set to the register number, and truth is returned.
- + * Input_line_pointer->(next non-blank) char after operand, or is in
- + * its original state.
- + */
- +static boolean
- +system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE */ /* add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_system_registers, PE_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* add tazaki 2001.11.12 */
- + /* ADV */
- + reg_number = reg_name_search (adv_system_registers, ADV_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- +#if 0
- + if (reg_number < 0 && accept_numbers)
- + {
- + input_line_pointer = start; /* reset input_line pointer */
- +
- + if (isdigit (* input_line_pointer))
- + {
- + reg_number = strtol (input_line_pointer, & input_line_pointer, 10);
- +
- + /* Make sure that the register number is allowable. */
- + if ( reg_number < 0
- + || reg_number > 5
- + && reg_number < 16
- + || reg_number > 20
- + )
- + {
- + reg_number = -1;
- + }
- + }
- + else if (accept_list_names)
- + {
- + c = get_symbol_end ();
- +
- +#if 0 /* c33 */
- + reg_number = reg_name_search (system_list_registers,
- + SYSREGLIST_NAME_CNT, name, FALSE);
- +#endif
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + }
- + }
- +#endif
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +
- +CONST char * md_shortopts = "m:";
- +
- +struct option md_longopts[] =
- +{
- + {NULL, no_argument, NULL, 0}
- +};
- +size_t md_longopts_size = sizeof md_longopts;
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- + false : ld.w %pc,%rs
- +******************************************************************************/
- +static boolean
- +load_system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_load_system_registers, PE_LOAD_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* ADV */
- + reg_number = reg_name_search (adv_load_system_registers, ADV_LOAD_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- + true : pushs %psr,%sp,%alr,%ahr,%lco,%lsa,%lea,%sor,%ttbr,%dp,%usp,%ssp,%pc
- +******************************************************************************/
- +static boolean
- +pushs_system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_pushs_system_registers, PE_PUSHS_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* ADV */
- + reg_number = reg_name_search (adv_pushs_system_registers, ADV_PUSHS_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +/******************************************************************************
- + INPUT FILE* not used
- + RETURN void
- + Explanation display option
- +******************************************************************************/
- +void
- +md_show_usage (stream)
- + FILE * stream;
- +{
- + /* The special option for c33 is nothing. */
- +}
- +
- +/******************************************************************************
- + INPUT int not used
- + char* not used
- + RETURN int TRUE ok
- + Explanation Argument (option) analysis
- +******************************************************************************/
- +int
- +md_parse_option (c, arg)
- + int c;
- + char * arg;
- +{
- +#if 0
- + int Num;
- + int i;
- + if (c != 'm')
- + {
- + /* xgettext:c-format */
- + fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg);
- + return 0;
- + }
- +
- +#endif
- + return 1;
- +}
- +
- +/******************************************************************************
- + INPUT char* not used
- + RETURN symbolS* NULL
- + Explanation Treatment of the symbol which is not defined
- +******************************************************************************/
- +symbolS *
- +md_undefined_symbol (name)
- + char * name;
- +{
- + return 0;
- +}
- +
- +char *
- +md_atof (type, litp, sizep)
- + int type;
- + char * litp;
- + int * sizep;
- +{
- + int prec;
- + LITTLENUM_TYPE words[4];
- + char * t;
- + int i;
- +
- + switch (type)
- + {
- + case 'f':
- + prec = 2;
- + break;
- +
- + case 'd':
- + prec = 4;
- + break;
- +
- + default:
- + *sizep = 0;
- + return _("bad call to md_atof");
- + }
- +
- + t = atof_ieee (input_line_pointer, type, words);
- + if (t)
- + input_line_pointer = t;
- +
- + *sizep = prec * 2;
- +
- + for (i = prec - 1; i >= 0; i--)
- + {
- + md_number_to_chars (litp, (valueT) words[i], 2);
- + litp += 2;
- + }
- +
- + return NULL;
- +}
- +
- +
- +/* Very gross. */
- +void
- +md_convert_frag (abfd, sec, fragP)
- + bfd * abfd;
- + asection * sec;
- + fragS * fragP;
- +{
- + subseg_change (sec, 0);
- +
- + /* In range conditional or unconditional branch. */
- + if (fragP->fr_subtype == 0 || fragP->fr_subtype == 2)
- + {
- + fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int)fragP->fr_opcode);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 2;
- + }
- + /* Out of range conditional branch. Emit a branch around a jump. */
- + else if (fragP->fr_subtype == 1)
- + {
- + unsigned char *buffer =
- + (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
- +
- + /* Reverse the condition of the first branch. */
- + buffer[0] ^= 0x08;
- + /* Mask off all the displacement bits. */
- + buffer[0] &= 0x8f;
- + buffer[1] &= 0x07;
- + /* Now set the displacement bits so that we branch
- + around the unconditional branch. */
- + buffer[0] |= 0x30;
- +
- + /* Now create the unconditional branch + fixup to the final
- + target. */
- + md_number_to_chars (buffer + 2, 0x00000780, 4);
- + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
- + (int) fragP->fr_opcode + 1);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 6;
- + }
- + /* Out of range unconditional branch. Emit a jump. */
- + else if (fragP->fr_subtype == 3)
- + {
- + md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
- + fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
- + (int) fragP->fr_opcode + 1);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 4;
- + }
- + else
- + abort ();
- +}
- +
- +valueT
- +md_section_align (seg, addr)
- + asection * seg;
- + valueT addr;
- +{
- + int align = bfd_get_section_alignment (stdoutput, seg);
- + return ((addr + (1 << align) - 1) & (-1 << align));
- +}
- +
- +/******************************************************************************
- + INPUT NONE
- + RETURN void
- + Explanation An assembler initial cofiguration peculiar to a model
- +******************************************************************************/
- +void
- +md_begin ()
- +{
- + char * prev_name = "";
- + register const struct c33_opcode * op;
- + flagword applicable;
- +
- + /* Create hash table */
- + c33_hash = hash_new();
- +
- + /* Insert unique names into hash table. The C33 instruction set
- + has many identical opcode names that have different opcodes based
- + on the operands. This hash table then provides a quick index to
- + the first opcode with a particular name in the opcode table. */
- +
- + /* nemonic registered into the operation code table is registered into a hash table.*/
- +
- + /* >>>>>> tazaki 2001.11.07 */
- + if( g_iAdvance == 0 ) /* cpu = standard ? */
- + {
- + if( g_iPE == 0 )
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_opcodes; /* STANDARD table */
- + }
- + else
- + {
- + op = c33_opcodes32; /* STANDARD table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + else
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_pe_opcodes; /* PE table add T.Tazaki 2003/11/18 */
- + }
- + else
- + {
- + op = c33_pe_opcodes32; /* PE table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + }
- + else
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_advance_opcodes; /* ADVANCE table */
- + }
- + else
- + {
- + op = c33_advance_opcodes32; /* ADVANCE table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + /* <<<<<< tazaki 2001.11.07 */
- +
- + while (op->name)
- + {
- + if (strcmp (prev_name, op->name))
- + {
- + prev_name = (char *) op->name;
- + hash_insert (c33_hash, op->name, (char *) op);
- + }
- + op++;
- + }
- +#if 0 /* c33 */
- + bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
- +#endif /* c33 */
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +}
- +
- +/******************************************************************************
- + INPUT int NONE
- + RETURN bfd_reloc_code_real_type
- + Explanation analysys symbol mask
- +******************************************************************************/
- +/* Warning: The code in this function relies upon the definitions
- + in the c33_operands[] array (defined in opcodes/c33-opc.c)
- + matching the hard coded values contained herein. */
- +
- +static bfd_reloc_code_real_type
- +c33_reloc_prefix ()
- +{
- +
- + /* Is it the prefix of a symbol mask? */
- + if (*input_line_pointer == '@'){
- + input_line_pointer++;
- + }else{
- +
- + /* NO */
- + return BFD_RELOC_UNUSED;
- + }
- +#define CHECK_(name, reloc) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return reloc; \
- + }
- +
- + CHECK_ ("ah", BFD_RELOC_C33_AH); /* LABEL(25:13) */
- + CHECK_ ("al", BFD_RELOC_C33_AL); /* LABEL(12:0) */
- + CHECK_ ("rh", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
- + CHECK_ ("rm", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
- + CHECK_ ("rl", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
- + CHECK_ ("h", BFD_RELOC_C33_H); /* LABEL(31:19) */
- + CHECK_ ("m", BFD_RELOC_C33_M); /* LABEL(18:6) */
- + CHECK_ ("l", BFD_RELOC_C33_L); /* LABEL(5:0) */
- +
- + CHECK_ ("AH", BFD_RELOC_C33_AH); /* LABEL(25:13) */
- + CHECK_ ("AL", BFD_RELOC_C33_AL); /* LABEL(12:0) */
- + CHECK_ ("RH", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
- + CHECK_ ("RM", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
- + CHECK_ ("RL", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
- + CHECK_ ("H", BFD_RELOC_C33_H); /* LABEL(31:19) */
- + CHECK_ ("M", BFD_RELOC_C33_M); /* LABEL(18:6) */
- + CHECK_ ("L", BFD_RELOC_C33_L); /* LABEL(5:0) */
- +
- + return BFD_RELOC_UNUSED;
- +}
- +
- +/* add tazaki 2001.12.03 >>>>> */
- +
- +/* Warning: The code in this function relies upon the definitions
- + in the c33_operands[] array (defined in opcodes/c33-opc.c)
- + matching the hard coded values contained herein. */
- +
- +/******************************************************************************
- + INPUT int NONE
- + RETURN bfd_reloc_code_real_type
- + Explanation analisys symbol offset
- +******************************************************************************/
- +static bfd_reloc_code_real_type
- +c33_reloc_prefix_offset ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +#define CHECK2_(name, reloc) \
- + if (strncmp (input_line_pointer, name##"(", strlen (name) + 1 ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return reloc; \
- + }
- +
- + CHECK2_ ("doff_hi", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
- + CHECK2_ ("doff_lo", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
- + CHECK2_ ("goff_lo", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
- + CHECK2_ ("soff_hi", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
- + CHECK2_ ("soff_lo", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
- + CHECK2_ ("toff_hi", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
- + CHECK2_ ("toff_lo", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
- + CHECK2_ ("zoff_hi", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
- + CHECK2_ ("zoff_lo", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
- + CHECK2_ ("dpoff_h", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
- + CHECK2_ ("dpoff_m", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
- + CHECK2_ ("dpoff_l", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
- +
- + CHECK2_ ("DOFF_HI", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
- + CHECK2_ ("DOFF_LO", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
- + CHECK2_ ("GOFF_LO", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
- + CHECK2_ ("SOFF_HI", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
- + CHECK2_ ("SOFF_LO", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
- + CHECK2_ ("TOFF_HI", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
- + CHECK2_ ("TOFF_LO", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
- + CHECK2_ ("ZOFF_HI", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
- + CHECK2_ ("ZOFF_LO", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
- + CHECK2_ ("DPOFF_H", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
- + CHECK2_ ("DPOFF_M", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
- + CHECK2_ ("DPOFF_L", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
- +
- + return BFD_RELOC_UNUSED;
- +
- +}
- +
- +/* add tazaki 2002.02.29 >>>>> */
- +/******************************************************************************
- + INPUT NONE
- + RETURN operand code
- + advanced macro "EXT COND" instruction operand analysis
- +******************************************************************************/
- +static int
- +c33_condition ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +#define CHECK3_(name, cond) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return cond; \
- + }
- +
- + CHECK3_ ("gt", 0x04);
- + CHECK3_ ("ge", 0x05);
- + CHECK3_ ("lt", 0x06);
- + CHECK3_ ("le", 0x07);
- + CHECK3_ ("ugt", 0x08);
- + CHECK3_ ("uge", 0x09);
- + CHECK3_ ("ult", 0x0a);
- + CHECK3_ ("ule", 0x0b);
- + CHECK3_ ("eq", 0x0c);
- + CHECK3_ ("ne", 0x0d);
- +
- + return 0;
- +
- +}
- +/* add tazaki 2002.02.29 >>>>> */
- +/******************************************************************************
- + INPUT NONE
- + RETURN operand code
- + advanced macro "EXT OP,imm2" or "EXT %RB,OP,imm2" instruction operand analysis
- +******************************************************************************/
- +static int
- +c33_op_shift ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +#define CHECK4_(name, op_shift_code) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return op_shift_code; \
- + }
- +
- + CHECK4_ ("sra", 0x01);
- + CHECK4_ ("srl", 0x02);
- + CHECK4_ ("sll", 0x03);
- +
- + return 0;
- +
- +}
- +
- +/******************************************************************************
- + INPUT unsigned long
- + const struct c33_operand* operand
- + offsetT
- + char*
- + unsigned int
- + char*
- + int
- + RETURN unsigned long
- + Explanation An operand and an operation code are made into a command code.
- +******************************************************************************/
- + unsigned long ulrd; /* add T.Tazaki 2004/07/23 */
- +
- +/* Insert an operand value into an instruction. */
- +static unsigned long
- +c33_insert_operand (insn, operand, val, file, line, str,flags)
- + unsigned long insn;
- + const struct c33_operand * operand;
- + offsetT val;
- + char * file;
- + unsigned int line;
- + char * str;
- + int flags;
- +{
- +
- + long min, max, lval;
- + unsigned long ulValue, ulMask;
- + int iSign;
- +
- + /* Does a function exist? */
- + if (operand->insert)
- + {
- + /* YES */
- +
- + const char * message = NULL;
- +
- + insn = operand->insert (insn, val, & message);
- + if (message != NULL)
- + {
- + if (str)
- + {
- + if (file == (char *) NULL)
- + as_warn ("%s: %s", str, message);
- + else
- + as_warn_where (file, line, "%s: %s", str, message);
- + }
- + else
- + {
- + if (file == (char *) NULL)
- + as_warn (message);
- + else
- + as_warn_where (file, line, message);
- + }
- + }
- + }
- + else
- + {
- + /* NO */
- +
- +// long min, max, lval;
- +// unsigned long ulValue, ulMask;
- +// int iSign;
- +
- + lval = val; /* T.Tazaki 2002.02.27 */
- +
- + if( operand->range < 32 ){
- +
- + /* Restore min and mix to expected values for decimal ranges. */
- +
- + if (flags & C33_OPERAND_SIGNED){
- +
- + ulValue = val;
- +
- + ulMask = 0xffffffff >> ( operand->range - 1 );
- + ulMask <<= ( operand->range - 1 );
- + if(( ulValue & ulMask ) == ulMask ){
- + iSign = 1; /* (-) */ /* "jp 0xffffff81" */
- + }else{
- + if( ( ulValue & ulMask ) == (1 << ( operand->range - 1 )) ){ /* only sign bit = 1 ? */
- + iSign = 1; /* (-) */ /* "jp 0x81" */
- + }else{
- + if(( ulValue & ulMask ) == 0 ){ /* sign bit = 0 ? */
- + iSign = 0; /* (+) */ /* "jp 0x40" */
- + }else{
- + iSign = 2; /* Warninng */
- + }
- + }
- + }
- +
- + if( iSign == 2 ){ /* Invalid range ? "jp 0x102" */
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
- + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), val);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + else
- + {
- + if( iSign == 0 ){ /* (+) ? */
- + lval = val;
- + }else{
- + if( iSign == 1 ){ /* (-) ? */
- + lval = ulValue | ulMask; /* sign extend */
- + }
- + }
- +
- + /* max = (1 << ( operand->bits - 1 )) - 1;
- + min = - (1 << (operand->bits - 1)); */
- + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
- + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
- +
- + if (lval < min || lval > max)
- + {
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), lval);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + }
- + }
- + else {
- + /* It asks for the range of effective value. */
- + max = (1 << operand->bits) - 1;
- + min = 0;
- +
- + /* Value is range outside. */
- + if (lval < (offsetT) min || lval > (offsetT) max)
- + {
- + /* xgettext:c-format */
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), lval);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + }
- + }
- +
- + /* An operand and an operation code are made into a command code. */
- +// insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
- + insn |= (((long) lval & ((1 << operand->bits) - 1)) << operand->shift); /* T.Tazaki 2002.02.27 */
- +/* >>>> add tazaki advanced macro */
- + if (flags & C33_OPERAND_01) {
- + insn |= 0x0010; /* bit 5,4 = 0,1 set */
- + }
- + if (flags & C33_OPERAND_OP3_01) {
- + insn |= 0x0040; /* bit 7,6 = 0,1 set : psrset imm5 */
- + }
- + if (flags & C33_OPERAND_OP3_10){
- + insn |= 0x0080; /* bit 7,6 = 1,0 set : psrclr imm5 */
- + }
- +/* <<<< add tazaki advanced macro */
- + }
- + return insn;
- +}
- +
- +
- +static char copy_of_instruction [128];
- +
- +void
- +md_assemble (str)
- + char * str;
- +{
- + char * s;
- + char * start_of_operands;
- + struct c33_opcode * opcode;
- + struct c33_opcode * opcode2; /* add tazaki 2001.08.10 */
- + struct c33_opcode * next_opcode;
- + const unsigned char * opindex_ptr;
- + int next_opindex;
- + int relaxable;
- + unsigned short insn;
- + unsigned short insn_wk; /* add tazaki 2001.12.11 */
- + unsigned short copy_insn;
- + char * f; /* insn address */
- + char * where; /* insn address */
- + int i;
- + int match;
- + boolean extra_data_befor_insn = false;
- + unsigned int extra_data_len;
- + unsigned short extraInsnBuf[10];
- + char * saved_input_line_pointer;
- + char * check_input_line_pointer;
- + char * temp_input_line_pointer;
- + unsigned short * fromP;
- + int iNumber;
- + unsigned int uiNumber; /* add tazaki 2002.03.11 */
- +
- + int i_ext_off; /* add tazaki 2001.08.07 */
- + int iMEM_IMM26_flag; /* add tazaki 2001.10.11 */
- + char * pSymbolName ; /* for [imm26] add tazaki 2001.11.28 */
- + char szSymbolName[300]; /* for [imm26] add tazaki 2001.11.28 */
- + char * temp_pointer; /* for [imm26] add tazaki 2001.11.28 */
- +
- + int g_iBitTest = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
- + int g_iBitTest_range = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
- + int g_iXload = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
- + int g_iXload_range = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
- +
- + pSymbolName = &szSymbolName[0]; /* Symbol name pointer domain initialization for [imm26] add tazaki 2001.11.28*/
- +
- + /* The command character sequence for one line is copied. */
- + strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
- +
- + /* It is made a character sequence as an operation code. */
- + /* Get the opcode. */
- + for (s = str; *s != '\0' && ! isspace (*s); s++)
- + continue;
- +
- + if (*s != '\0')
- + *s++ = '\0';
- +
- + /* find the first opcode with the proper name */
- + opcode = (struct c33_opcode *) hash_find (c33_hash, str);
- +
- + /* not find operation code? */
- + if (opcode == NULL) {
- + /* xgettext:c-format */
- + as_bad (_("Unrecognized opcode: `%s'"), str);
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + /* The space from an operation code to an operand is skipped. */
- + str = s;
- + while (isspace (* str))
- + ++ str;
- +
- + /* The start position of an operand is held. */
- + start_of_operands = str;
- +
- + saved_input_line_pointer = input_line_pointer;
- +
- + /* An interpretation of an operand */
- + for (;;) {
- + const char * errmsg = NULL;
- +
- + match = 0;
- +
- + relaxable = 0;
- + fc = 0;
- + next_opindex = 0;
- + insn = opcode->opcode;
- + extra_data_befor_insn = false;
- +
- + iMEM_IMM26_flag = 0; /* add tazaki 2001.10.11 */
- +
- + /* The start position of an operand is held. */
- + input_line_pointer = str = start_of_operands;
- +
- + /* Only the number of operands is repeated. */
- + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr ++)
- + {
- + const struct c33_operand * operand;
- + char * hold;
- + expressionS ex;
- + expressionS ext_ex;
- + bfd_reloc_code_real_type reloc;
- +
- + int flags;
- +
- + if (next_opindex == 0)
- + {
- + /* An operand is acquired. */
- + operand = & c33_operands[ * opindex_ptr ];
- + }
- + else
- + {
- + operand = & c33_operands[ next_opindex ];
- + next_opindex = 0;
- + }
- +
- + flags = operand->flags;
- + errmsg = NULL;
- +
- + while (*str == ' ' || *str == ',' || *str == ']')
- + ++ str;
- +
- + /* Gather the operand. */
- + hold = input_line_pointer;
- + input_line_pointer = str;
- +
- + errmsg = NULL;
- +
- + /* tazaki 2002.01.11 >>>>>> */
- + i_ext_off = 0;
- + opcode2 = (struct c33_opcode *)c33_ext_opcodes;
- + if( opcode->opcode == opcode2->opcode ){
- + /* ext xoff_hi(sym),ext xoff_lo(sym),ext dpoff_h,m(sym) : analisys symbol offset */
- + reloc = c33_reloc_prefix_offset ();
- + if( reloc != BFD_RELOC_UNUSED ){
- + i_ext_off = 1;
- + }
- + }
- + if( i_ext_off == 1 )
- + {
- + /* ext 命令 and xoff_hi(sym),ext xoff_lo(sym),dpoff_h,m(sym) ? */
- +
- + /* read symbol , disp */
- +
- + expression (& ex);
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = reloc;
- + ++fc;
- +
- + }
- + else
- + {
- + /* >>>> add tazaki 2002.02.29 class1 : ext cond*/
- + if ((operand->flags & C33_OPERAND_COND) == C33_OPERAND_COND)
- + {
- + int iCond = c33_condition(); /* get operand code */
- + if( iCond != 0 ){
- +
- + ex.X_op = O_cond;
- + ex.X_add_number = iCond;
- +
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2002.02.29 class1 : ext OP,imm2 | ext %rb,OP,imm2 */
- + else if ((operand->flags & C33_OPERAND_OP_SHIFT) == C33_OPERAND_OP_SHIFT)
- + {
- + int iShiftCode = c33_op_shift(); /* get operand code */
- + if( iShiftCode != 0 ){
- +
- + ex.X_op = O_op_shift;
- + ex.X_add_number = iShiftCode;
- +
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2001.09.18 class7 : [%dp+imm6]*/
- + else if ((operand->flags & C33_OPERAND_DPMEM) == C33_OPERAND_DPMEM)
- + {
- + if (*str == '['){
- + str++;
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support only"[%dp]" */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else if (*str == '+'){
- + str++;
- + input_line_pointer = str;
- +
- + reloc = c33_reloc_prefix_offset();
- + if( reloc != BFD_RELOC_UNUSED ){ /* dpoff_l() ? */
- + errmsg = _("invalid operand");
- + }
- + else
- + {
- + /* An operand is developed at a formula. */
- + expression (& ex);
- +
- + iNumber = ex.X_add_number;
- +
- + if (operand->range <= 6){
- + /* EMPTY */
- + }
- + else if (operand->range == 32) {
- + /* update tazaki 2002.03.08 >>> */
- + if (opcode->specialFlag == 1){
- + /* ld.b */
- + if ((unsigned int)iNumber <= 0x3f){
- + ex.X_add_number /= 1;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 2){
- + /* ld.h */
- + if ((unsigned int)iNumber <= 0x7f){
- + ex.X_add_number /= 2;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 4){
- + /* ld.w */
- + if ((unsigned int)iNumber <= 0xff){
- + ex.X_add_number /= 4;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + /* update tazaki 2002.03.08 <<< */
- + }
- + else {
- + errmsg = _("constant too big to fit into instruction");
- + }
- + }
- + }
- + else{
- + /* YES */
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* >>>> add tazaki 2002.01.15 class7 : [%dp+dpoff_l(symbol)]*/
- + else if ((operand->flags & C33_OPERAND_DPSYMBOL6) == C33_OPERAND_DPSYMBOL6)
- + {
- + if (*str == '['){
- + str++;
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support only"[%dp] */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else
- + {
- + if (*str == '+'){
- + /* [%dp+dpoff_l(symbol)] */
- + str++;
- + input_line_pointer = str;
- +
- + reloc = c33_reloc_prefix_offset();
- + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
- +
- + expression (& ex);
- +
- + if (ex.X_op != O_symbol){ /* not symbol ? */
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* >>>> add tazaki 2002.01.15 class7 : dpoff_l(symbol) */
- + else if ((operand->flags & C33_OPERAND_DPSYMBOL6_2) == C33_OPERAND_DPSYMBOL6_2)
- + {
- + reloc = c33_reloc_prefix_offset();
- + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
- +
- + expression (& ex);
- +
- + if (ex.X_op != O_symbol){ /* not symbol ? */
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2001.12.21 class0 : %dp */
- +
- + else if ((operand->flags & C33_OPERAND_DP) == C33_OPERAND_DP)
- + {
- + /* check %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* NO */
- + errmsg = _("invalid system register name");
- + }else{
- + str+=3;
- + while (isspace (*str))
- + ++str;
- + input_line_pointer = str;
- +
- + ex.X_op = O_dpregister;
- + /* In %dp, an operand is not inserted in a command code. */
- + }
- + /* <<<< add tazaki 2001.12.21 class0 : %dp */
- + }
- + else if ((operand->flags & C33_OPERAND_REG) != 0)
- + {
- + if (!register_name (& ex))
- + {
- + /* YES */
- + errmsg = _("invalid register name");
- + }
- + }
- + else if ((operand->flags & C33_OPERAND_LD_SREG) != 0) /* add 2002.06.19 error : ld.w %pc,%rs */
- + {
- + if (!load_system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + }
- + else if ((operand->flags & C33_OPERAND_PUSHS_SREG) != 0) /* add 2002.06.19 : pushs %ss ,pops %sd */
- + {
- + if (!pushs_system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + }
- + else if (((operand->flags & C33_OPERAND_SREG) != 0) ||
- + ((operand->flags & C33_OPERAND_SP) != 0))
- + {
- + if (!system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + else {
- + /* NO register OK */
- + if ((operand->flags & C33_OPERAND_SP) != 0)
- + {
- + ex.X_op = O_spregister;
- + /* In %sp, an operand is not inserted in a command code. */
- + }
- + }
- + }
- + /* ELSE IF Operand is immidiate ? */
- + else if ((operand->flags & C33_OPERAND_IMM) ||
- + (operand->flags & C33_OPERAND_SIGNED))
- + {
- +
- + expression (& ex);
- +
- + /* IF Operand is constant ?*/
- + if (ex.X_op == O_constant)
- + {
- + if (opcode->specialFlag == 5){
- +
- + /* shift/lotate */
- +
- + iNumber = ex.X_add_number;
- + if( iNumber > 8 ){
- +
- + errmsg = _("operand out of range (not between 0 and 8)");
- + }else{
- + extra_data_len = 0;
- + ex.X_add_number = iNumber;
- + }
- + }else if (opcode->specialFlag == 6){
- +
- + /* 拡張命令のshift/lotate */
- +
- + iNumber = ex.X_add_number;
- + if( iNumber > 31 ){
- + errmsg = _("operand out of range (not between 0 and 31)");
- + }else{
- + extra_data_len = 0;
- + while(iNumber > 8){
- + extra_data_befor_insn = true;
- + copy_insn = c33_insert_operand (insn, operand,8,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + extraInsnBuf[extra_data_len] = copy_insn;
- + extra_data_len++;
- + ex.X_add_number = 8;
- + iNumber -= 8;
- + }
- + ex.X_add_number = iNumber;
- + }
- + }else if (opcode->specialFlag == 7){
- +
- + /* Advanced mode "X" Extended of shift/lotate */
- + iNumber = ex.X_add_number;
- + if( iNumber > 31 ){
- + errmsg = _("operand out of range (not between 0 and 31)");
- + }else{
- + if( iNumber <= 15 ){
- +
- + }else{
- + ex.X_add_number -= 16;
- +
- + /* Convert Opecode */
- + insn_wk = insn & 0xff00;
- +
- + switch( insn_wk ){
- + case 0x8800: insn_wk = 0x2300; break; /* srl -->class 1 : srl */
- + case 0x8c00: insn_wk = 0x2700; break; /* sll -->class 1 : sll */
- + case 0x9000: insn_wk = 0x2b00; break; /* sra -->class 1 : sra */
- + case 0x9400: insn_wk = 0x2f00; break; /* sla -->class 1 : sla */
- + case 0x9800: insn_wk = 0x3300; break; /* rr -->class 1 : rr */
- + case 0x9c00: insn_wk = 0x3700; break; /* rl -->class 1 : rl */
- + default : errmsg = _("invalid operand"); break;
- +
- + }
- + insn = insn_wk | ( insn & 0x00ff );
- + }
- + }
- + }
- + else {
- + /* shift/lotate命令以外 */
- +
- + /* Possible to sign32 */
- + iNumber = ex.X_add_number;
- +
- + if (operand->flags & C33_OPERAND_SIGNED){
- + /* YES signed */
- +
- + if ((operand->range == 19) && ((-262144 <= iNumber && iNumber < -32) ||
- + (31 < iNumber && iNumber <= 262143))){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0) is not signed */
- + }
- + else if (operand->range == 22) {
- + if (operand->flags & C33_OPERAND_PC){
- + if (-256 <= iNumber && iNumber <= 254){
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
- + }
- + else if ((-2097152 <= iNumber && iNumber < -256) ||
- + (254 < iNumber && iNumber <= 2097150)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff); /* sign22(21:9) */
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }else{
- + errmsg = _("operand out of range (not between -2097152 and 2097150)");
- + }
- + }
- + }
- + else if (operand->range == 32){
- + /* jp,call */
- + if (operand->flags & C33_OPERAND_PC){
- + if (-256 <= iNumber && iNumber <= 254){
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + }
- + else if ((-2097152 <= iNumber && iNumber < -256) ||
- + (254 < iNumber && iNumber <= 2097150)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff);
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1ff8);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 9) & 0x1fff);
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + }
- + else {
- + if (-32 <= iNumber && iNumber <= 31){
- + /* EMPTY */
- + }
- + else if ((-262144 <= iNumber && iNumber < -32) ||
- + (31 < iNumber && iNumber <= 262143)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + else {
- + /* ext命令 2つ */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + }
- + }
- + }
- + else {
- + /* IMM */
- + switch( operand->range ){
- + case 19:
- + if ((unsigned int)iNumber <= 0x7ffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + break;
- + case 32:
- + if ((unsigned int)iNumber <= 0x3f){
- + /* EMPTY */
- + }
- + else if ((unsigned int)iNumber <= 0x7ffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- +
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- +
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + break;
- + }
- + }
- + }
- + }
- +
- + /* ELSE IF Operand is LABEL & SYMBOL */
- +
- + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_LABEL)){
- + /* YES jp/call only */
- +
- + if (operand->range == 13){ /* 2001.4.27 ide */
- + /* YES ext */
- +
- + /* Get Symbol mask relocation */
- + reloc = c33_reloc_prefix ();
- + /* Not symbol mask ? : ERROR = ext label, OK = ext label@xx */
- + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2002.03.04 */
- + errmsg = _("invalid operand");
- + }
- + }
- + else if (operand->range == 5){ /* add tazaki 2002.03.04 */
- + /* YES loop */
- + reloc = BFD_RELOC_C33_LOOP; /* Adv : loop operand */
- + }
- + else if (operand->range == 8){
- + /* YES jp,call */
- +
- + reloc = c33_reloc_prefix (); /* add tazaki 2001.08.23 */
- + /* Not symbol mask ? */
- + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2001.08.23 */
- + /* Set Symbol Mask Relocation */
- + reloc = BFD_RELOC_C33_JP; /* Modify BFD_RELOC_C33_RL -->BFD_RELOC_C33_JP 2002.04.22 */
- + }
- + }
- + /* add 2001.08.06 tazaki >>>>> */
- + else if (operand->range == 22){
- + /* YES scall,sjp,sjrxx */
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- +
- + }
- + /* add 2001.08.06 tazaki <<<<< */
- + else {
- + /* xjp,xcall */
- +
- + /* ext label+imm32@rh */
- + /* ext label+imm32@rm */
- + /* call label+imm32@rl */
- +
- + /* strにシンボル名が入っている。2パス アセンブラのとき、これを比較する。 */
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- + }
- + }
- + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_SYMBOL)){
- + /* YES ld.w only */
- + if( *str == '[' ){
- + errmsg = _("invalid operand");
- + }
- + else if (operand->range == 6){
- + /* ld.w %rd,LABEL@l */
- +
- + /* Get Symbol mask relocation */
- + reloc = c33_reloc_prefix ();
- + }
- + else if (operand->range == 19){
- + /* xld.w rd,symbol+imm19 */
- +
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + }
- + else{
- + if (operand->range == 32){
- + /* ext label+imm32@h */
- + /* ext label+imm32@m */
- + /* xld.w label+imm32@l */
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- + }
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + /* Operand is register indirectness (memory). */
- +// else if ((operand->flags & C33_OPERAND_RB) != 0) /* del T.Tazaki 2004/07/30 */
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) == 0 && g_iMedda32 == 1 ) /* add T.Tazaki 2004/07/30 */
- + {
- + /* Pattern */
- + /* [rb] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* YES register */
- +
- + /* Skip space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES pattern match */
- + input_line_pointer++;
- + }
- + else {
- + /* NO not match */
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO not register */
- + errmsg = _("invalid operand");
- + }
- +
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + /* add T.Tazaki 2004/07/30 >>> */
- + /* Operand is register indirectness (memory). */
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && g_iMedda32 == 0 ) /* Use data area */
- + {
- + /* Pattern */
- + /* [rb] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* YES register */
- +
- + /* Skip space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES pattern match */
- + input_line_pointer++;
- + }
- + else {
- + /* NO not match */
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO not register */
- + errmsg = _("invalid operand");
- + }
- +
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) != 0 && g_iMedda32 == 1 )
- + {
- + /* Are there any symbol and IMM which follow a register? */
- + /* Pattern */
- + /* [rb+imm26] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* Skip Space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES Register Only */
- + input_line_pointer++;
- + }
- + /* ELSE IF plus */
- + else if (*input_line_pointer == '+'){
- + /* YES plus */
- +
- + input_line_pointer++;
- + /* symbol,imm */
- + expression (& ext_ex);
- +
- + if (ext_ex.X_op == O_constant){
- + /* [%rd+imm26] */
- +
- + uiNumber = ext_ex.X_add_number;
- +
- + if (uiNumber == 0){
- + /* EMPTY */
- + }
- + else if (uiNumber <= 0x1fff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else if (uiNumber <= 0x3ffffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else {
- + /* NO more than 27bit ? */
- +
- + /* tnot support */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO not immidiate */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO any other character */
- + /* error */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* add T.Tazaki 2004/07/30 <<< */
- +
- +/* >>> add tazaki 2001.11.20 */
- +
- + else if( ( (operand->flags & C33_OPERAND_MEM) != 0 ) &&
- + ( (operand->flags & C33_OPERAND_DP_SYMBOL) == C33_OPERAND_DP_SYMBOL ) )
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + /* YES not register */
- +
- + if (system_register_name (& ex, true, false)){
- + /* system register */
- + errmsg = _("invalid operand");
- + }
- + else {
- + check_input_line_pointer = input_line_pointer;
- +
- + expression (& ex);
- +
- + /* if Minus "-", No Support! */
- + while(check_input_line_pointer < input_line_pointer){
- + if (*check_input_line_pointer == '-'){
- + errmsg = _("invalid operand");
- + break;
- + }
- + check_input_line_pointer++;
- + }
- + }
- + if (errmsg != NULL){
- + }
- + /* ELSE IF Operand is SYMBOL */
- + else if (ex.X_op == O_symbol){
- + /* Pattern */
- + /* [symbol+imm32] */
- +
- + if( operand->range == 19 )
- + {
- + if( g_iMedda32 == 0 ) /* add T.Tazaki 2004/07/30 */
- + {
- + /* ext (symbol+imm32-dp)@6-18 : ext imm13 */
- + /* ld.w (symbol+imm32-dp)@0-5 : ld.w r0,[%dp+imm6] */
- +
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- + }
- +#if 0
- + else
- + {
- + /* add T.Tazaki 2004/08/19 >>> */
- + /* 0:pushn %r0 */
- + /* 1:ext label+imm32@m */
- + /* 2:ld.x %r0,label+imm32@l */
- + /* 3:ld.x %rd,[%r0] */
- + /* 4:popn %r0 */
- +
- + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
- + /* 1ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_M に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
- + を追加して、リンカで "pushn %r0" を設定させるためにある。 */
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0; /* デフォルトの"pushn %r0" を設定 */
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + extra_data_befor_insn = true;
- + ulrd = insn & 0x000f;
- + insn &= 0xfff0;
- + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
- +
- + if ((operand->flags & C33_XLDB_RD) != 0)
- + {
- + insn = 0x2000 + ulrd; /* ld.b %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDB_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3400; /* ld.b [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDH_RD) != 0)
- + {
- + insn = 0x2800 + ulrd; /* ld.h %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDH_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3800; /* ld.h [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDW_RD) != 0)
- + {
- + insn = 0x3000 + ulrd; /* ld.w %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDW_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3c00; /* ld.w [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDUB_RD) != 0)
- + {
- + insn = 0x2400 + ulrd; /* ld.ub %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDUH_RD) != 0)
- + {
- + insn = 0x2c00 + ulrd; /* ld.uh %rd,[%r0] */
- + }
- + extraInsnBuf[3] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[4] = insn;
- + extra_data_len = 4;
- +
- + }
- + /* add T.Tazaki 2004/08/19 <<< */
- +#endif
- + }else if ( operand->range == 32 ){
- + /* ext (symbol+imm32-%dp)@19-31 : ext imm13 */
- + /* ext (symbol+imm32-%dp)@6-18 : ext imm13 */
- + /* ld.w (symbol+imm32-%dp)@0-5 : ld.w r0,[%dp+imm6] */
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- + }
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- +/* <<< add tazaki 2001.11.20 */
- +
- + /* An operand is register indirectness (memory). */
- + else if ((operand->flags & C33_OPERAND_MEM) != 0)
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + /* YES not register */
- +
- + if (system_register_name (& ex, true, false)){
- + /* system register */
- + errmsg = _("invalid operand");
- + }
- + else {
- + check_input_line_pointer = input_line_pointer;
- +
- + expression (& ex);
- +
- + /* if Minus "-", No Support! */
- + while(check_input_line_pointer < input_line_pointer){
- + if (*check_input_line_pointer == '-'){
- + errmsg = _("invalid operand");
- + break;
- + }
- + check_input_line_pointer++;
- + }
- + }
- +
- + if (errmsg != NULL){
- + }
- + /* ELSE IF Operand is Immidiate ? */
- + else if (ex.X_op == O_constant){
- + errmsg = _("invalid operand"); /* [imm26] patter : Error! 2001.11.28 */
- + }
- + /* ELSE IF Operand is SYMBOL ? */
- + else if (ex.X_op == O_symbol){
- +
- + /* Pattern */
- + /* [symbol+imm32] */
- +
- +
- + /* ext goff_hi(symbol+imm32) */
- + /* ext goff_lo(symbol+imm32) */
- + /* [r15] */
- +
- + if (operand->range == 13){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_GL;
- + ++fc;
- +
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- +
- + }
- + else if (operand->range == 26 && g_iMedda32 == 0 ){ /* use data area */
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
- + ++fc;
- +
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + }
- + /* add T.Tazaki 2004/08/19 >>> */
- + else if ((operand->range == 19 || operand->range == 26) && g_iMedda32 == 1 ){ /* xld と ald 兼用 : no use data area */
- + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
- + /* 0:pushn %r0 */
- + /* 1:ext label+imm32@m */
- + /* 2:ext label+imm32@m */
- + /* 3:ld.x %r0,label+imm32@l */
- + /* 4:ld.x [%r0],%rs */
- + /* 5:popn %r0 */
- +
- + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
- +
- + /* 1 or 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[0] = opcode->opcode;
- + }
- + else
- + {
- + extraInsnBuf[1] = opcode->opcode;
- + }
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[1] = opcode->opcode;
- + }
- + else
- + {
- + extraInsnBuf[2] = opcode->opcode;
- + }
- + }
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
- + を追加して、リンカで "pushn %r0" を設定させるためにある。
- + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) == 0 )
- + {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
- + ++fc;
- + }
- +
- + if( operand->range == 26 )
- + {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- + }
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + extra_data_befor_insn = true;
- + ulrd = insn & 0x000f;
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[2] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + insn &= 0xfff0;
- + extraInsnBuf[3] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- + else
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + /* xld.x %rd,[symbol+imm] */
- + extraInsnBuf[1] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + /* xld.x [symbol+imm],%rs */
- + insn &= 0xfff0;
- + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- + if ((operand->flags & C33_XLDB_RD) != 0)
- + {
- + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDB_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3400; /* ld.b [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDH_RD) != 0)
- + {
- + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDH_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3800; /* ld.h [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDW_RD) != 0)
- + {
- + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDW_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3c00; /* ld.w [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDUB_RD) != 0)
- + {
- + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDUH_RD) != 0)
- + {
- + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XBTST) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBCLR) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBSET) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBNOT) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[3] = insn;
- + extra_data_len = 3;
- + }
- + else
- + {
- + extraInsnBuf[4] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[5] = insn;
- + extra_data_len = 5;
- + }
- + }
- + else
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[2] = insn;
- + extra_data_len = 2;
- + }
- + else
- + {
- + extraInsnBuf[3] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[4] = insn;
- + extra_data_len = 4;
- + }
- + }
- +
- +
- + /* add T.Tazaki 2004/08/19 <<< */
- +
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO Register */
- + /* Are there any symbol and IMM which follow a register? */
- +
- + /* Pattern */
- + /* [rb+imm32] */
- +
- + /* Skip Space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES Register Only */
- + #if 0
- + errmsg = _("invalid operand");
- + #else
- + input_line_pointer++;
- + #endif
- + }
- + /* ELSE IF plus */
- + else if (*input_line_pointer == '+'){
- + /* YES plus */
- +
- + input_line_pointer++;
- + /* symbol,imm */
- + expression (& ext_ex);
- +
- + if (ext_ex.X_op == O_constant){
- + /* [%rd+imm26] */
- +
- + uiNumber = ext_ex.X_add_number;
- +
- + if (uiNumber == 0){
- + /* EMPTY */
- + }
- + else if (uiNumber <= 0x1fff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else if (uiNumber <= 0x3ffffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else {
- + /* NO more than 27bit ? */
- +
- + /* tnot support */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO not immidiate */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO any other character */
- + /* error */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + /* an operand -- the register with a post increment -- or [ being indirect ] */
- + else if ((operand->flags & C33_OPERAND_REGINC) != 0)
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + errmsg = _("invalid register name");
- + }
- + else {
- + str = input_line_pointer;
- +
- + /* Skip space */
- + while (isspace (*str))
- + ++str;
- +
- + if (*str == ']'){
- + ++str;
- +
- + while (isspace (*str))
- + ++str;
- +
- + if (*str == '+'){
- + /* normal end */
- + str++;
- + input_line_pointer = str;
- +
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- +
- + /* Register indirectness with the De Dis placement */
- + else if ((operand->flags & C33_OPERAND_SPMEM) != 0)
- + {
- + if (*str == '['){
- + str++;
- + /* Skip space */
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* check %sp */
- + if ( ( strncmp(str,"%sp",3) != 0 ) && ( strncmp(str,"%SP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support "[%sp]" 2001.3.29 ide */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else if (*str == '+'){
- + /* [sp+imm] */
- + str++;
- + input_line_pointer = str;
- +
- + expression (& ex);
- +
- + iNumber = ex.X_add_number;
- +
- + if (operand->range <= 6){
- + /* EMPTY */
- + }
- + else if (operand->range == 32) {
- + /* update tazaki 2002.03.08 >>> */
- + if (opcode->specialFlag == 1){
- + /* ld.b */
- + if ((unsigned int)iNumber <= 0x3f){
- + ex.X_add_number /= 1;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 2){
- + /* ld.h */
- + if ((unsigned int)iNumber <= 0x7f){
- + ex.X_add_number /= 2;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 4){
- + /* ld.w */
- + if ((unsigned int)iNumber <= 0xff){
- + ex.X_add_number /= 4;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + /* update tazaki 2002.03.08 <<< */
- + }
- + else {
- + errmsg = _("constant too big to fit into instruction");
- + }
- + }
- + else{
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + if (errmsg)
- + goto error;
- +
- + switch (ex.X_op)
- + {
- + case O_cond:
- + /* An operand and an operation code are made into a command code. */
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + break;
- + case O_op_shift:
- + /* An operand and an operation code are made into a command code. */
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + break;
- + case O_spregister :
- + /* Don't add %sp to a formula as an operand. */
- + break;
- + case O_dpregister :
- + /* Don't add %sp to a formula as an operand. */
- + break;
- + case O_illegal:
- + errmsg = _("illegal operand");
- + goto error;
- + case O_absent:
- + errmsg = _("missing operand");
- + goto error;
- + case O_register:
- + /* An operand and an operation code are made into a command code. */
- + /* add T.Tazaki 2004/08/19 >>> */
- + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
- + {
- + if( g_iXload_range == 26 ) /* xld.x */
- + {
- + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[3] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[4] = (extraInsnBuf[4] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[5] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[5] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + /* g_iXload_range = 19 : ald.x */
- + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[2] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[3] = (extraInsnBuf[3] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[4] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[4] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iXload = 0;
- + g_iXload_range = 0;
- + }
- + /* add T.Tazaki 2004/08/19 <<< */
- + else
- + {
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + break;
- +
- + case O_constant:
- + /* An operand and an operation code are made into a command code. */
- +
- + /* add T.Tazaki 2004/07/30 >>> */
- + if (g_iBitTest == 1) /* bit test inst ? */
- + {
- + if( g_iBitTest_range == 26 )
- + {
- + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iBitTest = 0;
- + g_iBitTest_range = 0;
- + }
- + /* add T.Tazaki 2004/07/30 <<< */
- + else
- + {
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + break;
- +
- + case O_symbol:
- + /* We need to generate a fixup for this expression. */
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opindex_ptr;
- + fixups[ fc ].reloc = reloc;
- + ++fc;
- + break;
- +
- + default:
- + /* We need to generate a fixup for this expression. */
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opindex_ptr;
- + fixups[ fc ].reloc = BFD_RELOC_UNUSED;
- + ++fc;
- + break;
- + }
- + }
- + str = input_line_pointer;
- + input_line_pointer = hold;
- +
- + while (*str == ' ' || *str == ',' || *str == ']' )
- + ++str;
- + }
- + match = 1;
- +
- + error:
- + if (match == 0)
- + {
- +
- + /* xld.w rd,[rs+imm26] : imm26 > 0x3ffffff ? add tazaki 2001.10.11 */
- + if( iMEM_IMM26_flag == 0 ){ /* The following operand form is not seen at the time of range over.。*/
- + next_opcode = opcode + 1;
- + if (next_opcode->name != NULL
- + && strcmp (next_opcode->name, opcode->name) == 0)
- + {
- + opcode = next_opcode;
- + continue;
- + }
- + }
- + as_bad (_("%s: %s"), copy_of_instruction, errmsg);
- +/* as_bad ("%s: %s", copy_of_instruction, errmsg); Modify tazaki 2001.10.11 */
- +
- + if (* input_line_pointer == ']')
- + ++ input_line_pointer;
- +
- + ignore_rest_of_line ();
- + input_line_pointer = saved_input_line_pointer;
- + return;
- + }
- + break;
- + }
- +
- + while (isspace (*str))
- + ++str;
- +
- + if (*str != '\0')
- + /* xgettext:c-format */
- + as_bad (_("junk at end of line: `%s'"), str);
- +
- + input_line_pointer = str;
- +
- + /* Write out the instruction. */
- +
- + if (relaxable && fc > 0)
- + {
- +
- + fc = 0;
- +
- + if (!strcmp (opcode->name, "br"))
- + {
- + f = frag_var (rs_machine_dependent, 4, 2, 2,
- + fixups[0].exp.X_add_symbol,
- + fixups[0].exp.X_add_number,
- + (char *)fixups[0].opindex);
- + md_number_to_chars (f, insn, 2);
- + md_number_to_chars (f + 2, 0, 2);
- + }
- + else
- + {
- + f = frag_var (rs_machine_dependent, 6, 4, 0,
- + fixups[0].exp.X_add_symbol,
- + fixups[0].exp.X_add_number,
- + (char *)fixups[0].opindex);
- + md_number_to_chars (f, insn, 2);
- + md_number_to_chars (f + 2, 0, 4);
- + }
- + }
- + else
- + {
- + /* ext command is set before a command code formula. . */
- + if (extra_data_befor_insn)
- + {
- + /* Domain reservation */
- + f = where = frag_more (extra_data_len*2+2); /* 2byte length instruction */
- +
- + /* The command code for extension (ext command) is acquired. */
- + fromP = &extraInsnBuf[0];
- +
- + /* Only a part for the command code for FOR extensio */
- + for (i = extra_data_len; i; --i)
- + {
- + /* The command code is stored in the buffer in order. */
- + md_number_to_chars (where, (long) (*fromP), 2);
- + where += 2;
- + fromP++;
- + }
- +
- + extra_data_befor_insn = false;
- + }
- + else {
- + /* Domain reservation */
- + f = where = frag_more (2); /* 2byte length instruction */
- + }
- +
- + /* >>> add tazaki 2001.09.13 */
- + /* macclr,ld.cf ? */
- + if (opcode->specialFlag == 10){
- + insn |= 0x0010; /* bit 5,4 = 0,1 set */
- + }
- + /* <<< add tazaki 2001.09.13 */
- +
- + /* The command code of 2 byte length is stored in a buffer. */
- + md_number_to_chars (where, insn, 2);
- + }
- +
- + /* Create any fixups. At this point we do not use a
- + bfd_reloc_code_real_type, but instead just use the
- + BFD_RELOC_UNUSED plus the operand index. This lets us easily
- + handle fixups for any operand type, although that is admittedly
- + not a very exciting feature. We pick a BFD reloc type in
- + md_apply_fix. */
- + for (i = 0; i < fc; i++)
- + {
- + const struct c33_operand * operand;
- + bfd_reloc_code_real_type reloc;
- +
- + operand = & c33_operands[ fixups[i].opindex ];
- +
- + reloc = fixups[i].reloc;
- +
- + if (reloc != BFD_RELOC_UNUSED)
- + {
- + reloc_howto_type * reloc_howto = bfd_reloc_type_lookup (stdoutput,
- + reloc);
- + int size;
- + int address;
- + fixS * fixP;
- +
- + if (!reloc_howto){
- + ;
- + /* abort(); */ /* del tazaki 2001.10.11 */
- + }else{
- +
- + size = bfd_get_reloc_size (reloc_howto);
- +
- + if (size != 2) {
- + ;
- + /* abort (); */ /* del tazaki 2001.10.11 */
- + }else{
- +
- + address = (f - frag_now->fr_literal) + 2 - size;
- +
- + f += 2;
- +
- + fixP = fix_new_exp (frag_now, address, size,
- + & fixups[i].exp,
- + reloc_howto->pc_relative,
- + reloc);
- +
- + switch (reloc)
- + {
- + case BFD_RELOC_C33_RH:
- + case BFD_RELOC_C33_RM:
- + case BFD_RELOC_C33_RL:
- + case BFD_RELOC_C33_S_RH: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_S_RM: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_S_RL: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_JP: /* add T.Tazaki 2002.04.22 */
- + case BFD_RELOC_C33_AH:
- + case BFD_RELOC_C33_AL:
- + case BFD_RELOC_C33_H:
- + case BFD_RELOC_C33_M:
- + case BFD_RELOC_C33_L:
- + /* >>>> add 2002.03.05 tazaki */
- + case BFD_RELOC_C33_DH:
- + case BFD_RELOC_C33_DL:
- + case BFD_RELOC_C33_GL:
- + case BFD_RELOC_C33_SH:
- + case BFD_RELOC_C33_SL:
- + case BFD_RELOC_C33_TH:
- + case BFD_RELOC_C33_TL:
- + case BFD_RELOC_C33_ZH:
- + case BFD_RELOC_C33_ZL:
- + case BFD_RELOC_C33_DPH:
- + case BFD_RELOC_C33_DPM:
- + case BFD_RELOC_C33_DPL:
- + case BFD_RELOC_C33_LOOP:
- + /* <<<< add 2002.03.05 tazaki */
- + case BFD_RELOC_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
- + case BFD_RELOC_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
- + case BFD_RELOC_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
- + fixP->fx_no_overflow = 1;
- + break;
- + default:
- + break;
- + }
- + }
- + }
- + }
- + else
- + {
- + fix_new_exp (
- + frag_now,
- + f - frag_now->fr_literal, 4,
- + & fixups[i].exp,
- + 1 /* FIXME: C33_OPERAND_RELATIVE ??? */,
- + (bfd_reloc_code_real_type) (fixups[i].opindex
- + + (int) BFD_RELOC_UNUSED)
- + );
- + }
- + }
- +
- + input_line_pointer = saved_input_line_pointer;
- +}
- +
- +
- +/* If while processing a fixup, a reloc really needs to be created */
- +/* then it is done here. */
- +
- +arelent *
- +tc_gen_reloc (seg, fixp)
- + asection * seg;
- + fixS * fixp;
- +{
- + arelent * reloc;
- +
- + reloc = (arelent *) xmalloc (sizeof (arelent));
- + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
- + *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
- + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- +
- + if (reloc->howto == (reloc_howto_type *) NULL)
- + {
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + /* xgettext:c-format */
- + _("reloc %d not supported by object file format"),
- + (int) fixp->fx_r_type);
- +
- + xfree (reloc);
- +
- + return NULL;
- + }
- +
- + reloc->addend = fixp->fx_addnumber;
- +
- + return reloc;
- +}
- +
- +/* Assume everything will fit in two bytes, then expand as necessary. */
- +int
- +md_estimate_size_before_relax (fragp, seg)
- + fragS * fragp;
- + asection * seg;
- +{
- + if (fragp->fr_subtype == 0)
- + fragp->fr_var = 4;
- + else if (fragp->fr_subtype == 2)
- + fragp->fr_var = 2;
- + else
- + abort ();
- + return 2;
- +}
- +
- +long
- +c33_pcrel_from_section (fixp, section)
- + fixS * fixp;
- + segT section;
- +{
- + /* If the symbol is undefined, or in a section other than our own,
- + or it is weak (in which case it may well be in another section,
- + then let the linker figure it out. */
- + if (fixp->fx_addsy != (symbolS *) NULL
- + && (! S_IS_DEFINED (fixp->fx_addsy)
- + || S_IS_WEAK (fixp->fx_addsy)
- + || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
- + return 0;
- +
- + return fixp->fx_frag->fr_address + fixp->fx_where;
- +}
- +
- +/*
- +The symbol which can be decided inside a file is decided here.
- +
- +The tc_gen_reloc function which is in bfd library further is passed,
- + and, finally the symbol changed by referring to the exterior, the link,
- + and relocation is on HOWTO broad view of bfd.
- + It is processed by the defined method.
- +*/
- +
- +/* add T.Tazaki 2002.04.25 >>> */
- +long g_where_rh = 0xffffffff;
- +long g_where_rm = 0xffffffff;
- +
- +char *g_pwhere_rh = 0;
- +char *g_pwhere_rm = 0;
- +
- +/* add T.Tazaki 2002.04.25 <<< */
- +
- +int
- +md_apply_fix3 (fixp, valuep, seg)
- + fixS * fixp;
- + valueT * valuep;
- + segT seg;
- +{
- + valueT value;
- + char * where;
- + long insn;
- + int iNumber; /* add T.Tazaki 2002.04.25 */
- + long lNumber; /* add T.Tazaki 2002.04.25 */
- +
- + if (fixp->fx_addsy == (symbolS *) NULL)
- + {
- + value = * valuep;
- + fixp->fx_done = 1;
- + }
- + else if (fixp->fx_pcrel)
- + value = * valuep;
- + else
- + {
- + value = fixp->fx_offset;
- + if (fixp->fx_subsy != (symbolS *) NULL)
- + {
- + if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- + value -= S_GET_VALUE (fixp->fx_subsy);
- + else
- + {
- + /* We don't actually support subtracting a symbol. */
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + _("expression too complex"));
- + }
- + }
- + }
- +
- + if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
- + {
- + int opindex;
- + const struct c33_operand * operand;
- + unsigned long insn;
- +
- + opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
- + operand = & c33_operands[ opindex ];
- +
- + /* Fetch the instruction, insert the fully resolved operand
- + value, and stuff the instruction back again.
- +
- + Note the instruction has been stored in little endian
- + format! */
- + where = fixp->fx_frag->fr_literal + fixp->fx_where;
- +
- + insn = bfd_getl16 ((unsigned char *) where);
- + insn = c33_insert_operand (insn, operand, (offsetT) value,
- + fixp->fx_file, fixp->fx_line, NULL);
- + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
- +
- + if (fixp->fx_done)
- + {
- + /* Nothing else to do here. */
- + return 1;
- + }
- + }
- + else if (fixp->fx_done)
- + {
- + /* We still have to insert the value into memory! */
- + where = fixp->fx_frag->fr_literal + fixp->fx_where;
- +
- + if (fixp->fx_size == 1)
- + * where = value & 0xff;
- + else if (fixp->fx_size == 2){
- +
- + /* An address when a symbol is decided is buried here
- + and crowded with the inside of a file. */
- +
- + /* A command code is acquired. */
- + insn = bfd_getl16 ((unsigned char *) where);
- +
- + switch (fixp->fx_r_type)
- + {
- + case BFD_RELOC_C33_AH: /* @ah (25:13) */ /* NO USE : Absolute symbol */
- +
- + insn += ((value >> 13) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_AL: /* @ah (12:0) */ /* NO USE : Absolute symbol */
- + insn += (value & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_RH: /* LABEL-PC(31:22) */
- +// if( g_listing == 0 ){ /* No -a option ? */
- +// g_where_rh = fixp->fx_where;
- +// }
- +// else{
- +// g_pwhere_rh = where;
- +// }
- +//
- + insn += (((value - 4) >> 19) & 0x1ff8);
- + break;
- +
- + case BFD_RELOC_C33_RM: /* LABEL-PC(21:9) */
- +
- +// if( g_listing == 0 ){ /* No -a option ? */
- +//
- +// g_where_rm = fixp->fx_where;
- +// if( g_where_rh != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
- +//
- +// lNumber = value;
- +// /* over signed 22bit ? */
- +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_where_rh = 0xffffffff;
- +// }
- +// else
- +// {
- +// g_pwhere_rm = where;
- +// if( g_pwhere_rh != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
- +//
- +// lNumber = value;
- +// /* over signed 22bit ? */
- +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_pwhere_rh = 0;
- +// }
- + insn += (((value - 2) >> 9) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_RL: /* LABEL-PC(8:0) */
- +
- +// -al オプション付きのとき、where値が必ずしも@rm のPC+100とは限らないため、不採用。
- +// -al無し( fixp->fx_where )ではOKだが、-alの有無でワーニング表示が異なるのは変なので両方削除した。
- +
- +// if( g_listing == 0 ){ /* No -a option ? */
- +//
- +// if( g_where_rm != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
- +//
- +// lNumber = value;
- +// /* over signed 8bit ? */
- +// if (lNumber > 254 || lNumber < -256)
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_where_rh = 0xffffffff;
- +// g_where_rm = 0xffffffff;
- +// }
- +// else
- +// {
- +//
- +// if( g_pwhere_rm != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
- +//
- +// lNumber = value;
- +// /* over signed 8bit ? */
- +// if (lNumber > 254 || lNumber < -256)
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_pwhere_rh = 0;
- +// g_pwhere_rm = 0;
- +// }
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- +/* add T.Tazaki 2002.05.02 >>> */
- +
- + case BFD_RELOC_C33_S_RH: /* LABEL-PC(31:22) */ /* sjp,scall, xjp,xcall */
- + g_where_rh = fixp->fx_where;
- +
- + insn += (((value - 4) >> 19) & 0x1ff8);
- + break;
- +
- + case BFD_RELOC_C33_S_RM: /* LABEL-PC(21:9) */ /* sjp,scall, xjp,xcall */
- +
- + g_where_rm = fixp->fx_where;
- + if( g_where_rh != ( fixp->fx_where - 2 ) ){
- +
- + lNumber = value;
- + /* over signed 22bit ? */
- + if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- + /* as_bad_where = ERROR */
- + }
- + g_where_rh = 0xffffffff;
- + insn += (((value - 2) >> 9) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_S_RL: /* LABEL-PC(8:0) */ /* sjp,scall, xjp,xcall */
- +
- + if( g_where_rm != ( fixp->fx_where - 2 ) ){
- +
- + lNumber = value;
- + /* over signed 8bit ? */
- + if (lNumber > 254 || lNumber < -256)
- + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- + /* as_bad_where = ERROR */
- + }
- + g_where_rh = 0xffffffff;
- + g_where_rm = 0xffffffff;
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- +/* add T.Tazaki 2002.05.02 <<< */
- +
- + case BFD_RELOC_C33_JP: /* LABEL-PC(8:0) */ /* add T.Tazaki 2002.04.22 */
- + /* jp label */
- +
- + /* over signed 8bit ? */
- + iNumber = value;
- +
- + if (iNumber > 254 || iNumber < -256)
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- + case BFD_RELOC_C33_H: /* LABEL(31:19) */ /* NO USE : Absolute symbol */
- + insn += ((value >> 19) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_M: /* LABEL(18:6) */ /* NO USE : Absolute symbol */
- + insn += ((value >> 6) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_L: /* LABEL(5:0) */ /* NO USE : Absolute symbol */
- + /* ld.w rd,LABEL@l */
- + insn += (value & 0x3f) << 4;
- + break;
- +
- + case BFD_RELOC_C33_LOOP: /* LABEL-PC(4:0) */
- +
- + /* over imm 5bit ? */
- + iNumber = value;
- +
- + if (iNumber > 30 || iNumber < 0)
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +
- + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
- + /* " nop " */
- + /* " nop " */
- + /* "Label: " */
- +
- + --value;
- +
- + /* add T.Tazaki 2004/09/22 <<< */
- +
- + /* imm5=imm(4:1) imm5(0)=0 */
- + insn += (value & 0x1e) << 3;
- + break;
- +
- + default:
- + break;
- + }
- +
- + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
- + }
- + else if (fixp->fx_size == 4)
- + bfd_putl32 (value, (unsigned char *) where);
- + }
- +
- + fixp->fx_addnumber = value;
- +
- + return 1;
- +}
- +
- +
- +/* Parse a cons expression. */
- +void
- +parse_cons_expression_c33 (exp)
- + expressionS * exp;
- +{
- + /* See if there's a reloc prefix like hi() we have to handle. */
- + hold_cons_reloc = c33_reloc_prefix ();
- +
- + /* Do normal expression parsing. */
- + expression (exp);
- +}
- +
- +/* Create a fixup for a cons expression. If parse_cons_expression_c33
- + found a reloc prefix, then we use that reloc, else we choose an
- + appropriate one based on the size of the expression. */
- +void
- +cons_fix_new_c33 (frag, where, size, exp)
- + fragS * frag;
- + int where;
- + int size;
- + expressionS *exp;
- +{
- + if (hold_cons_reloc == BFD_RELOC_UNUSED)
- + {
- + if (size == 4)
- + hold_cons_reloc = BFD_RELOC_32;
- + if (size == 2)
- + hold_cons_reloc = BFD_RELOC_16;
- + if (size == 1)
- + hold_cons_reloc = BFD_RELOC_8;
- + }
- +
- + if (exp != NULL)
- + fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc);
- + else
- + fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
- +}
- +
- +boolean
- +c33_fix_adjustable (fixP)
- + fixS * fixP;
- +{
- + if (fixP->fx_addsy == NULL)
- + return 1;
- +
- + /* Prevent all adjustments to global symbols. */
- + if (S_IS_EXTERN (fixP->fx_addsy))
- + return 0;
- +
- + if (S_IS_WEAK (fixP->fx_addsy))
- + return 0;
- +
- + /* Don't adjust function names */
- + if (S_IS_FUNCTION (fixP->fx_addsy))
- + return 0;
- +
- + return 1;
- +}
- +
- +int
- +c33_force_relocation (fixP)
- + struct fix * fixP;
- +{
- + if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
- + return 1;
- +
- + return 0;
- +}
- diff --git a/gas/config/tc-c33.c b/gas/config/tc-c33.c
- new file mode 100644
- index 0000000..3dd3b44
- --- /dev/null
- +++ b/gas/config/tc-c33.c
- @@ -0,0 +1,5098 @@
- +/* tc-c33.c -- Assembler code for the EPSON EOC33
- + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
- +
- + This file is part of GAS, the GNU Assembler.
- +
- + GAS is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2, or (at your option)
- + any later version.
- +
- + GAS is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with GAS; see the file COPYING. If not, write to
- + the Free Software Foundation, 59 Temple Place - Suite 330,
- + Boston, MA 02111-1307, USA. */
- +
- +#include <stdio.h>
- +#include <ctype.h>
- +#include "as.h"
- +#include "subsegs.h"
- +#include "opcode/c33.h"
- +#include "ext_remove.h" // add D.Fujimoto 2007/06/21
- +
- +#define AREA_CDA 0
- +#define AREA_GDA 1
- +#define AREA_ZDA 2
- +#define AREA_SDA 3
- +#define AREA_TDA 4
- +#define AREA_LCDA 5
- +#define AREA_LGDA 6
- +#define AREA_LZDA 7
- +#define AREA_LSDA 8
- +#define AREA_LTDA 9
- +
- +
- +#define O_spregister O_md1 /* for c33 %sp */
- +#define O_dpregister O_md2 /* for c33 %dp */
- +#define O_cond O_md3 /* for c33 ext cond */
- +#define O_op_shift O_md4 /* for c33 ext OP */
- +
- +#define SGP_REG 12 /* GP register */
- +#define TGP_REG 13 /* GP register */
- +#define ZGP_REG 14 /* GP register */
- +#define GP_REG 15 /* GP register */
- +
- +/* Temporarily holds the reloc in a cons expression. */
- +static bfd_reloc_code_real_type hold_cons_reloc;
- +
- +
- +
- +/* Structure to hold information about predefined registers. */
- +struct reg_name
- +{
- + const char * name;
- + int value;
- +};
- +
- +/* Generic assembler global variables which must be defined by all targets. */
- +
- +/* Characters which always start a comment. */
- +const char comment_chars[] = ";";
- +
- +/* Characters which start a comment at the beginning of a line. */
- +const char line_comment_chars[] = "";
- +
- +/* Characters which may be used to separate multiple commands on a
- + single line. */
- +const char line_separator_chars[] = "";
- +
- +/* Characters which are used to indicate an exponent in a floating
- + point number. */
- +const char EXP_CHARS[] = "eE";
- +
- +/* Characters which mean that a number is a floating point constant,
- + as in 0d1.0. */
- +const char FLT_CHARS[] = "dD";
- +
- +
- +const relax_typeS md_relax_table[] =
- +{
- + /* Conditional branches. */
- + {0xff, -0x100, 2, 1},
- + {0x1fffff, -0x200000, 6, 0},
- + /* Unconditional branches. */
- + {0xff, -0x100, 2, 3},
- + {0x1fffff, -0x200000, 4, 0},
- +};
- +
- +/* add tazaki 2001.12.03 */
- +static segT comm_section = NULL;
- +static segT gcomm_section = NULL;
- +static segT scomm_section = NULL;
- +static segT tcomm_section = NULL;
- +static segT zcomm_section = NULL;
- +static segT gbss_section = NULL;
- +static segT sbss_section = NULL;
- +static segT tbss_section = NULL;
- +static segT zbss_section = NULL;
- +/* add tazaki 2001.12.03 */
- +
- +/* add T.Tazaki 2002.04.26 >>> */
- +extern int g_listing;
- +/* add T.Tazaki 2002.04.26 <<< */
- +
- +/* fixups */
- +#define MAX_INSN_FIXUPS (5)
- +struct c33_fixup
- +{
- + expressionS exp;
- + int opindex;
- + bfd_reloc_code_real_type reloc;
- +};
- +
- +struct c33_fixup fixups [MAX_INSN_FIXUPS];
- +static int fc;
- +
- +
- +
- +/******************************************************************************
- + INPUT int area of symbol
- + RETURN void
- + Explanation assembler false instruction(.gcomm/.scomm/.tcomm/.zcomm) Evaluation
- +******************************************************************************/
- +/* Copied from obj_elf_common() in gas/config/obj-elf.c */
- +static void
- +c33_comm (area)
- + int area;
- +{
- + char * name;
- + char c;
- + char * p;
- + int temp;
- + int size;
- + symbolS * symbolP;
- + int have_align;
- + char * pfrag;
- +
- + name = input_line_pointer;
- + c = get_symbol_end ();
- +
- + /* just after name is now '\0' */
- + p = input_line_pointer;
- + *p = c;
- +
- + /* skip space */
- + SKIP_WHITESPACE ();
- +
- + /* Is the character after ".comm" a pause character? */
- + if (*input_line_pointer != ',')
- + {
- + as_bad (_("Expected comma after symbol-name"));
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + input_line_pointer ++; /* skip ',' */
- +
- + if ((temp = get_absolute_expression ()) < 0)
- + {
- + /* xgettext:c-format */
- + as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp);
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + size = temp;
- + *p = 0;
- + symbolP = symbol_find_or_make (name);
- + *p = c;
- +
- +/* if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) */
- + if (S_IS_DEFINED (symbolP) )
- + {
- + as_bad (_("Ignoring attempt to re-define symbol"));
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + if (S_GET_VALUE (symbolP) != 0)
- + {
- + if (S_GET_VALUE (symbolP) != size)
- + {
- + /* xgettext:c-format */
- + as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
- + S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
- + }
- + }
- +
- + know (symbol_get_frag (symbolP) == & zero_address_frag);
- +
- + if (*input_line_pointer != ',')
- + have_align = 0;
- + else
- + {
- + have_align = 1;
- + input_line_pointer++;
- + SKIP_WHITESPACE ();
- + }
- +
- + if (! have_align || *input_line_pointer != '"')
- + {
- + if (! have_align)
- + temp = 0;
- + else
- + {
- + temp = get_absolute_expression ();
- +
- + if (temp < 0)
- + {
- + temp = 0;
- + as_warn (_("Common alignment negative; 0 assumed"));
- + }
- + }
- +
- +
- +/* if (symbol_get_obj (symbolP)->local)*/
- + if (!(area == AREA_CDA || area == AREA_GDA || area == AREA_SDA || area == AREA_TDA || area == AREA_ZDA ))
- + {
- + /* NOT EXIST ROUTINE */
- +
- + segT old_sec;
- + int old_subsec;
- + int align;
- + flagword applicable;
- +
- + old_sec = now_seg;
- + old_subsec = now_subseg;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + applicable &= SEC_ALLOC;
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (comm_section == NULL)
- + {
- +
- + comm_section = subseg_new (".comm", 0);
- +
- + bfd_set_section_flags (stdoutput, comm_section, applicable);
- +
- + seg_info (comm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_GDA:
- + if (gcomm_section == NULL)
- + {
- + gcomm_section = subseg_new (".gcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, gcomm_section, applicable);
- +
- + seg_info (gcomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_SDA:
- + if (scomm_section == NULL)
- + {
- + scomm_section = subseg_new (".scomm", 0);
- +
- + bfd_set_section_flags (stdoutput, scomm_section, applicable);
- +
- + seg_info (scomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_TDA:
- + if (tcomm_section == NULL)
- + {
- + tcomm_section = subseg_new (".tcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, tcomm_section, applicable);
- +
- + seg_info (tcomm_section)->bss = 1;
- + }
- + break;
- +
- + case AREA_ZDA:
- + if (zcomm_section == NULL)
- + {
- + zcomm_section = subseg_new (".zcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, zcomm_section, applicable);
- +
- + seg_info (zcomm_section)->bss = 1;
- + }
- + break;
- +
- + }
- +
- + if (temp)
- + {
- + /* convert to a power of 2 alignment */
- + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
- + ;
- +
- + if (temp != 1)
- + {
- + as_bad (_("Common alignment not a power of 2"));
- + ignore_rest_of_line ();
- + return;
- + }
- + }
- + else
- + align = 0;
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + record_alignment (comm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (comm_section, 0);
- + break;
- +
- + case AREA_GDA:
- + record_alignment (gcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (gcomm_section, 0);
- + break;
- +
- + case AREA_SDA:
- + record_alignment (scomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (scomm_section, 0);
- + break;
- +
- + case AREA_TDA:
- + record_alignment (tcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (tcomm_section, 0);
- + break;
- +
- + case AREA_ZDA:
- + record_alignment (zcomm_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (zcomm_section, 0);
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (S_GET_SEGMENT (symbolP) == comm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_GDA:
- + if (S_GET_SEGMENT (symbolP) == gcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_SDA:
- + if (S_GET_SEGMENT (symbolP) == scomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_TDA:
- + if (S_GET_SEGMENT (symbolP) == tcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + case AREA_ZDA:
- + if (S_GET_SEGMENT (symbolP) == zcomm_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- + break;
- +
- + default:
- + abort ();
- + }
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + S_SET_SEGMENT (symbolP, comm_section);
- + break;
- +
- + case AREA_GDA:
- + S_SET_SEGMENT (symbolP, gcomm_section);
- + break;
- +
- + case AREA_SDA:
- + S_SET_SEGMENT (symbolP, scomm_section);
- + break;
- +
- + case AREA_TDA:
- + S_SET_SEGMENT (symbolP, tcomm_section);
- + break;
- +
- + case AREA_ZDA:
- + S_SET_SEGMENT (symbolP, zcomm_section);
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (symbol_get_obj (symbolP)->local)
- + S_CLEAR_EXTERNAL (symbolP);
- + else
- + S_SET_EXTERNAL (symbolP);
- +
- + obj_elf_section_change_hook();
- + subseg_set (old_sec, old_subsec);
- + }
- + else
- + {
- + /*==========================================================================*/
- + /* Evaluation of .comm */
- + /*==========================================================================*/
- + segT old_sec;
- + int old_subsec;
- + int align;
- + int i_now_align; /* add 2002.01.21 */
- + i_now_align = temp; /* add 2002.01.21 */
- +
- + /* computing of alignment */
- + if (temp)
- + {
- + /* convert to a power of 2 alignment */
- + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
- + ;
- +
- + if (temp != 1)
- + {
- + as_bad (_("Common alignment not a power of 2"));
- + ignore_rest_of_line ();
- + return;
- + }
- + }
- + else
- + align = 0;
- +
- + old_sec = now_seg;
- + old_subsec = now_subseg;
- +
- + allocate_common:
- +
- + /* Convert .local + .xcomm to local section. */
- +
- + if (symbol_get_obj (symbolP)->local){
- + switch (area)
- + {
- + case AREA_CDA:
- + area = AREA_LCDA;
- + break;
- + case AREA_GDA:
- + area = AREA_LGDA;
- + break;
- + case AREA_SDA:
- + area = AREA_LSDA;
- + break;
- + case AREA_TDA:
- + area = AREA_LTDA;
- + break;
- + case AREA_ZDA:
- + area = AREA_LZDA;
- + break;
- + }
- + }
- +
- + switch (area)
- + {
- + case AREA_CDA:
- + if (comm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + comm_section = subseg_new (".comm", 0);
- +
- + bfd_set_section_flags (stdoutput, comm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, comm_section);
- + record_alignment (comm_section, align);
- +
- + break;
- +
- + case AREA_GDA:
- + if (gcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + gcomm_section = subseg_new (".gcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, gcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, gcomm_section);
- + record_alignment (gcomm_section, align);
- + break;
- +
- + case AREA_SDA:
- + if (scomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + scomm_section = subseg_new (".scomm", 0);
- +
- + bfd_set_section_flags (stdoutput, scomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, scomm_section);
- + record_alignment (scomm_section, align);
- + break;
- +
- + case AREA_TDA:
- + if (tcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + tcomm_section = subseg_new (".tcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, tcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, tcomm_section);
- + record_alignment (tcomm_section, align);
- + break;
- +
- + case AREA_ZDA:
- + if (zcomm_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + zcomm_section = subseg_new (".zcomm", 0);
- +
- + bfd_set_section_flags (stdoutput, zcomm_section, applicable
- + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
- + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
- + }
- + S_SET_SEGMENT (symbolP, zcomm_section);
- + record_alignment (zcomm_section, align);
- + break;
- +
- +
- + case AREA_LCDA:
- + /* Convert local comm to .bss section. */
- + obj_elf_section_change_hook();
- + subseg_set (bss_section, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == bss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- +
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, bss_section);
- + record_alignment (bss_section, align);
- +
- + break;
- +
- + case AREA_LGDA:
- + if (gbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + gbss_section = subseg_new (".gbss", 0);
- +
- + bfd_set_section_flags (stdoutput, gbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (gbss_section)->bss = 1;
- + }
- +
- + record_alignment (gbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (gbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == gbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, gbss_section);
- +
- + break;
- +
- + case AREA_LSDA:
- + if (sbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + sbss_section = subseg_new (".sbss", 0);
- +
- + bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (sbss_section)->bss = 1;
- + }
- +
- + record_alignment (sbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (sbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == sbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, sbss_section);
- +
- + break;
- +
- + case AREA_LTDA:
- + if (tbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + tbss_section = subseg_new (".tbss", 0);
- +
- + bfd_set_section_flags (stdoutput, tbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (tbss_section)->bss = 1;
- + }
- +
- + record_alignment (tbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (tbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == tbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, tbss_section);
- +
- + break;
- +
- + case AREA_LZDA:
- + if (zbss_section == NULL)
- + {
- + flagword applicable;
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +
- + zbss_section = subseg_new (".zbss", 0);
- +
- + bfd_set_section_flags (stdoutput, zbss_section, applicable & SEC_ALLOC);
- +
- + seg_info (zbss_section)->bss = 1;
- + }
- +
- + record_alignment (zbss_section, align);
- + obj_elf_section_change_hook();
- + subseg_set (zbss_section, 0);
- +
- + if (align)
- + frag_align (align, 0, 0);
- +
- + if (S_GET_SEGMENT (symbolP) == zbss_section)
- + symbol_get_frag (symbolP)->fr_symbol = 0;
- +
- + symbol_set_frag (symbolP, frag_now);
- + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
- + (offsetT) size, (char *) 0);
- + *pfrag = 0;
- + S_SET_SIZE (symbolP, size);
- + S_SET_SEGMENT (symbolP, zbss_section);
- +
- + break;
- +
- + default:
- + abort();
- + }
- +
- + if (area == AREA_LCDA || area == AREA_LGDA || area == AREA_LSDA || area == AREA_LTDA || area == AREA_LZDA) /* ローカル? */
- + {
- + S_CLEAR_EXTERNAL (symbolP);
- + }else{
- + S_SET_VALUE (symbolP, (valueT) size);
- +// S_SET_ALIGN (symbolP, temp);
- + if( i_now_align )
- + S_SET_ALIGN (symbolP, i_now_align);
- + S_SET_EXTERNAL (symbolP);
- + }
- +
- + obj_elf_section_change_hook();
- + subseg_set (old_sec, old_subsec);
- +
- + }
- +}
- + else
- + {
- + input_line_pointer++;
- + /* @@ Some use the dot, some don't. Can we get some consistency?? */
- + if (*input_line_pointer == '.')
- + input_line_pointer++;
- + /* @@ Some say data, some say bss. */
- + if (strncmp (input_line_pointer, "bss\"", 4)
- + && strncmp (input_line_pointer, "data\"", 5))
- + {
- + while (*--input_line_pointer != '"')
- + ;
- + input_line_pointer--;
- + goto bad_common_segment;
- + }
- + while (*input_line_pointer++ != '"')
- + ;
- + goto allocate_common;
- + }
- +
- + symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
- +
- + demand_empty_rest_of_line ();
- + return;
- +
- + {
- + bad_common_segment:
- + p = input_line_pointer;
- + while (*p && *p != '\n')
- + p++;
- + c = *p;
- + *p = '\0';
- + as_bad (_("bad .common segment %s"), input_line_pointer + 1);
- + *p = c;
- + input_line_pointer = p;
- + ignore_rest_of_line ();
- + return;
- + }
- +}
- +
- +/* The target specific pseudo-ops which we support. */
- +const pseudo_typeS md_pseudo_table[] =
- +{
- + {"comm", c33_comm, AREA_CDA},
- + {"gcomm", c33_comm, AREA_GDA},
- + {"scomm", c33_comm, AREA_SDA},
- + {"tcomm", c33_comm, AREA_TDA},
- + {"zcomm", c33_comm, AREA_ZDA},
- + { NULL, NULL, 0}
- +};
- +
- +/*****************************************************************************/
- +
- +
- +
- +/* Opcode hash table. */
- +static struct hash_control *c33_hash;
- +
- +/* This table is sorted. Suitable for searching by a binary search. */
- +static const struct reg_name pre_defined_registers[] =
- +{
- + { "%r0", 0 },
- + { "%r1", 1 },
- + { "%r10", 10 },
- + { "%r11", 11 },
- + { "%r12", 12 },
- + { "%r13", 13 },
- + { "%r14", 14 },
- + { "%r15", 15 },
- + { "%r2", 2 },
- + { "%r3", 3 },
- + { "%r4", 4 },
- + { "%r5", 5 },
- + { "%r6", 6 },
- + { "%r7", 7 },
- + { "%r8", 8 },
- + { "%r9", 9 },
- +};
- +#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct reg_name))
- +
- +/* standard macro spesial registers */
- +static const struct reg_name system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%psr", 0 },
- + { "%sp", 1 },
- +};
- +
- +/* advanced macro spesial registers */
- +static const struct reg_name adv_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%pc", 15},
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* ld.w %sd,%rs special registers */
- +static const struct reg_name adv_load_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* pushs , pops special registers */
- +static const struct reg_name adv_pushs_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%dp", 9 }, /* Adv */
- + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
- + { "%lco", 4 }, /* Adv */
- + { "%lea", 6 }, /* Adv */
- + { "%lsa", 5 }, /* Adv */
- + { "%pc", 15 },
- + { "%psr", 0 },
- + { "%sor", 7 }, /* Adv */
- + { "%sp", 1 },
- + { "%ssp", 14 }, /* Adv */
- + { "%ttbr", 8 }, /* Adv */
- + { "%usp", 13 }, /* Adv */
- +};
- +
- +/* PE add T.Tazaki 2003/11/18 >>> */
- +
- +/* PE macro spesial registers */
- +static const struct reg_name pe_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%dbbr", 11 },
- + { "%idir", 10 },
- + { "%pc", 15},
- + { "%psr", 0 },
- + { "%sp", 1 },
- + { "%ttbr", 8 },
- +};
- +
- +/* ld.w %sd,%rs special registers */
- +static const struct reg_name pe_load_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- + { "%psr", 0 },
- + { "%sp", 1 },
- + { "%ttbr", 8 },
- +};
- +
- +/* pushs , pops special registers */
- +static const struct reg_name pe_pushs_system_registers[] =
- +{
- + { "%ahr", 3 },
- + { "%alr", 2 },
- +};
- +
- +/* PE add T.Tazaki 2003/11/18 <<< */
- +
- +#define SYSREG_NAME_CNT (sizeof (system_registers) / sizeof (struct reg_name))
- +#define ADV_SYSREG_NAME_CNT (sizeof (adv_system_registers) / sizeof (struct reg_name))
- +#define ADV_LOAD_SYSREG_NAME_CNT (sizeof (adv_load_system_registers) / sizeof (struct reg_name))
- +#define ADV_PUSHS_SYSREG_NAME_CNT (sizeof (adv_pushs_system_registers) / sizeof (struct reg_name))
- +
- +/* PE add T.Tazaki 2003/11/18 >>> */
- +#define PE_SYSREG_NAME_CNT (sizeof (pe_system_registers) / sizeof (struct reg_name))
- +#define PE_LOAD_SYSREG_NAME_CNT (sizeof (pe_load_system_registers) / sizeof (struct reg_name))
- +#define PE_PUSHS_SYSREG_NAME_CNT (sizeof (pe_pushs_system_registers) / sizeof (struct reg_name))
- +/* PE add T.Tazaki 2003/11/18 <<< */
- +
- +/******************************************************************************
- + INPUT const struct reg_name * register name
- + int register string size
- + const char * check register string
- + boolean not used
- + RETURN int register number
- + Explanation Get register number
- +******************************************************************************/
- +/* reg_name_search does a binary search of the given register table
- + to see if "name" is a valid regiter name. Returns the register
- + number from the array on success, or -1 on failure. */
- +
- +static int
- +reg_name_search (regs, regcount, name, accept_numbers)
- + const struct reg_name * regs;
- + int regcount;
- + const char * name;
- + boolean accept_numbers;
- +{
- + int middle, low, high;
- + int cmp;
- + symbolS * symbolP;
- +#if 0
- + /* If the register name is a symbol, then evaluate it. */
- + if ((symbolP = symbol_find (name)) != NULL)
- + {
- + /* If the symbol is an alias for another name then use that.
- + If the symbol is an alias for a number, then return the number. */
- + if (symbol_equated_p (symbolP))
- + {
- + name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
- + }
- + else if (accept_numbers)
- + {
- + int reg = S_GET_VALUE (symbolP);
- +
- + if (reg >= 0 && reg <= 31)
- + return reg;
- + }
- +#endif
- +
- + low = 0;
- + high = regcount - 1;
- +
- + do
- + {
- + middle = (low + high) / 2;
- + cmp = strcasecmp (name, regs[middle].name);
- + if (cmp < 0)
- + high = middle - 1;
- + else if (cmp > 0)
- + low = middle + 1;
- + else
- + return regs[middle].value;
- + }
- + while (low <= high);
- +
- + return -1;
- +}
- +
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A register operand is changed into a command code.
- +******************************************************************************/
- +/* Summary of register_name().
- + *
- + * in: Input_line_pointer points to 1st char of operand.
- + *
- + * out: A expressionS.
- + * The operand may have been a register: in this case, X_op == O_register,
- + * X_add_number is set to the register number, and truth is returned.
- + * Input_line_pointer->(next non-blank) char after operand, or is in
- + * its original state.
- + */
- +static boolean
- +register_name (expressionP)
- + expressionS * expressionP;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- + char *pNameEnd;
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* Get register number */
- + reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
- + name, FALSE);
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + /* YES The right register number was acquirable. */
- +
- + /* That it is a register and a register number are saved. */
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* 不正 */
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- +******************************************************************************/
- +/* Summary of system_register_name().
- + *
- + * in: Input_line_pointer points to 1st char of operand.
- + * expressionP points to an expression structure to be filled in.
- + * accept_numbers is true iff numerical register names may be used.
- + * accept_list_names is true iff the special names PS and SR may be
- + * accepted.
- + *
- + * out: A expressionS structure in expressionP.
- + * The operand may have been a register: in this case, X_op == O_register,
- + * X_add_number is set to the register number, and truth is returned.
- + * Input_line_pointer->(next non-blank) char after operand, or is in
- + * its original state.
- + */
- +static boolean
- +system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE */ /* add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_system_registers, PE_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* add tazaki 2001.11.12 */
- + /* ADV */
- + reg_number = reg_name_search (adv_system_registers, ADV_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- +#if 0
- + if (reg_number < 0 && accept_numbers)
- + {
- + input_line_pointer = start; /* reset input_line pointer */
- +
- + if (isdigit (* input_line_pointer))
- + {
- + reg_number = strtol (input_line_pointer, & input_line_pointer, 10);
- +
- + /* Make sure that the register number is allowable. */
- + if ( reg_number < 0
- + || reg_number > 5
- + && reg_number < 16
- + || reg_number > 20
- + )
- + {
- + reg_number = -1;
- + }
- + }
- + else if (accept_list_names)
- + {
- + c = get_symbol_end ();
- +
- +#if 0 /* c33 */
- + reg_number = reg_name_search (system_list_registers,
- + SYSREGLIST_NAME_CNT, name, FALSE);
- +#endif
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + }
- + }
- +#endif
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +
- +CONST char * md_shortopts = "m:";
- +
- +struct option md_longopts[] =
- +{
- + {NULL, no_argument, NULL, 0}
- +};
- +size_t md_longopts_size = sizeof md_longopts;
- +
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- + false : ld.w %pc,%rs
- +******************************************************************************/
- +static boolean
- +load_system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_load_system_registers, PE_LOAD_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* ADV */
- + reg_number = reg_name_search (adv_load_system_registers, ADV_LOAD_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +/******************************************************************************
- + INPUT expressionS * The pointer to a command code information structure object
- + boolean
- + boolean
- + RETURN boolean TRUE ok
- + FALSE error
- + Explanation A system register operand is changed into a command code.
- + true : pushs %psr,%sp,%alr,%ahr,%lco,%lsa,%lea,%sor,%ttbr,%dp,%usp,%ssp,%pc
- +******************************************************************************/
- +static boolean
- +pushs_system_register_name (expressionP, accept_numbers, accept_list_names)
- + expressionS * expressionP;
- + boolean accept_numbers;
- + boolean accept_list_names;
- +{
- + int reg_number;
- + char * name;
- + char * start;
- + char c;
- +
- +
- + /* Find the spelling of the operand */
- + start = name = input_line_pointer;
- +
- + c = get_symbol_end ();
- +
- + /* get register number */
- + if( g_iAdvance == 0 )
- + {
- + if( g_iPE == 0 )
- + {
- + /* STD */
- + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + else
- + {
- + /* PE add T.Tazaki 2003/11/18 */
- + reg_number = reg_name_search (pe_pushs_system_registers, PE_PUSHS_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- + }else{
- + /* ADV */
- + reg_number = reg_name_search (adv_pushs_system_registers, ADV_PUSHS_SYSREG_NAME_CNT, name,
- + accept_numbers);
- + }
- +
- + * input_line_pointer = c; /* put back the delimiting char */
- +
- + /* look to see if it's in the register table */
- + if (reg_number >= 0)
- + {
- + expressionP->X_op = O_register;
- + expressionP->X_add_number = reg_number;
- +
- + /* make the rest nice */
- + expressionP->X_add_symbol = NULL;
- + expressionP->X_op_symbol = NULL;
- +
- + return true;
- + }
- + else
- + {
- + /* reset the line as if we had not done anything */
- + input_line_pointer = start;
- +
- + return false;
- + }
- +}
- +
- +/******************************************************************************
- + INPUT FILE* not used
- + RETURN void
- + Explanation display option
- +******************************************************************************/
- +void
- +md_show_usage (stream)
- + FILE * stream;
- +{
- + /* The special option for c33 is nothing. */
- +}
- +
- +/******************************************************************************
- + INPUT int not used
- + char* not used
- + RETURN int TRUE ok
- + Explanation Argument (option) analysis
- +******************************************************************************/
- +int
- +md_parse_option (c, arg)
- + int c;
- + char * arg;
- +{
- +#if 0
- + int Num;
- + int i;
- + if (c != 'm')
- + {
- + /* xgettext:c-format */
- + fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg);
- + return 0;
- + }
- +
- +#endif
- + return 1;
- +}
- +
- +/******************************************************************************
- + INPUT char* not used
- + RETURN symbolS* NULL
- + Explanation Treatment of the symbol which is not defined
- +******************************************************************************/
- +symbolS *
- +md_undefined_symbol (name)
- + char * name;
- +{
- + return 0;
- +}
- +
- +char *
- +md_atof (type, litp, sizep)
- + int type;
- + char * litp;
- + int * sizep;
- +{
- + int prec;
- + LITTLENUM_TYPE words[4];
- + char * t;
- + int i;
- +
- + switch (type)
- + {
- + case 'f':
- + prec = 2;
- + break;
- +
- + case 'd':
- + prec = 4;
- + break;
- +
- + default:
- + *sizep = 0;
- + return _("bad call to md_atof");
- + }
- +
- + t = atof_ieee (input_line_pointer, type, words);
- + if (t)
- + input_line_pointer = t;
- +
- + *sizep = prec * 2;
- +
- + for (i = prec - 1; i >= 0; i--)
- + {
- + md_number_to_chars (litp, (valueT) words[i], 2);
- + litp += 2;
- + }
- +
- + return NULL;
- +}
- +
- +
- +/* Very gross. */
- +void
- +md_convert_frag (abfd, sec, fragP)
- + bfd * abfd;
- + asection * sec;
- + fragS * fragP;
- +{
- + subseg_change (sec, 0);
- +
- + /* In range conditional or unconditional branch. */
- + if (fragP->fr_subtype == 0 || fragP->fr_subtype == 2)
- + {
- + fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int)fragP->fr_opcode);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 2;
- + }
- + /* Out of range conditional branch. Emit a branch around a jump. */
- + else if (fragP->fr_subtype == 1)
- + {
- + unsigned char *buffer =
- + (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
- +
- + /* Reverse the condition of the first branch. */
- + buffer[0] ^= 0x08;
- + /* Mask off all the displacement bits. */
- + buffer[0] &= 0x8f;
- + buffer[1] &= 0x07;
- + /* Now set the displacement bits so that we branch
- + around the unconditional branch. */
- + buffer[0] |= 0x30;
- +
- + /* Now create the unconditional branch + fixup to the final
- + target. */
- + md_number_to_chars (buffer + 2, 0x00000780, 4);
- + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
- + (int) fragP->fr_opcode + 1);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 6;
- + }
- + /* Out of range unconditional branch. Emit a jump. */
- + else if (fragP->fr_subtype == 3)
- + {
- + md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
- + fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
- + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
- + (int) fragP->fr_opcode + 1);
- + fragP->fr_var = 0;
- + fragP->fr_fix += 4;
- + }
- + else
- + abort ();
- +}
- +
- +valueT
- +md_section_align (seg, addr)
- + asection * seg;
- + valueT addr;
- +{
- + int align = bfd_get_section_alignment (stdoutput, seg);
- + return ((addr + (1 << align) - 1) & (-1 << align));
- +}
- +
- +/******************************************************************************
- + INPUT NONE
- + RETURN void
- + Explanation An assembler initial cofiguration peculiar to a model
- +******************************************************************************/
- +void
- +md_begin ()
- +{
- + char * prev_name = "";
- + register const struct c33_opcode * op;
- + flagword applicable;
- +
- + /* Create hash table */
- + c33_hash = hash_new();
- +
- + /* Insert unique names into hash table. The C33 instruction set
- + has many identical opcode names that have different opcodes based
- + on the operands. This hash table then provides a quick index to
- + the first opcode with a particular name in the opcode table. */
- +
- + /* nemonic registered into the operation code table is registered into a hash table.*/
- +
- + /* >>>>>> tazaki 2001.11.07 */
- + if( g_iAdvance == 0 ) /* cpu = standard ? */
- + {
- + if( g_iPE == 0 )
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_opcodes; /* STANDARD table */
- + }
- + else
- + {
- + op = c33_opcodes32; /* STANDARD table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + else
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_pe_opcodes; /* PE table add T.Tazaki 2003/11/18 */
- + }
- + else
- + {
- + op = c33_pe_opcodes32; /* PE table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + }
- + else
- + {
- + if( g_iMedda32 == 0 )
- + {
- + op = c33_advance_opcodes; /* ADVANCE table */
- + }
- + else
- + {
- + op = c33_advance_opcodes32; /* ADVANCE table : No use default data area add T.Tazaki 2004/07/30 */
- + }
- + }
- + /* <<<<<< tazaki 2001.11.07 */
- +
- + while (op->name)
- + {
- + if (strcmp (prev_name, op->name))
- + {
- + prev_name = (char *) op->name;
- + hash_insert (c33_hash, op->name, (char *) op);
- + }
- + op++;
- + }
- +#if 0 /* c33 */
- + bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
- +#endif /* c33 */
- +
- + applicable = bfd_applicable_section_flags (stdoutput);
- +}
- +
- +/******************************************************************************
- + INPUT int NONE
- + RETURN bfd_reloc_code_real_type
- + Explanation analysys symbol mask
- +******************************************************************************/
- +/* Warning: The code in this function relies upon the definitions
- + in the c33_operands[] array (defined in opcodes/c33-opc.c)
- + matching the hard coded values contained herein. */
- +
- +static bfd_reloc_code_real_type
- +c33_reloc_prefix ()
- +{
- +
- + /* Is it the prefix of a symbol mask? */
- + if (*input_line_pointer == '@'){
- + input_line_pointer++;
- + }else{
- +
- + /* NO */
- + return BFD_RELOC_UNUSED;
- + }
- +#define CHECK_(name, reloc) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return reloc; \
- + }
- +
- + CHECK_ ("ah", BFD_RELOC_C33_AH); /* LABEL(25:13) */
- + CHECK_ ("al", BFD_RELOC_C33_AL); /* LABEL(12:0) */
- + CHECK_ ("rh", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
- + CHECK_ ("rm", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
- + CHECK_ ("rl", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
- + CHECK_ ("h", BFD_RELOC_C33_H); /* LABEL(31:19) */
- + CHECK_ ("m", BFD_RELOC_C33_M); /* LABEL(18:6) */
- + CHECK_ ("l", BFD_RELOC_C33_L); /* LABEL(5:0) */
- +
- + CHECK_ ("AH", BFD_RELOC_C33_AH); /* LABEL(25:13) */
- + CHECK_ ("AL", BFD_RELOC_C33_AL); /* LABEL(12:0) */
- + CHECK_ ("RH", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
- + CHECK_ ("RM", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
- + CHECK_ ("RL", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
- + CHECK_ ("H", BFD_RELOC_C33_H); /* LABEL(31:19) */
- + CHECK_ ("M", BFD_RELOC_C33_M); /* LABEL(18:6) */
- + CHECK_ ("L", BFD_RELOC_C33_L); /* LABEL(5:0) */
- +
- + return BFD_RELOC_UNUSED;
- +}
- +
- +/* add tazaki 2001.12.03 >>>>> */
- +
- +/* Warning: The code in this function relies upon the definitions
- + in the c33_operands[] array (defined in opcodes/c33-opc.c)
- + matching the hard coded values contained herein. */
- +
- +/******************************************************************************
- + INPUT int NONE
- + RETURN bfd_reloc_code_real_type
- + Explanation analisys symbol offset
- +******************************************************************************/
- +static bfd_reloc_code_real_type
- +c33_reloc_prefix_offset ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +
- +/* Modify name## --> name : for gcc-3.3.6 T.Tazaki 2005/08/04 */
- +#define CHECK2_(name, reloc) \
- + if (strncmp (input_line_pointer, name"(", strlen (name) + 1 ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return reloc; \
- + }
- +
- + CHECK2_ ("doff_hi", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
- + CHECK2_ ("doff_lo", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
- + CHECK2_ ("goff_lo", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
- + CHECK2_ ("soff_hi", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
- + CHECK2_ ("soff_lo", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
- + CHECK2_ ("toff_hi", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
- + CHECK2_ ("toff_lo", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
- + CHECK2_ ("zoff_hi", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
- + CHECK2_ ("zoff_lo", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
- + CHECK2_ ("dpoff_h", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
- + CHECK2_ ("dpoff_m", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
- + CHECK2_ ("dpoff_l", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
- +
- + CHECK2_ ("DOFF_HI", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
- + CHECK2_ ("DOFF_LO", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
- + CHECK2_ ("GOFF_LO", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
- + CHECK2_ ("SOFF_HI", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
- + CHECK2_ ("SOFF_LO", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
- + CHECK2_ ("TOFF_HI", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
- + CHECK2_ ("TOFF_LO", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
- + CHECK2_ ("ZOFF_HI", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
- + CHECK2_ ("ZOFF_LO", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
- + CHECK2_ ("DPOFF_H", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
- + CHECK2_ ("DPOFF_M", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
- + CHECK2_ ("DPOFF_L", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
- +
- + return BFD_RELOC_UNUSED;
- +
- +}
- +
- +/* add tazaki 2002.02.29 >>>>> */
- +/******************************************************************************
- + INPUT NONE
- + RETURN operand code
- + advanced macro "EXT COND" instruction operand analysis
- +******************************************************************************/
- +static int
- +c33_condition ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +#define CHECK3_(name, cond) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return cond; \
- + }
- +
- + CHECK3_ ("gt", 0x04);
- + CHECK3_ ("ge", 0x05);
- + CHECK3_ ("lt", 0x06);
- + CHECK3_ ("le", 0x07);
- + CHECK3_ ("ugt", 0x08);
- + CHECK3_ ("uge", 0x09);
- + CHECK3_ ("ult", 0x0a);
- + CHECK3_ ("ule", 0x0b);
- + CHECK3_ ("eq", 0x0c);
- + CHECK3_ ("ne", 0x0d);
- +
- + return 0;
- +
- +}
- +/* add tazaki 2002.02.29 >>>>> */
- +/******************************************************************************
- + INPUT NONE
- + RETURN operand code
- + advanced macro "EXT OP,imm2" or "EXT %RB,OP,imm2" instruction operand analysis
- +******************************************************************************/
- +static int
- +c33_op_shift ()
- +{
- + boolean paren_skipped = false;
- +
- +
- +#define CHECK4_(name, op_shift_code) \
- + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
- + { \
- + input_line_pointer += strlen (name); \
- + return op_shift_code; \
- + }
- +
- + CHECK4_ ("sra", 0x01);
- + CHECK4_ ("srl", 0x02);
- + CHECK4_ ("sll", 0x03);
- +
- + return 0;
- +
- +}
- +
- +/******************************************************************************
- + INPUT unsigned long
- + const struct c33_operand* operand
- + offsetT
- + char*
- + unsigned int
- + char*
- + int
- + RETURN unsigned long
- + Explanation An operand and an operation code are made into a command code.
- +******************************************************************************/
- + unsigned long ulrd; /* add T.Tazaki 2004/07/23 */
- +
- +/* Insert an operand value into an instruction. */
- +static unsigned long
- +c33_insert_operand (insn, operand, val, file, line, str,flags)
- + unsigned long insn;
- + const struct c33_operand * operand;
- + offsetT val;
- + char * file;
- + unsigned int line;
- + char * str;
- + int flags;
- +{
- +
- + long min, max, lval;
- + unsigned long ulValue, ulMask;
- + int iSign;
- +
- + /* Does a function exist? */
- + if (operand->insert)
- + {
- + /* YES */
- +
- + const char * message = NULL;
- +
- + insn = operand->insert (insn, val, & message);
- + if (message != NULL)
- + {
- + if (str)
- + {
- + if (file == (char *) NULL)
- + as_warn ("%s: %s", str, message);
- + else
- + as_warn_where (file, line, "%s: %s", str, message);
- + }
- + else
- + {
- + if (file == (char *) NULL)
- + as_warn (message);
- + else
- + as_warn_where (file, line, message);
- + }
- + }
- + }
- + else
- + {
- + /* NO */
- +
- +// long min, max, lval;
- +// unsigned long ulValue, ulMask;
- +// int iSign;
- +
- + lval = val; /* T.Tazaki 2002.02.27 */
- +
- + if( operand->range < 32 ){
- +
- + /* Restore min and mix to expected values for decimal ranges. */
- +
- + if (flags & C33_OPERAND_SIGNED){
- +
- + ulValue = val;
- +
- + ulMask = 0xffffffff >> ( operand->range - 1 );
- + ulMask <<= ( operand->range - 1 );
- + if(( ulValue & ulMask ) == ulMask ){
- + iSign = 1; /* (-) */ /* "jp 0xffffff81" */
- + }else{
- + if( ( ulValue & ulMask ) == (1 << ( operand->range - 1 )) ){ /* only sign bit = 1 ? */
- + iSign = 1; /* (-) */ /* "jp 0x81" */
- + }else{
- + if(( ulValue & ulMask ) == 0 ){ /* sign bit = 0 ? */
- + iSign = 0; /* (+) */ /* "jp 0x40" */
- + }else{
- + iSign = 2; /* Warninng */
- + }
- + }
- + }
- +
- + if( iSign == 2 ){ /* Invalid range ? "jp 0x102" */
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
- + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), val);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + else
- + {
- + if( iSign == 0 ){ /* (+) ? */
- + lval = val;
- + }else{
- + if( iSign == 1 ){ /* (-) ? */
- + lval = ulValue | ulMask; /* sign extend */
- + }
- + }
- +
- + /* max = (1 << ( operand->bits - 1 )) - 1;
- + min = - (1 << (operand->bits - 1)); */
- + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
- + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
- +
- + if (lval < min || lval > max)
- + {
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), lval);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + }
- + }
- + else {
- + /* It asks for the range of effective value. */
- + max = (1 << operand->bits) - 1;
- + min = 0;
- +
- + /* Value is range outside. */
- + if (lval < (offsetT) min || lval > (offsetT) max)
- + {
- + /* xgettext:c-format */
- + const char * err = _("operand out of range (%s not between %ld and %ld)");
- + char buf[100];
- +
- + if (str)
- + {
- + sprintf (buf, "%s: ", str);
- +
- + sprint_value (buf + strlen (buf), lval);
- + }
- + else
- + sprint_value (buf, lval);
- +
- + if (file == (char *) NULL)
- + as_warn (err, buf, min, max);
- + else
- + as_warn_where (file, line, err, buf, min, max);
- + }
- + }
- + }
- +
- + /* An operand and an operation code are made into a command code. */
- +// insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
- + insn |= (((long) lval & ((1 << operand->bits) - 1)) << operand->shift); /* T.Tazaki 2002.02.27 */
- +/* >>>> add tazaki advanced macro */
- + if (flags & C33_OPERAND_01) {
- + insn |= 0x0010; /* bit 5,4 = 0,1 set */
- + }
- + if (flags & C33_OPERAND_OP3_01) {
- + insn |= 0x0040; /* bit 7,6 = 0,1 set : psrset imm5 */
- + }
- + if (flags & C33_OPERAND_OP3_10){
- + insn |= 0x0080; /* bit 7,6 = 1,0 set : psrclr imm5 */
- + }
- +/* <<<< add tazaki advanced macro */
- + }
- + return insn;
- +}
- +
- +
- +static char copy_of_instruction [128];
- +
- +void
- +md_assemble (str)
- + char * str;
- +{
- + char * s;
- + char * start_of_operands;
- + struct c33_opcode * opcode;
- + struct c33_opcode * opcode2; /* add tazaki 2001.08.10 */
- + struct c33_opcode * next_opcode;
- + const unsigned char * opindex_ptr;
- + int next_opindex;
- + int relaxable;
- + unsigned short insn;
- + unsigned short insn_wk; /* add tazaki 2001.12.11 */
- + unsigned short copy_insn;
- + char * f; /* insn address */
- + char * where; /* insn address */
- + int i;
- + int match;
- + boolean extra_data_befor_insn = false;
- + unsigned int extra_data_len;
- + unsigned short extraInsnBuf[10];
- + char * saved_input_line_pointer;
- + char * check_input_line_pointer;
- + char * temp_input_line_pointer;
- + unsigned short * fromP;
- + int iNumber;
- + unsigned int uiNumber; /* add tazaki 2002.03.11 */
- +
- + int i_ext_off; /* add tazaki 2001.08.07 */
- + int iMEM_IMM26_flag; /* add tazaki 2001.10.11 */
- + char * pSymbolName ; /* for [imm26] add tazaki 2001.11.28 */
- + char szSymbolName[300]; /* for [imm26] add tazaki 2001.11.28 */
- + char * temp_pointer; /* for [imm26] add tazaki 2001.11.28 */
- +
- + int g_iBitTest = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
- + int g_iBitTest_range = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
- + int g_iXload = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
- + int g_iXload_range = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- + int i_ext_cnt = -1; // numbers of ext to add (default when -1)
- +
- + // indices for extraInsnBuf
- + unsigned int insn_idx_high = 0; // for ext @h
- + unsigned int insn_idx_mid = 0; // for ext @m
- + unsigned int insn_idx_low = 0; // for ld @l (always present)
- + unsigned int insn_idx_load = 0; // for ld.* (always present)
- + unsigned int insn_idx_pop = 0; // for mem write
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- +
- +// ADD D.Fujimoto 2007/06/21 >>>>>>>
- +#ifdef EXT_REMOVE
- + if( g_c33_ext == 1 ){
- + // get the offset from the nearest symbol
- + evaluate_offset_from_symbol();
- + }
- +#endif
- +// ADD D.Fujimoto 2007/06/21 <<<<<<<
- +
- + pSymbolName = &szSymbolName[0]; /* Symbol name pointer domain initialization for [imm26] add tazaki 2001.11.28*/
- +
- + /* The command character sequence for one line is copied. */
- + strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
- +
- + /* It is made a character sequence as an operation code. */
- + /* Get the opcode. */
- + for (s = str; *s != '\0' && ! isspace (*s); s++)
- + continue;
- +
- + if (*s != '\0')
- + *s++ = '\0';
- +
- + /* find the first opcode with the proper name */
- + opcode = (struct c33_opcode *) hash_find (c33_hash, str);
- +
- + /* not find operation code? */
- + if (opcode == NULL) {
- + /* xgettext:c-format */
- + as_bad (_("Unrecognized opcode: `%s'"), str);
- + ignore_rest_of_line ();
- + return;
- + }
- +
- + /* The space from an operation code to an operand is skipped. */
- + str = s;
- + while (isspace (* str))
- + ++ str;
- +
- + /* The start position of an operand is held. */
- + start_of_operands = str;
- +
- + saved_input_line_pointer = input_line_pointer;
- +
- + /* An interpretation of an operand */
- + for (;;) {
- + const char * errmsg = NULL;
- +
- + match = 0;
- +
- + relaxable = 0;
- + fc = 0;
- + next_opindex = 0;
- + insn = opcode->opcode;
- + extra_data_befor_insn = false;
- +
- + iMEM_IMM26_flag = 0; /* add tazaki 2001.10.11 */
- +
- + /* The start position of an operand is held. */
- + input_line_pointer = str = start_of_operands;
- +
- + /* Only the number of operands is repeated. */
- + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr ++)
- + {
- + const struct c33_operand * operand;
- + char * hold;
- + expressionS ex;
- + expressionS ext_ex;
- + bfd_reloc_code_real_type reloc;
- +
- + int flags;
- +
- + if (next_opindex == 0)
- + {
- + /* An operand is acquired. */
- + operand = & c33_operands[ * opindex_ptr ];
- + }
- + else
- + {
- + operand = & c33_operands[ next_opindex ];
- + next_opindex = 0;
- + }
- +
- + flags = operand->flags;
- + errmsg = NULL;
- +
- + while (*str == ' ' || *str == ',' || *str == ']')
- + ++ str;
- +
- + /* Gather the operand. */
- + hold = input_line_pointer;
- + input_line_pointer = str;
- +
- + errmsg = NULL;
- +
- + /* tazaki 2002.01.11 >>>>>> */
- + i_ext_off = 0;
- + opcode2 = (struct c33_opcode *)c33_ext_opcodes;
- + if( opcode->opcode == opcode2->opcode ){
- + /* ext xoff_hi(sym),ext xoff_lo(sym),ext dpoff_h,m(sym) : analisys symbol offset */
- + reloc = c33_reloc_prefix_offset ();
- + if( reloc != BFD_RELOC_UNUSED ){
- + i_ext_off = 1;
- + }
- + }
- + if( i_ext_off == 1 )
- + {
- + /* ext 命令 and xoff_hi(sym),ext xoff_lo(sym),dpoff_h,m(sym) ? */
- +
- + /* read symbol , disp */
- +
- + expression (& ex);
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = reloc;
- + ++fc;
- +
- + }
- + else
- + {
- + /* >>>> add tazaki 2002.02.29 class1 : ext cond*/
- + if ((operand->flags & C33_OPERAND_COND) == C33_OPERAND_COND)
- + {
- + int iCond = c33_condition(); /* get operand code */
- + if( iCond != 0 ){
- +
- + ex.X_op = O_cond;
- + ex.X_add_number = iCond;
- +
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2002.02.29 class1 : ext OP,imm2 | ext %rb,OP,imm2 */
- + else if ((operand->flags & C33_OPERAND_OP_SHIFT) == C33_OPERAND_OP_SHIFT)
- + {
- + int iShiftCode = c33_op_shift(); /* get operand code */
- + if( iShiftCode != 0 ){
- +
- + ex.X_op = O_op_shift;
- + ex.X_add_number = iShiftCode;
- +
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2001.09.18 class7 : [%dp+imm6]*/
- + else if ((operand->flags & C33_OPERAND_DPMEM) == C33_OPERAND_DPMEM)
- + {
- + if (*str == '['){
- + str++;
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support only"[%dp]" */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else if (*str == '+'){
- + str++;
- + input_line_pointer = str;
- +
- + reloc = c33_reloc_prefix_offset();
- + if( reloc != BFD_RELOC_UNUSED ){ /* dpoff_l() ? */
- + errmsg = _("invalid operand");
- + }
- + else
- + {
- + /* An operand is developed at a formula. */
- + expression (& ex);
- +
- + iNumber = ex.X_add_number;
- +
- + if (operand->range <= 6){
- + /* EMPTY */
- + }
- + else if (operand->range == 32) {
- + /* update tazaki 2002.03.08 >>> */
- + if (opcode->specialFlag == 1){
- + /* ld.b */
- + if ((unsigned int)iNumber <= 0x3f){
- + ex.X_add_number /= 1;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 2){
- + /* ld.h */
- + if ((unsigned int)iNumber <= 0x7f){
- + ex.X_add_number /= 2;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 4){
- + /* ld.w */
- + if ((unsigned int)iNumber <= 0xff){
- + ex.X_add_number /= 4;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + /* update tazaki 2002.03.08 <<< */
- + }
- + else {
- + errmsg = _("constant too big to fit into instruction");
- + }
- + }
- + }
- + else{
- + /* YES */
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* >>>> add tazaki 2002.01.15 class7 : [%dp+dpoff_l(symbol)]*/
- + else if ((operand->flags & C33_OPERAND_DPSYMBOL6) == C33_OPERAND_DPSYMBOL6)
- + {
- + if (*str == '['){
- + str++;
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support only"[%dp] */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else
- + {
- + if (*str == '+'){
- + /* [%dp+dpoff_l(symbol)] */
- + str++;
- + input_line_pointer = str;
- +
- + reloc = c33_reloc_prefix_offset();
- + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
- +
- + expression (& ex);
- +
- + if (ex.X_op != O_symbol){ /* not symbol ? */
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* >>>> add tazaki 2002.01.15 class7 : dpoff_l(symbol) */
- + else if ((operand->flags & C33_OPERAND_DPSYMBOL6_2) == C33_OPERAND_DPSYMBOL6_2)
- + {
- + reloc = c33_reloc_prefix_offset();
- + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
- +
- + expression (& ex);
- +
- + if (ex.X_op != O_symbol){ /* not symbol ? */
- + errmsg = _("invalid operand");
- + }
- + }else{
- + errmsg = _("invalid operand");
- + }
- + }
- + /* >>>> add tazaki 2001.12.21 class0 : %dp */
- +
- + else if ((operand->flags & C33_OPERAND_DP) == C33_OPERAND_DP)
- + {
- + /* check %dp ? */
- + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
- + {
- + /* NO */
- + errmsg = _("invalid system register name");
- + }else{
- + str+=3;
- + while (isspace (*str))
- + ++str;
- + input_line_pointer = str;
- +
- + ex.X_op = O_dpregister;
- + /* In %dp, an operand is not inserted in a command code. */
- + }
- + /* <<<< add tazaki 2001.12.21 class0 : %dp */
- + }
- + else if ((operand->flags & C33_OPERAND_REG) != 0)
- + {
- + if (!register_name (& ex))
- + {
- + /* YES */
- + errmsg = _("invalid register name");
- + }
- + }
- + else if ((operand->flags & C33_OPERAND_LD_SREG) != 0) /* add 2002.06.19 error : ld.w %pc,%rs */
- + {
- + if (!load_system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + }
- + else if ((operand->flags & C33_OPERAND_PUSHS_SREG) != 0) /* add 2002.06.19 : pushs %ss ,pops %sd */
- + {
- + if (!pushs_system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + }
- + else if (((operand->flags & C33_OPERAND_SREG) != 0) ||
- + ((operand->flags & C33_OPERAND_SP) != 0))
- + {
- + if (!system_register_name (& ex, true, false))
- + {
- + errmsg = _("invalid system register name");
- + }
- + else {
- + /* NO register OK */
- + if ((operand->flags & C33_OPERAND_SP) != 0)
- + {
- + ex.X_op = O_spregister;
- + /* In %sp, an operand is not inserted in a command code. */
- + }
- + }
- + }
- + /* ELSE IF Operand is immidiate ? */
- + else if ((operand->flags & C33_OPERAND_IMM) ||
- + (operand->flags & C33_OPERAND_SIGNED))
- + {
- +
- + expression (& ex);
- +
- + /* IF Operand is constant ?*/
- + if (ex.X_op == O_constant)
- + {
- + if (opcode->specialFlag == 5){
- +
- + /* shift/lotate */
- +
- + iNumber = ex.X_add_number;
- + if( iNumber > 8 ){
- +
- + errmsg = _("operand out of range (not between 0 and 8)");
- + }else{
- + extra_data_len = 0;
- + ex.X_add_number = iNumber;
- + }
- + }else if (opcode->specialFlag == 6){
- +
- + /* 拡張命令のshift/lotate */
- +
- + iNumber = ex.X_add_number;
- + if( iNumber > 31 ){
- + errmsg = _("operand out of range (not between 0 and 31)");
- + }else{
- + extra_data_len = 0;
- + while(iNumber > 8){
- + extra_data_befor_insn = true;
- + copy_insn = c33_insert_operand (insn, operand,8,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + extraInsnBuf[extra_data_len] = copy_insn;
- + extra_data_len++;
- + ex.X_add_number = 8;
- + iNumber -= 8;
- + }
- + ex.X_add_number = iNumber;
- + }
- + }else if (opcode->specialFlag == 7){
- +
- + /* Advanced mode "X" Extended of shift/lotate */
- + iNumber = ex.X_add_number;
- + if( iNumber > 31 ){
- + errmsg = _("operand out of range (not between 0 and 31)");
- + }else{
- + if( iNumber <= 15 ){
- +
- + }else{
- + ex.X_add_number -= 16;
- +
- + /* Convert Opecode */
- + insn_wk = insn & 0xff00;
- +
- + switch( insn_wk ){
- + case 0x8800: insn_wk = 0x2300; break; /* srl -->class 1 : srl */
- + case 0x8c00: insn_wk = 0x2700; break; /* sll -->class 1 : sll */
- + case 0x9000: insn_wk = 0x2b00; break; /* sra -->class 1 : sra */
- + case 0x9400: insn_wk = 0x2f00; break; /* sla -->class 1 : sla */
- + case 0x9800: insn_wk = 0x3300; break; /* rr -->class 1 : rr */
- + case 0x9c00: insn_wk = 0x3700; break; /* rl -->class 1 : rl */
- + default : errmsg = _("invalid operand"); break;
- +
- + }
- + insn = insn_wk | ( insn & 0x00ff );
- + }
- + }
- + }
- + else {
- + /* shift/lotate命令以外 */
- +
- + /* Possible to sign32 */
- + iNumber = ex.X_add_number;
- +
- + if (operand->flags & C33_OPERAND_SIGNED){
- + /* YES signed */
- +
- + if ((operand->range == 19) && ((-262144 <= iNumber && iNumber < -32) ||
- + (31 < iNumber && iNumber <= 262143))){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0) is not signed */
- + }
- + else if (operand->range == 22) {
- + if (operand->flags & C33_OPERAND_PC){
- + if (-256 <= iNumber && iNumber <= 254){
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
- + }
- + else if ((-2097152 <= iNumber && iNumber < -256) ||
- + (254 < iNumber && iNumber <= 2097150)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff); /* sign22(21:9) */
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }else{
- + errmsg = _("operand out of range (not between -2097152 and 2097150)");
- + }
- + }
- + }
- + else if (operand->range == 32){
- + /* jp,call */
- + if (operand->flags & C33_OPERAND_PC){
- + if (-256 <= iNumber && iNumber <= 254){
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + }
- + else if ((-2097152 <= iNumber && iNumber < -256) ||
- + (254 < iNumber && iNumber <= 2097150)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff);
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1ff8);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 9) & 0x1fff);
- + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + }
- + else {
- + if (-32 <= iNumber && iNumber <= 31){
- + /* EMPTY */
- + }
- + else if ((-262144 <= iNumber && iNumber < -32) ||
- + (31 < iNumber && iNumber <= 262143)){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + else {
- + /* ext命令 2つ */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
- + }
- + }
- + }
- + }
- + else {
- + /* IMM */
- + switch( operand->range ){
- + case 19:
- + if ((unsigned int)iNumber <= 0x7ffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + break;
- + case 32:
- + if ((unsigned int)iNumber <= 0x3f){
- + /* EMPTY */
- + }
- + else if ((unsigned int)iNumber <= 0x7ffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- +
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- +
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + break;
- + }
- + }
- + }
- + }
- +
- + /* ELSE IF Operand is LABEL & SYMBOL */
- +
- + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_LABEL)){
- + /* YES jp/call only */
- +
- + if (operand->range == 13){ /* 2001.4.27 ide */
- + /* YES ext */
- +
- + /* Get Symbol mask relocation */
- + reloc = c33_reloc_prefix ();
- + /* Not symbol mask ? : ERROR = ext label, OK = ext label@xx */
- + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2002.03.04 */
- + errmsg = _("invalid operand");
- + }
- + }
- + else if (operand->range == 5){ /* add tazaki 2002.03.04 */
- + /* YES loop */
- + reloc = BFD_RELOC_C33_LOOP; /* Adv : loop operand */
- + }
- + else if (operand->range == 8){
- + /* YES jp,call */
- +
- + reloc = c33_reloc_prefix (); /* add tazaki 2001.08.23 */
- + /* Not symbol mask ? */
- + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2001.08.23 */
- + /* Set Symbol Mask Relocation */
- + reloc = BFD_RELOC_C33_JP; /* Modify BFD_RELOC_C33_RL -->BFD_RELOC_C33_JP 2002.04.22 */
- + }
- + }
- + /* add 2001.08.06 tazaki >>>>> */
- + else if (operand->range == 22){
- + /* YES scall,sjp,sjrxx */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count_for_jumps(ex, 1, count_ext_for_jumps);
- + }
- +
- + if (i_ext_cnt == 0) {
- + // no ext
- + reloc = BFD_RELOC_C33_S_RL;
- +
- + } else {
- +
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- +#endif /* EXT_REMOVE */
- +
- +
- + }
- + /* add 2001.08.06 tazaki <<<<< */
- + else {
- + /* xjp,xcall */
- +
- + /* ext label+imm32@rh */
- + /* ext label+imm32@rm */
- + /* call label+imm32@rl */
- +
- + /* strにシンボル名が入っている。2パス アセンブラのとき、これを比較する。 */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count_for_jumps(ex, 2, count_ext_for_jumps);
- + }
- +
- + if (i_ext_cnt == 0) {
- + // no ext
- + reloc = BFD_RELOC_C33_S_RL;
- +
- + } else if (i_ext_cnt == 1) {
- + // 1 ext
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- +
- + } else {
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_S_RL;
- +
- +#endif /* EXT_REMOVE */
- + }
- + }
- + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_SYMBOL)){
- + /* YES ld.w only */
- + if( *str == '[' ){
- + errmsg = _("invalid operand");
- + }
- + else if (operand->range == 6){
- + /* ld.w %rd,LABEL@l */
- +
- + /* Get Symbol mask relocation */
- + reloc = c33_reloc_prefix ();
- + }
- + else if (operand->range == 19){
- + /* xld.w rd,symbol+imm19 */
- +
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + }
- + else{
- + if (operand->range == 32){
- + /* ext label+imm32@h */
- + /* ext label+imm32@m */
- + /* xld.w label+imm32@l */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + // pattern xld.w %rd, LABEL
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_xld_rd_symbol);
- + }
- +
- + if (i_ext_cnt == 0) {
- + // no ext
- + reloc = BFD_RELOC_C33_L;
- +
- + } else if (i_ext_cnt == 1) {
- + // 1 ext
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- +
- + } else {
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +#endif /* EXT_REMOVE */
- + }
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + /* Operand is register indirectness (memory). */
- +// else if ((operand->flags & C33_OPERAND_RB) != 0) /* del T.Tazaki 2004/07/30 */
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) == 0 && g_iMedda32 == 1 ) /* add T.Tazaki 2004/07/30 */
- + {
- + /* Pattern */
- + /* [rb] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* YES register */
- +
- + /* Skip space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES pattern match */
- + input_line_pointer++;
- + }
- + else {
- + /* NO not match */
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO not register */
- + errmsg = _("invalid operand");
- + }
- +
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + /* add T.Tazaki 2004/07/30 >>> */
- + /* Operand is register indirectness (memory). */
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && g_iMedda32 == 0 ) /* Use data area */
- + {
- + /* Pattern */
- + /* [rb] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* YES register */
- +
- + /* Skip space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES pattern match */
- + input_line_pointer++;
- + }
- + else {
- + /* NO not match */
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO not register */
- + errmsg = _("invalid operand");
- + }
- +
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) != 0 && g_iMedda32 == 1 )
- + {
- + /* Are there any symbol and IMM which follow a register? */
- + /* Pattern */
- + /* [rb+imm26] */
- +
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (register_name (& ex))
- + {
- + /* Skip Space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES Register Only */
- + input_line_pointer++;
- + }
- + /* ELSE IF plus */
- + else if (*input_line_pointer == '+'){
- + /* YES plus */
- +
- + input_line_pointer++;
- + /* symbol,imm */
- + expression (& ext_ex);
- +
- + if (ext_ex.X_op == O_constant){
- + /* [%rd+imm26] */
- +
- + uiNumber = ext_ex.X_add_number;
- +
- + if (uiNumber == 0){
- + /* EMPTY */
- + }
- + else if (uiNumber <= 0x1fff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else if (uiNumber <= 0x3ffffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else {
- + /* NO more than 27bit ? */
- +
- + /* tnot support */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO not immidiate */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO any other character */
- + /* error */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + /* add T.Tazaki 2004/07/30 <<< */
- +
- +/* >>> add tazaki 2001.11.20 */
- +
- + else if( ( (operand->flags & C33_OPERAND_MEM) != 0 ) &&
- + ( (operand->flags & C33_OPERAND_DP_SYMBOL) == C33_OPERAND_DP_SYMBOL ) )
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + /* YES not register */
- +
- + if (system_register_name (& ex, true, false)){
- + /* system register */
- + errmsg = _("invalid operand");
- + }
- + else {
- + check_input_line_pointer = input_line_pointer;
- +
- + expression (& ex);
- +
- + /* if Minus "-", No Support! */
- + while(check_input_line_pointer < input_line_pointer){
- + if (*check_input_line_pointer == '-'){
- + errmsg = _("invalid operand");
- + break;
- + }
- + check_input_line_pointer++;
- + }
- + }
- + if (errmsg != NULL){
- + }
- + /* ELSE IF Operand is SYMBOL */
- + else if (ex.X_op == O_symbol){
- + /* Pattern */
- + /* [symbol+imm32] */
- +
- + if( operand->range == 19 )
- + {
- + if( g_iMedda32 == 0 ) /* add T.Tazaki 2004/07/30 */
- + {
- + /* ext (symbol+imm32-dp)@6-18 : ext imm13 */
- + /* ld.w (symbol+imm32-dp)@0-5 : ld.w r0,[%dp+imm6] */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + // for following patterns
- + //
- + // ald.* %rd, [LABEL] (mem read) (without medda32)
- + // ald.* [LABEL], %rd (mem write) (without medda32)
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_ald_mem_rw);
- + }
- +
- + if (i_ext_cnt == 0) {
- + // no ext
- + reloc = BFD_RELOC_C33_DPL;
- +
- + } else {
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- +
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- +#endif /* EXT_REMOVE */
- + }
- +#if 0
- + else
- + {
- + /* add T.Tazaki 2004/08/19 >>> */
- + /* 0:pushn %r0 */
- + /* 1:ext label+imm32@m */
- + /* 2:ld.x %r0,label+imm32@l */
- + /* 3:ld.x %rd,[%r0] */
- + /* 4:popn %r0 */
- +
- + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
- + /* 1ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_M に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
- + を追加して、リンカで "pushn %r0" を設定させるためにある。 */
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0; /* デフォルトの"pushn %r0" を設定 */
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + extra_data_befor_insn = true;
- + ulrd = insn & 0x000f;
- + insn &= 0xfff0;
- + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
- +
- + if ((operand->flags & C33_XLDB_RD) != 0)
- + {
- + insn = 0x2000 + ulrd; /* ld.b %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDB_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3400; /* ld.b [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDH_RD) != 0)
- + {
- + insn = 0x2800 + ulrd; /* ld.h %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDH_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3800; /* ld.h [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDW_RD) != 0)
- + {
- + insn = 0x3000 + ulrd; /* ld.w %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDW_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3c00; /* ld.w [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDUB_RD) != 0)
- + {
- + insn = 0x2400 + ulrd; /* ld.ub %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XLDUH_RD) != 0)
- + {
- + insn = 0x2c00 + ulrd; /* ld.uh %rd,[%r0] */
- + }
- + extraInsnBuf[3] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[4] = insn;
- + extra_data_len = 4;
- +
- + }
- + /* add T.Tazaki 2004/08/19 <<< */
- +#endif
- + }else if ( operand->range == 32 ){
- + /* ext (symbol+imm32-%dp)@19-31 : ext imm13 */
- + /* ext (symbol+imm32-%dp)@6-18 : ext imm13 */
- + /* ld.w (symbol+imm32-%dp)@0-5 : ld.w r0,[%dp+imm6] */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + // for following patterns
- + //
- + // xld.* %rd, [LABEL] (mem read) (without medda32 and is ADV)
- + // xld.* [LABEL], %rd (mem write) (without medda32 and is ADV)
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_xld_mem_rw_adv);
- + }
- +
- + if (i_ext_cnt == 0) {
- + // no ext
- + reloc = BFD_RELOC_C33_DPL;
- +
- + } else if (i_ext_cnt == 1) {
- + // 1 ext
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- +
- + } else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- +
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
- + ++fc;
- + reloc = BFD_RELOC_C33_DPL;
- +#endif /* EXT_REMOVE */
- +
- + }
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- +/* <<< add tazaki 2001.11.20 */
- +
- + /* An operand is register indirectness (memory). */
- + else if ((operand->flags & C33_OPERAND_MEM) != 0)
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + /* YES not register */
- +
- + if (system_register_name (& ex, true, false)){
- + /* system register */
- + errmsg = _("invalid operand");
- + }
- + else {
- + check_input_line_pointer = input_line_pointer;
- +
- + expression (& ex);
- +
- + /* if Minus "-", No Support! */
- + while(check_input_line_pointer < input_line_pointer){
- + if (*check_input_line_pointer == '-'){
- + errmsg = _("invalid operand");
- + break;
- + }
- + check_input_line_pointer++;
- + }
- + }
- +
- + if (errmsg != NULL){
- + }
- + /* ELSE IF Operand is Immidiate ? */
- + else if (ex.X_op == O_constant){
- + errmsg = _("invalid operand"); /* [imm26] patter : Error! 2001.11.28 */
- + }
- + /* ELSE IF Operand is SYMBOL ? */
- + else if (ex.X_op == O_symbol){
- +
- + /* Pattern */
- + /* [symbol+imm32] */
- +
- +
- + /* ext goff_hi(symbol+imm32) */
- + /* ext goff_lo(symbol+imm32) */
- + /* [r15] */
- +
- + if (operand->range == 13){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_GL;
- + ++fc;
- +
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- +
- + }
- + else if (operand->range == 26 && g_iMedda32 == 0 ){ /* use data area */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + // for following patterns
- + //
- + // xld.* %rd, [LABEL] (mem read) (without medda32 and not ADV)
- + // xld.* [LABEL], %rd (mem write) (without medda32 and not ADV)
- + // xb* [LABEL], imm3 (without medda32)
- + if (g_c33_ext == 1) {
- + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_xld_mem_rw);
- + }
- +
- + if (i_ext_cnt == 1) {
- + // 1 ext
- + // at least 1 ext will be appended
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
- + ++fc;
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- +
- +
- + } else {
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
- + ++fc;
- +
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- +
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode;
- + extraInsnBuf[1] = opcode->opcode;
- +
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
- + ++fc;
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
- + ++fc;
- +
- +
- + /* Save Register Number. */
- + ex.X_op = O_register;
- + ex.X_add_number = GP_REG;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- +
- +#endif /* EXT_REMOVE */
- + }
- + /* add T.Tazaki 2004/08/19 >>> */
- + else if ((operand->range == 19 || operand->range == 26) && g_iMedda32 == 1 ){ /* xld と ald 兼用 : no use data area */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + // optimizing ext inst
- + // for following patterns
- + //
- + // xld.* %rd, [LABEL] (mem read) (with medda32)
- + // xld.* [LABEL], %rd (mem write) (with medda32)
- + // ald.* %rd, [LABEL] (mem read) (with medda32)
- + // ald.* [LABEL], %rd (mem write) (with medda32)
- + // xb* [LABEL], imm3 (with medda32)
- +
- + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
- + /* 0:pushn %r0 */
- + /* 1:ext label+imm32@m */
- + /* 2:ext label+imm32@m */
- + /* 3:ld.x %r0,label+imm32@l */
- + /* 4:ld.x [%r0],%rs */
- + /* 5:popn %r0 */
- +
- +// macro which means that we are now dealing with a memory read (*ld.* %rd, [LABEL]) operation
- +// and not memory write or bit operation
- +#define IS_MEM_READ ( (operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- +
- +
- + if (g_c33_ext == 1) {
- + // for ald
- + if (operand->range == 19) {
- + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_ald_mem_rw32);
- + } else {
- + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_xld_mem_rw32);
- + }
- + }
- +
- + // determine extraInsnBuf indices from ext counts
- + if (i_ext_cnt == 0) {
- + // no ext
- + if (IS_MEM_READ) {
- + insn_idx_low = 0;
- + } else {
- + insn_idx_low = 1;
- + }
- + } else if (i_ext_cnt == 1) {
- + // 1 ext
- + if (IS_MEM_READ) {
- + insn_idx_low = 1;
- + } else {
- + insn_idx_low = 2;
- + }
- + } else {
- + // 2 ext
- + if (IS_MEM_READ) {
- + if (operand->range == 26) {
- + insn_idx_low = 2;
- + } else {
- + insn_idx_low = 1; // ald
- + }
- + } else {
- + if (operand->range == 26) {
- + insn_idx_low = 3;
- + } else {
- + insn_idx_low = 2; // ald
- + }
- + }
- + }
- +
- + // set all indices
- + insn_idx_high = (insn_idx_low < 2) ? 0 : insn_idx_low - 2; // negative -> 0
- + insn_idx_mid = (insn_idx_low < 1) ? 0 : insn_idx_low - 1; // negative -> 0
- + insn_idx_low = insn_idx_low;
- + insn_idx_load = insn_idx_low + 1;
- + insn_idx_pop = insn_idx_low + 2; // only for mem write
- +
- +
- + // push insn
- + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
- +
- + // ext insn
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- +
- + if (i_ext_cnt == 0) {
- + ; // do nothing
- + } else if (i_ext_cnt == 1) {
- + extraInsnBuf[insn_idx_mid] = opcode->opcode;
- + } else {
- + // ald.* does not have ext @h
- + if (operand->range == 26) {
- + extraInsnBuf[insn_idx_high] = opcode->opcode;
- + }
- + extraInsnBuf[insn_idx_mid] = opcode->opcode;
- + }
- +
- +
- + // fill fixup array
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
- + を追加して、リンカで "pushn %r0" を設定させるためにある。
- + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
- + if (!IS_MEM_READ)
- + {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
- + ++fc;
- + }
- +
- + if (i_ext_cnt == 0) {
- + //
- + reloc = BFD_RELOC_C33_L;
- + } else if (i_ext_cnt == 1) {
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + } else {
- +
- + // ald.* has only 1 ext
- + if ( operand->range == 26 ) {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- + }
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + }
- +
- +
- + // low insn (ld.w %rd, @l)
- + ulrd = insn & 0x000f;
- + if( operand->range == 26 )
- + {
- + if (IS_MEM_READ)
- + {
- + extraInsnBuf[insn_idx_low] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + insn &= 0xfff0;
- + extraInsnBuf[insn_idx_low] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- + else
- + {
- + if (IS_MEM_READ)
- + {
- + /* ald.x %rd,[symbol+imm] */
- + extraInsnBuf[insn_idx_low] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + /* ald.x [symbol+imm],%rs */
- + insn &= 0xfff0;
- + extraInsnBuf[insn_idx_low] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- +
- + // load insn
- + if ((operand->flags & C33_XLDB_RD) != 0)
- + {
- + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDB_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3400; /* ld.b [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDH_RD) != 0)
- + {
- + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDH_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3800; /* ld.h [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDW_RD) != 0)
- + {
- + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDW_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3c00; /* ld.w [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDUB_RD) != 0)
- + {
- + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDUH_RD) != 0)
- + {
- + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XBTST) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBCLR) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBSET) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBNOT) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + if( operand->range == 26 )
- + {
- + if (IS_MEM_READ)
- + {
- + extraInsnBuf[insn_idx_load] = insn;
- + extra_data_len = insn_idx_load;
- + }
- + else
- + {
- + extraInsnBuf[insn_idx_load] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[insn_idx_pop] = insn;
- + extra_data_len = insn_idx_pop;
- + }
- + }
- + else
- + {
- + if (IS_MEM_READ)
- + {
- + extraInsnBuf[insn_idx_load] = insn;
- + extra_data_len = insn_idx_load;
- + }
- + else
- + {
- + extraInsnBuf[insn_idx_load] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[insn_idx_pop] = insn;
- + extra_data_len = insn_idx_pop;
- + }
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
- + /* 0:pushn %r0 */
- + /* 1:ext label+imm32@m */
- + /* 2:ext label+imm32@m */
- + /* 3:ld.x %r0,label+imm32@l */
- + /* 4:ld.x [%r0],%rs */
- + /* 5:popn %r0 */
- +
- + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
- +
- + /* 1 or 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[0] = opcode->opcode;
- + }
- + else
- + {
- + extraInsnBuf[1] = opcode->opcode;
- + }
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[1] = opcode->opcode;
- + }
- + else
- + {
- + extraInsnBuf[2] = opcode->opcode;
- + }
- + }
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
- + を追加して、リンカで "pushn %r0" を設定させるためにある。
- + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) == 0 )
- + {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
- + ++fc;
- + }
- +
- + if( operand->range == 26 )
- + {
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
- + fixups[ fc ].reloc = BFD_RELOC_C33_H;
- + ++fc;
- + }
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opcode->operands;
- + fixups[ fc ].reloc = BFD_RELOC_C33_M;
- + ++fc;
- +
- + reloc = BFD_RELOC_C33_L;
- +
- + extra_data_befor_insn = true;
- + ulrd = insn & 0x000f;
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[2] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + insn &= 0xfff0;
- + extraInsnBuf[3] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- + else
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + /* xld.x %rd,[symbol+imm] */
- + extraInsnBuf[1] = insn; /* ld.w %rd,sign6 */
- + }
- + else
- + {
- + /* xld.x [symbol+imm],%rs */
- + insn &= 0xfff0;
- + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
- + }
- + }
- + if ((operand->flags & C33_XLDB_RD) != 0)
- + {
- + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDB_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3400; /* ld.b [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDH_RD) != 0)
- + {
- + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDH_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3800; /* ld.h [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDW_RD) != 0)
- + {
- + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDW_WR) != 0)
- + {
- + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iXload_range = operand->range;
- + insn = 0x3c00; /* ld.w [%r0],%rs */
- + }
- + if ((operand->flags & C33_XLDUB_RD) != 0)
- + {
- + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
- + }
- + else if((operand->flags & C33_XLDUH_RD) != 0)
- + {
- + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
- + }
- + else if((operand->flags & C33_XBTST) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBCLR) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBSET) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + else if((operand->flags & C33_XBNOT) != 0)
- + {
- + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
- + g_iBitTest_range = operand->range;
- + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
- + }
- + if( operand->range == 26 )
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[3] = insn;
- + extra_data_len = 3;
- + }
- + else
- + {
- + extraInsnBuf[4] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[5] = insn;
- + extra_data_len = 5;
- + }
- + }
- + else
- + {
- + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
- + {
- + extraInsnBuf[2] = insn;
- + extra_data_len = 2;
- + }
- + else
- + {
- + extraInsnBuf[3] = insn;
- + insn = 0x0240; /* popn %r0 */
- + extraInsnBuf[4] = insn;
- + extra_data_len = 4;
- + }
- + }
- +
- +
- + /* add T.Tazaki 2004/08/19 <<< */
- +#endif /* EXT_REMOVE */
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + /* NO Register */
- + /* Are there any symbol and IMM which follow a register? */
- +
- + /* Pattern */
- + /* [rb+imm32] */
- +
- + /* Skip Space */
- + while (isspace (*input_line_pointer))
- + ++input_line_pointer;
- +
- + /* IF ']' */
- + if (*input_line_pointer == ']'){
- + /* YES Register Only */
- + #if 0
- + errmsg = _("invalid operand");
- + #else
- + input_line_pointer++;
- + #endif
- + }
- + /* ELSE IF plus */
- + else if (*input_line_pointer == '+'){
- + /* YES plus */
- +
- + input_line_pointer++;
- + /* symbol,imm */
- + expression (& ext_ex);
- +
- + if (ext_ex.X_op == O_constant){
- + /* [%rd+imm26] */
- +
- + uiNumber = ext_ex.X_add_number;
- +
- + if (uiNumber == 0){
- + /* EMPTY */
- + }
- + else if (uiNumber <= 0x1fff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else if (uiNumber <= 0x3ffffff){
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
- + }
- + else {
- + /* NO more than 27bit ? */
- +
- + /* tnot support */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO not immidiate */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + else {
- + /* NO any other character */
- + /* error */
- + errmsg = _("invalid operand");
- + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- + /* an operand -- the register with a post increment -- or [ being indirect ] */
- + else if ((operand->flags & C33_OPERAND_REGINC) != 0)
- + {
- + if (*str == '['){
- + str++;
- + input_line_pointer = str;
- +
- + if (!register_name (& ex))
- + {
- + errmsg = _("invalid register name");
- + }
- + else {
- + str = input_line_pointer;
- +
- + /* Skip space */
- + while (isspace (*str))
- + ++str;
- +
- + if (*str == ']'){
- + ++str;
- +
- + while (isspace (*str))
- + ++str;
- +
- + if (*str == '+'){
- + /* normal end */
- + str++;
- + input_line_pointer = str;
- +
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + else {
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- +
- + /* Register indirectness with the De Dis placement */
- + else if ((operand->flags & C33_OPERAND_SPMEM) != 0)
- + {
- + if (*str == '['){
- + str++;
- + /* Skip space */
- + while (isspace (*str))
- + ++str;
- +
- + input_line_pointer = str;
- +
- + /* check %sp */
- + if ( ( strncmp(str,"%sp",3) != 0 ) && ( strncmp(str,"%SP",3) != 0 ))
- + {
- + /* YES */
- + errmsg = _("invalid system register name");
- + }
- + else {
- + str+=3;
- + while (isspace (*str))
- + ++str;
- +
- + /* IF ']' */
- + if (*str == ']'){
- + /* YES only register */
- + /* Support "[%sp]" 2001.3.29 ide */
- + ex.X_op = O_constant;
- + ex.X_add_symbol = NULL;
- + ex.X_op_symbol = NULL;
- + ex.X_add_number = 0;
- + str++;
- + input_line_pointer = str;
- + }
- + else if (*str == '+'){
- + /* [sp+imm] */
- + str++;
- + input_line_pointer = str;
- +
- + expression (& ex);
- +
- + iNumber = ex.X_add_number;
- +
- + if (operand->range <= 6){
- + /* EMPTY */
- + }
- + else if (operand->range == 32) {
- + /* update tazaki 2002.03.08 >>> */
- + if (opcode->specialFlag == 1){
- + /* ld.b */
- + if ((unsigned int)iNumber <= 0x3f){
- + ex.X_add_number /= 1;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 2){
- + /* ld.h */
- + if ((unsigned int)iNumber <= 0x7f){
- + ex.X_add_number /= 2;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + else if (opcode->specialFlag == 4){
- + /* ld.w */
- + if ((unsigned int)iNumber <= 0xff){
- + ex.X_add_number /= 4;
- +
- + }else if ((unsigned int)iNumber <= 0x7ffff){
- + /* 1 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 1;
- + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + else {
- + /* 2 ext */
- + opcode = (struct c33_opcode *)c33_ext_opcodes;
- + extra_data_befor_insn = true;
- + extra_data_len = 2;
- + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
- + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
- + ex.X_add_number = iNumber & 0x3f;
- + }
- + }
- + /* update tazaki 2002.03.08 <<< */
- + }
- + else {
- + errmsg = _("constant too big to fit into instruction");
- + }
- + }
- + else{
- + errmsg = _("invalid operand");
- + }
- + }
- + }
- + else
- + errmsg = _("invalid operand");
- + }
- +
- + if (errmsg)
- + goto error;
- +
- + switch (ex.X_op)
- + {
- + case O_cond:
- + /* An operand and an operation code are made into a command code. */
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + break;
- + case O_op_shift:
- + /* An operand and an operation code are made into a command code. */
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + break;
- + case O_spregister :
- + /* Don't add %sp to a formula as an operand. */
- + break;
- + case O_dpregister :
- + /* Don't add %sp to a formula as an operand. */
- + break;
- + case O_illegal:
- + errmsg = _("illegal operand");
- + goto error;
- + case O_absent:
- + errmsg = _("missing operand");
- + goto error;
- + case O_register:
- + /* An operand and an operation code are made into a command code. */
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
- + {
- + if( g_iXload_range == 26 ) /* xld.x */
- + {
- + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- +
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[insn_idx_low] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[insn_idx_load] = (extraInsnBuf[insn_idx_load] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[insn_idx_pop] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[insn_idx_pop] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + /* g_iXload_range = 19 : ald.x */
- + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- +
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[insn_idx_low] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[insn_idx_load] = (extraInsnBuf[insn_idx_load] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[insn_idx_pop] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[insn_idx_pop] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iXload = 0;
- + g_iXload_range = 0;
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- + /* add T.Tazaki 2004/08/19 >>> */
- + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
- + {
- + if( g_iXload_range == 26 ) /* xld.x */
- + {
- + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[3] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[4] = (extraInsnBuf[4] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[5] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[5] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + /* g_iXload_range = 19 : ald.x */
- + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
- + {
- +
- + /* change %r0 --> %r1 */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
- + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[0] = 0x0011; /* push %r1 */
- + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
- + }
- + extraInsnBuf[2] = 0x6c01; /* ld.w %r1,symbol+imm */
- + extraInsnBuf[3] = (extraInsnBuf[3] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
- + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
- + {
- + extraInsnBuf[4] = 0x0241; /* popn %r1 */
- + insn = 0x0241;
- + }
- + else
- + {
- + /* ADV or PE */
- + extraInsnBuf[4] = 0x0051; /* pop %r1 */
- + insn = 0x0051;
- + }
- + }
- + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iXload = 0;
- + g_iXload_range = 0;
- + }
- + /* add T.Tazaki 2004/08/19 <<< */
- +#endif /* EXT_REMOVE */
- + else
- + {
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + break;
- +
- + case O_constant:
- + /* An operand and an operation code are made into a command code. */
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + if (g_iBitTest == 1) /* bit test inst ? */
- + {
- + if( g_iBitTest_range == 26 )
- + {
- + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iBitTest = 0;
- + g_iBitTest_range = 0;
- + }
- +#else
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- + /* add T.Tazaki 2004/07/30 >>> */
- + if (g_iBitTest == 1) /* bit test inst ? */
- + {
- + if( g_iBitTest_range == 26 )
- + {
- +
- + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + else
- + {
- + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + g_iBitTest = 0;
- + g_iBitTest_range = 0;
- + }
- + /* add T.Tazaki 2004/07/30 <<< */
- +#endif /* EXT_REMOVE */
- + else
- + {
- + insn = c33_insert_operand (insn, operand, ex.X_add_number,
- + (char *) NULL, 0,
- + copy_of_instruction,flags);
- + }
- + break;
- +
- + case O_symbol:
- + /* We need to generate a fixup for this expression. */
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opindex_ptr;
- + fixups[ fc ].reloc = reloc;
- + ++fc;
- + break;
- +
- + default:
- + /* We need to generate a fixup for this expression. */
- + if (fc >= MAX_INSN_FIXUPS)
- + as_fatal (_("too many fixups"));
- +
- + fixups[ fc ].exp = ex;
- + fixups[ fc ].opindex = * opindex_ptr;
- + fixups[ fc ].reloc = BFD_RELOC_UNUSED;
- + ++fc;
- + break;
- + }
- + }
- + str = input_line_pointer;
- + input_line_pointer = hold;
- +
- + while (*str == ' ' || *str == ',' || *str == ']' )
- + ++str;
- + }
- + match = 1;
- +
- + error:
- + if (match == 0)
- + {
- +
- + /* xld.w rd,[rs+imm26] : imm26 > 0x3ffffff ? add tazaki 2001.10.11 */
- + if( iMEM_IMM26_flag == 0 ){ /* The following operand form is not seen at the time of range over.。*/
- + next_opcode = opcode + 1;
- + if (next_opcode->name != NULL
- + && strcmp (next_opcode->name, opcode->name) == 0)
- + {
- + opcode = next_opcode;
- + continue;
- + }
- + }
- + as_bad (_("%s: %s"), copy_of_instruction, errmsg);
- +/* as_bad ("%s: %s", copy_of_instruction, errmsg); Modify tazaki 2001.10.11 */
- +
- + if (* input_line_pointer == ']')
- + ++ input_line_pointer;
- +
- + ignore_rest_of_line ();
- + input_line_pointer = saved_input_line_pointer;
- + return;
- + }
- + break;
- + }
- +
- + while (isspace (*str))
- + ++str;
- +
- + if (*str != '\0')
- + /* xgettext:c-format */
- + as_bad (_("junk at end of line: `%s'"), str);
- +
- + input_line_pointer = str;
- +
- + /* Write out the instruction. */
- +
- + if (relaxable && fc > 0)
- + {
- +
- + fc = 0;
- +
- + if (!strcmp (opcode->name, "br"))
- + {
- + f = frag_var (rs_machine_dependent, 4, 2, 2,
- + fixups[0].exp.X_add_symbol,
- + fixups[0].exp.X_add_number,
- + (char *)fixups[0].opindex);
- + md_number_to_chars (f, insn, 2);
- + md_number_to_chars (f + 2, 0, 2);
- + }
- + else
- + {
- + f = frag_var (rs_machine_dependent, 6, 4, 0,
- + fixups[0].exp.X_add_symbol,
- + fixups[0].exp.X_add_number,
- + (char *)fixups[0].opindex);
- + md_number_to_chars (f, insn, 2);
- + md_number_to_chars (f + 2, 0, 4);
- + }
- + }
- + else
- + {
- + /* ext command is set before a command code formula. . */
- + if (extra_data_befor_insn)
- + {
- + /* Domain reservation */
- + f = where = frag_more (extra_data_len*2+2); /* 2byte length instruction */
- +
- + /* The command code for extension (ext command) is acquired. */
- + fromP = &extraInsnBuf[0];
- +
- + /* Only a part for the command code for FOR extensio */
- + for (i = extra_data_len; i; --i)
- + {
- + /* The command code is stored in the buffer in order. */
- + md_number_to_chars (where, (long) (*fromP), 2);
- + where += 2;
- + fromP++;
- + }
- +
- +// ADD D.Fujimoto 2007/06/25 calculating inst offset for ext remove >>>>>>>
- +#ifdef EXT_REMOVE
- + ul_All_Offset += extra_data_len;
- +#endif /* EXT_REMOVE */
- +// ADD D.Fujimoto 2007/06/25 calculating inst offset for ext remove <<<<<<<
- +
- +
- + extra_data_befor_insn = false;
- + }
- + else {
- + /* Domain reservation */
- + f = where = frag_more (2); /* 2byte length instruction */
- + }
- +
- + /* >>> add tazaki 2001.09.13 */
- + /* macclr,ld.cf ? */
- + if (opcode->specialFlag == 10){
- + insn |= 0x0010; /* bit 5,4 = 0,1 set */
- + }
- + /* <<< add tazaki 2001.09.13 */
- +
- + /* The command code of 2 byte length is stored in a buffer. */
- + md_number_to_chars (where, insn, 2);
- + }
- +
- + /* Create any fixups. At this point we do not use a
- + bfd_reloc_code_real_type, but instead just use the
- + BFD_RELOC_UNUSED plus the operand index. This lets us easily
- + handle fixups for any operand type, although that is admittedly
- + not a very exciting feature. We pick a BFD reloc type in
- + md_apply_fix. */
- + for (i = 0; i < fc; i++)
- + {
- + const struct c33_operand * operand;
- + bfd_reloc_code_real_type reloc;
- +
- + operand = & c33_operands[ fixups[i].opindex ];
- +
- + reloc = fixups[i].reloc;
- +
- + if (reloc != BFD_RELOC_UNUSED)
- + {
- + reloc_howto_type * reloc_howto = bfd_reloc_type_lookup (stdoutput,
- + reloc);
- + int size;
- + int address;
- + fixS * fixP;
- +
- + if (!reloc_howto){
- + ;
- + /* abort(); */ /* del tazaki 2001.10.11 */
- + }else{
- +
- + size = bfd_get_reloc_size (reloc_howto);
- +
- + if (size != 2) {
- + ;
- + /* abort (); */ /* del tazaki 2001.10.11 */
- + }else{
- +
- + address = (f - frag_now->fr_literal) + 2 - size;
- +
- + f += 2;
- +
- + fixP = fix_new_exp (frag_now, address, size,
- + & fixups[i].exp,
- + reloc_howto->pc_relative,
- + reloc);
- +
- + switch (reloc)
- + {
- + case BFD_RELOC_C33_RH:
- + case BFD_RELOC_C33_RM:
- + case BFD_RELOC_C33_RL:
- + case BFD_RELOC_C33_S_RH: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_S_RM: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_S_RL: /* add T.Tazaki 2002.05.02 */
- + case BFD_RELOC_C33_JP: /* add T.Tazaki 2002.04.22 */
- + case BFD_RELOC_C33_AH:
- + case BFD_RELOC_C33_AL:
- + case BFD_RELOC_C33_H:
- + case BFD_RELOC_C33_M:
- + case BFD_RELOC_C33_L:
- + /* >>>> add 2002.03.05 tazaki */
- + case BFD_RELOC_C33_DH:
- + case BFD_RELOC_C33_DL:
- + case BFD_RELOC_C33_GL:
- + case BFD_RELOC_C33_SH:
- + case BFD_RELOC_C33_SL:
- + case BFD_RELOC_C33_TH:
- + case BFD_RELOC_C33_TL:
- + case BFD_RELOC_C33_ZH:
- + case BFD_RELOC_C33_ZL:
- + case BFD_RELOC_C33_DPH:
- + case BFD_RELOC_C33_DPM:
- + case BFD_RELOC_C33_DPL:
- + case BFD_RELOC_C33_LOOP:
- + /* <<<< add 2002.03.05 tazaki */
- + case BFD_RELOC_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
- + case BFD_RELOC_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
- + case BFD_RELOC_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
- + fixP->fx_no_overflow = 1;
- + break;
- + default:
- + break;
- + }
- + }
- + }
- + }
- + else
- + {
- + fix_new_exp (
- + frag_now,
- + f - frag_now->fr_literal, 4,
- + & fixups[i].exp,
- + 1 /* FIXME: C33_OPERAND_RELATIVE ??? */,
- + (bfd_reloc_code_real_type) (fixups[i].opindex
- + + (int) BFD_RELOC_UNUSED)
- + );
- + }
- + }
- +
- + input_line_pointer = saved_input_line_pointer;
- +}
- +
- +
- +/* If while processing a fixup, a reloc really needs to be created */
- +/* then it is done here. */
- +
- +arelent *
- +tc_gen_reloc (seg, fixp)
- + asection * seg;
- + fixS * fixp;
- +{
- + arelent * reloc;
- +
- + reloc = (arelent *) xmalloc (sizeof (arelent));
- + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
- + *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
- + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- +
- + if (reloc->howto == (reloc_howto_type *) NULL)
- + {
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + /* xgettext:c-format */
- + _("reloc %d not supported by object file format"),
- + (int) fixp->fx_r_type);
- +
- + xfree (reloc);
- +
- + return NULL;
- + }
- +
- + reloc->addend = fixp->fx_addnumber;
- +
- + return reloc;
- +}
- +
- +/* Assume everything will fit in two bytes, then expand as necessary. */
- +int
- +md_estimate_size_before_relax (fragp, seg)
- + fragS * fragp;
- + asection * seg;
- +{
- + if (fragp->fr_subtype == 0)
- + fragp->fr_var = 4;
- + else if (fragp->fr_subtype == 2)
- + fragp->fr_var = 2;
- + else
- + abort ();
- + return 2;
- +}
- +
- +long
- +c33_pcrel_from_section (fixp, section)
- + fixS * fixp;
- + segT section;
- +{
- + /* If the symbol is undefined, or in a section other than our own,
- + or it is weak (in which case it may well be in another section,
- + then let the linker figure it out. */
- + if (fixp->fx_addsy != (symbolS *) NULL
- + && (! S_IS_DEFINED (fixp->fx_addsy)
- + || S_IS_WEAK (fixp->fx_addsy)
- + || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
- + return 0;
- +
- + return fixp->fx_frag->fr_address + fixp->fx_where;
- +}
- +
- +/*
- +The symbol which can be decided inside a file is decided here.
- +
- +The tc_gen_reloc function which is in bfd library further is passed,
- + and, finally the symbol changed by referring to the exterior, the link,
- + and relocation is on HOWTO broad view of bfd.
- + It is processed by the defined method.
- +*/
- +
- +/* add T.Tazaki 2002.04.25 >>> */
- +long g_where_rh = 0xffffffff;
- +long g_where_rm = 0xffffffff;
- +
- +char *g_pwhere_rh = 0;
- +char *g_pwhere_rm = 0;
- +
- +/* add T.Tazaki 2002.04.25 <<< */
- +
- +int
- +md_apply_fix3 (fixp, valuep, seg)
- + fixS * fixp;
- + valueT * valuep;
- + segT seg;
- +{
- + valueT value;
- + char * where;
- + long insn;
- + int iNumber; /* add T.Tazaki 2002.04.25 */
- + long lNumber; /* add T.Tazaki 2002.04.25 */
- +
- + if (fixp->fx_addsy == (symbolS *) NULL)
- + {
- + value = * valuep;
- + fixp->fx_done = 1;
- + }
- + else if (fixp->fx_pcrel)
- + value = * valuep;
- + else
- + {
- + value = fixp->fx_offset;
- + if (fixp->fx_subsy != (symbolS *) NULL)
- + {
- + if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- + value -= S_GET_VALUE (fixp->fx_subsy);
- + else
- + {
- + /* We don't actually support subtracting a symbol. */
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + _("expression too complex"));
- + }
- + }
- + }
- +
- + if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
- + {
- + int opindex;
- + const struct c33_operand * operand;
- + unsigned long insn;
- +
- + opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
- + operand = & c33_operands[ opindex ];
- +
- + /* Fetch the instruction, insert the fully resolved operand
- + value, and stuff the instruction back again.
- +
- + Note the instruction has been stored in little endian
- + format! */
- + where = fixp->fx_frag->fr_literal + fixp->fx_where;
- +
- + insn = bfd_getl16 ((unsigned char *) where);
- + insn = c33_insert_operand (insn, operand, (offsetT) value,
- + fixp->fx_file, fixp->fx_line, NULL);
- + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
- +
- + if (fixp->fx_done)
- + {
- + /* Nothing else to do here. */
- + return 1;
- + }
- + }
- + else if (fixp->fx_done)
- + {
- + /* We still have to insert the value into memory! */
- + where = fixp->fx_frag->fr_literal + fixp->fx_where;
- +
- + if (fixp->fx_size == 1)
- + * where = value & 0xff;
- + else if (fixp->fx_size == 2){
- +
- + /* An address when a symbol is decided is buried here
- + and crowded with the inside of a file. */
- +
- + /* A command code is acquired. */
- + insn = bfd_getl16 ((unsigned char *) where);
- +
- + switch (fixp->fx_r_type)
- + {
- + case BFD_RELOC_C33_AH: /* @ah (25:13) */ /* NO USE : Absolute symbol */
- +
- + insn += ((value >> 13) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_AL: /* @ah (12:0) */ /* NO USE : Absolute symbol */
- + insn += (value & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_RH: /* LABEL-PC(31:22) */
- +// if( g_listing == 0 ){ /* No -a option ? */
- +// g_where_rh = fixp->fx_where;
- +// }
- +// else{
- +// g_pwhere_rh = where;
- +// }
- +//
- + insn += (((value - 4) >> 19) & 0x1ff8);
- + break;
- +
- + case BFD_RELOC_C33_RM: /* LABEL-PC(21:9) */
- +
- +// if( g_listing == 0 ){ /* No -a option ? */
- +//
- +// g_where_rm = fixp->fx_where;
- +// if( g_where_rh != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
- +//
- +// lNumber = value;
- +// /* over signed 22bit ? */
- +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_where_rh = 0xffffffff;
- +// }
- +// else
- +// {
- +// g_pwhere_rm = where;
- +// if( g_pwhere_rh != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
- +//
- +// lNumber = value;
- +// /* over signed 22bit ? */
- +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_pwhere_rh = 0;
- +// }
- + insn += (((value - 2) >> 9) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_RL: /* LABEL-PC(8:0) */
- +
- +// -al オプション付きのとき、where値が必ずしも@rm のPC+100とは限らないため、不採用。
- +// -al無し( fixp->fx_where )ではOKだが、-alの有無でワーニング表示が異なるのは変なので両方削除した。
- +
- +// if( g_listing == 0 ){ /* No -a option ? */
- +//
- +// if( g_where_rm != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
- +//
- +// lNumber = value;
- +// /* over signed 8bit ? */
- +// if (lNumber > 254 || lNumber < -256)
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_where_rh = 0xffffffff;
- +// g_where_rm = 0xffffffff;
- +// }
- +// else
- +// {
- +//
- +// if( g_pwhere_rm != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
- +//
- +// lNumber = value;
- +// /* over signed 8bit ? */
- +// if (lNumber > 254 || lNumber < -256)
- +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +// /* as_bad_where = ERROR */
- +// }
- +// g_pwhere_rh = 0;
- +// g_pwhere_rm = 0;
- +// }
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- +/* add T.Tazaki 2002.05.02 >>> */
- +
- + case BFD_RELOC_C33_S_RH: /* LABEL-PC(31:22) */ /* sjp,scall, xjp,xcall */
- + g_where_rh = fixp->fx_where;
- +
- + insn += (((value - 4) >> 19) & 0x1ff8);
- + break;
- +
- + case BFD_RELOC_C33_S_RM: /* LABEL-PC(21:9) */ /* sjp,scall, xjp,xcall */
- +
- + g_where_rm = fixp->fx_where;
- + if( g_where_rh != ( fixp->fx_where - 2 ) ){
- +
- + lNumber = value;
- + /* over signed 22bit ? */
- + if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
- + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- + /* as_bad_where = ERROR */
- + }
- + g_where_rh = 0xffffffff;
- + insn += (((value - 2) >> 9) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_S_RL: /* LABEL-PC(8:0) */ /* sjp,scall, xjp,xcall */
- +
- + if( g_where_rm != ( fixp->fx_where - 2 ) ){
- +
- + lNumber = value;
- + /* over signed 8bit ? */
- + if (lNumber > 254 || lNumber < -256)
- + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- + /* as_bad_where = ERROR */
- + }
- + g_where_rh = 0xffffffff;
- + g_where_rm = 0xffffffff;
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- +/* add T.Tazaki 2002.05.02 <<< */
- +
- + case BFD_RELOC_C33_JP: /* LABEL-PC(8:0) */ /* add T.Tazaki 2002.04.22 */
- + /* jp label */
- +
- + /* over signed 8bit ? */
- + iNumber = value;
- +
- + if (iNumber > 254 || iNumber < -256)
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +
- + insn += ((value >> 1) & 0xff);
- + break;
- +
- + case BFD_RELOC_C33_H: /* LABEL(31:19) */ /* NO USE : Absolute symbol */
- + insn += ((value >> 19) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_M: /* LABEL(18:6) */ /* NO USE : Absolute symbol */
- + insn += ((value >> 6) & 0x1fff);
- + break;
- +
- + case BFD_RELOC_C33_L: /* LABEL(5:0) */ /* NO USE : Absolute symbol */
- + /* ld.w rd,LABEL@l */
- + insn += (value & 0x3f) << 4;
- + break;
- +
- + case BFD_RELOC_C33_LOOP: /* LABEL-PC(4:0) */
- +
- + /* over imm 5bit ? */
- + iNumber = value;
- +
- + if (iNumber > 30 || iNumber < 0)
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
- +
- + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
- + /* " nop " */
- + /* " nop " */
- + /* "Label: " */
- +
- + --value;
- +
- + /* add T.Tazaki 2004/09/22 <<< */
- +
- + /* imm5=imm(4:1) imm5(0)=0 */
- + insn += (value & 0x1e) << 3;
- + break;
- +
- + default:
- + break;
- + }
- +
- + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
- + }
- + else if (fixp->fx_size == 4)
- + bfd_putl32 (value, (unsigned char *) where);
- + }
- +
- + fixp->fx_addnumber = value;
- +
- + return 1;
- +}
- +
- +
- +/* Parse a cons expression. */
- +void
- +parse_cons_expression_c33 (exp)
- + expressionS * exp;
- +{
- + /* See if there's a reloc prefix like hi() we have to handle. */
- + hold_cons_reloc = c33_reloc_prefix ();
- +
- + /* Do normal expression parsing. */
- + expression (exp);
- +}
- +
- +/* Create a fixup for a cons expression. If parse_cons_expression_c33
- + found a reloc prefix, then we use that reloc, else we choose an
- + appropriate one based on the size of the expression. */
- +void
- +cons_fix_new_c33 (frag, where, size, exp)
- + fragS * frag;
- + int where;
- + int size;
- + expressionS *exp;
- +{
- + if (hold_cons_reloc == BFD_RELOC_UNUSED)
- + {
- + if (size == 4)
- + hold_cons_reloc = BFD_RELOC_32;
- + if (size == 2)
- + hold_cons_reloc = BFD_RELOC_16;
- + if (size == 1)
- + hold_cons_reloc = BFD_RELOC_8;
- + }
- +
- + if (exp != NULL)
- + fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc);
- + else
- + fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
- +}
- +
- +boolean
- +c33_fix_adjustable (fixP)
- + fixS * fixP;
- +{
- + if (fixP->fx_addsy == NULL)
- + return 1;
- +
- + /* Prevent all adjustments to global symbols. */
- + if (S_IS_EXTERN (fixP->fx_addsy))
- + return 0;
- +
- + if (S_IS_WEAK (fixP->fx_addsy))
- + return 0;
- +
- + /* Don't adjust function names */
- + if (S_IS_FUNCTION (fixP->fx_addsy))
- + return 0;
- +
- + return 1;
- +}
- +
- +int
- +c33_force_relocation (fixP)
- + struct fix * fixP;
- +{
- + if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
- + return 1;
- +
- + return 0;
- +}
- diff --git a/gas/config/tc-c33.h b/gas/config/tc-c33.h
- new file mode 100644
- index 0000000..98e62d2
- --- /dev/null
- +++ b/gas/config/tc-c33.h
- @@ -0,0 +1,78 @@
- +/* tc-c33.h -- Header file for tc-c33.c.
- + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- +
- + This file is part of GAS, the GNU Assembler.
- +
- + GAS is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2, or (at your option)
- + any later version.
- +
- + GAS is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with GAS; see the file COPYING. If not, write to the Free
- + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- + 02111-1307, USA. */
- +
- +#define TC_C33
- +
- +#include <elf/c33.h>
- +
- +#define TARGET_BYTES_BIG_ENDIAN 0
- +
- +#ifndef BFD_ASSEMBLER
- + #error C33 support requires BFD_ASSEMBLER
- +#endif
- +
- +/* The target BFD architecture. */
- +#define TARGET_ARCH bfd_arch_c33
- +
- +/* The target BFD format. */
- +#define TARGET_FORMAT "elf32-c33"
- +
- +#define MD_APPLY_FIX3
- +
- +#define md_operand(x)
- +
- +#define obj_fix_adjustable(fixP) c33_fix_adjustable(fixP)
- +#define TC_FORCE_RELOCATION(fixp) c33_force_relocation(fixp)
- +extern int c33_force_relocation PARAMS ((struct fix *));
- +
- +/* Permit temporary numeric labels. */
- +#define LOCAL_LABELS_FB 1
- +
- +#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
- +
- +/* We don't need to handle .word strangely. */
- +#define WORKING_DOT_WORD
- +
- +#define md_number_to_chars number_to_chars_littleendian
- +
- +/* We need to handle lo(), hi(), etc etc in .hword, .word, etc
- + directives, so we have to parse "cons" expressions ourselves. */
- +#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_cons_expression_c33 (EXP)
- +#define TC_CONS_FIX_NEW cons_fix_new_c33
- +extern const struct relax_type md_relax_table[];
- +#define TC_GENERIC_RELAX_TABLE md_relax_table
- +
- +/* This section must be in the small data area (pointed to by GP). */
- +#define SHF_C33_GPREL 0x10000000
- +
- +/* tazaki 2001.12.03 */
- +#define ELF_TC_SPECIAL_SECTIONS \
- + { ".comm", SHT_C33_COMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
- + { ".gcomm", SHT_C33_GCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
- + { ".scomm", SHT_C33_SCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
- + { ".tcomm", SHT_C33_TCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
- + { ".zcomm", SHT_C33_ZCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
- +
- +
- +#define MD_PCREL_FROM_SECTION(fixP,section) c33_pcrel_from_section (fixP, section)
- +extern long c33_pcrel_from_section ();
- +
- +#define LEX_PCT LEX_BEGIN_NAME /* %を有効にする */
- +
- diff --git a/gas/configure b/gas/configure
- index 28f69be..d01eb3c 100755
- --- a/gas/configure
- +++ b/gas/configure
- @@ -1641,6 +1641,7 @@ for this_target in $target $canon_targets ; do
- sparc86x*) cpu_type=sparc arch=sparc86x ;;
- sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
- v850*) cpu_type=v850 ;;
- + c33*) cpu_type=c33 ;;
- *) cpu_type=${cpu} ;;
- esac
-
- @@ -1895,6 +1896,8 @@ EOF
- tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
- tic80-*-*) fmt=coff ;;
-
- + c33-*-*) fmt=elf bfd_gas=yes ;;
- +
- v850-*-*) fmt=elf bfd_gas=yes ;;
- v850e-*-*) fmt=elf bfd_gas=yes ;;
- v850ea-*-*) fmt=elf bfd_gas=yes ;;
- diff --git a/gas/configure.in b/gas/configure.in
- index 1707acd..416e10e 100644
- --- a/gas/configure.in
- +++ b/gas/configure.in
- @@ -119,6 +119,7 @@ changequote([,])dnl
- sparc86x*) cpu_type=sparc arch=sparc86x ;;
- sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
- v850*) cpu_type=v850 ;;
- + c33*) cpu_type=c33 ;;
- *) cpu_type=${cpu} ;;
- esac
-
- diff --git a/gas/doc/Makefile.am b/gas/doc/Makefile.am
- index c6eaf77..151e58f 100644
- --- a/gas/doc/Makefile.am
- +++ b/gas/doc/Makefile.am
- @@ -34,6 +34,7 @@ CPU_DOCS = \
- c-sparc.texi \
- c-vax.texi \
- c-v850.texi \
- + c-c33.texi \
- c-z8k.texi
-
- gasver.texi: Makefile
- diff --git a/gas/ext_remove.c b/gas/ext_remove.c
- new file mode 100644
- index 0000000..70f0d87
- --- /dev/null
- +++ b/gas/ext_remove.c
- @@ -0,0 +1,2014 @@
- +/* ext_remove.c - implementation for 2pass assemble.
- + This program will remove redundant ext 0x0 instructions
- + which emerge from memory load from LABEL/SYMBOLS or
- + from function calls to LABEL/SYMBOLS
- + Copyright (C) 2007 SEIKO EPSON CORP.
- +
- + Written by D.Fujimoto@Irumasoft
- + DATE:2007/02/28
- +
- + This file is part of GAS, the GNU Assembler.
- +
- + GAS is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2, or (at your option)
- + any later version.
- +
- + GAS is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with GAS; see the file COPYING. If not, write to the Free
- + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- + 02111-1307, USA.
- +*/
- +#include "as.h"
- +#include "ext_remove.h"
- +
- +int g_c33_ext = 0; // flag indicating that -mc33ext option is specified
- +
- +int i_File_Inf_Flg = 0; // flag indicating that .file pseudo op exists in source file
- + // 0 -- initial vaule
- + // 1 -- ".file" exists.
- +
- +unsigned long g_dpAddress; // address of data pointer(used when no-medda32)
- +
- +// symbols information of current file
- +unsigned long ul_Cur_File_Symbol_Cnt;
- +struct cur_inf** stpp_Cur_Inf = 0;
- +char *cp_Current_File_Name = 0; // pointer for current file name( include path )
- +
- +// symbols information of dump file
- +unsigned long ul_Dump_Symbol_Cnt;
- +struct dump_inf** stpp_Dump_Inf = 0;
- +char *cp_Dump_File_Name = 0; // pointer for dump file name( include path )
- +
- +volatile unsigned long ul_All_Offset = 0; // offset(instruction counts) from all symbol
- +unsigned char uc_Current_All_Symbol[INPUT_CUR_LINE_MAX] = { 0 }; // current symbol( local & global )
- +unsigned char uc_Pre_All_Symbol[INPUT_CUR_LINE_MAX] = { 0 }; // pre symbol( local & global )
- +
- +
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- +// symbols information of all object dump file
- +unsigned long ul_All_Dump_Symbol_Cnt;
- +struct dump_inf** stpp_All_Dump_Inf;
- +char *cp_All_Dump_File_Name; // pointer for all objects' dump file name( include path )
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
- +
- +
- +
- +/*******************************************************************************************
- +Format : unsigned long chg_str_to_val( unsigned char* ucp_chg_ptr );
- +Input : unsigned char* ucp_chg_ptr -- pointer for string( hex code )
- +Return : value converted from string
- +Expnalantion: convert string to value
- +*******************************************************************************************/
- +unsigned long chg_str_to_val( unsigned char* ucp_chg_ptr )
- +{
- + unsigned long ul_ret;
- +
- + ul_ret = 0;
- +
- + while( 1 ){
- + if( ( '0' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= '9' ) ){
- + ul_ret <<= 4;
- + ul_ret |= ( (*ucp_chg_ptr) - 0x30 );
- + } else if( ( 'a' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= 'f' ) ){
- + ul_ret <<= 4;
- + ul_ret |= ( (*ucp_chg_ptr) - 0x57 );
- + } else if( ( 'A' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= 'F' ) ){
- + ul_ret <<= 4;
- + ul_ret |= ( (*ucp_chg_ptr) - 0x37 );
- + } else {
- + break;
- + }
- + ucp_chg_ptr++;
- + }
- +
- + return ul_ret;
- +}
- +
- +/*******************************************************************************************
- +Format : void read_cur_file_info( char *cp_prm_file );
- +Input : char *cp_prm_file -- pointer for current file
- +Return : None
- +Expnalantion: Read source file and get the symbol information of this file.
- +*******************************************************************************************/
- +void read_cur_file_info( char *cp_prm_file )
- +{
- + FILE *f_file;
- + unsigned char uc_wk_buf[INPUT_CUR_LINE_MAX];
- + unsigned char uc_buf[INPUT_CUR_LINE_MAX];
- + unsigned char *ucp_wk;
- + unsigned long ul_cnt;
- + int i_ret,i_len,i_len_2;
- + int i_stab_flg; // 0 -- normal
- + // 1 -- during ".stabs" / ".stabn" line
- +
- + // First, empty reading is carried out and get the total of symbols.
- + f_file = fopen (cp_prm_file, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- +
- + ul_Cur_File_Symbol_Cnt = 0;
- + i_stab_flg = 0;
- + while( 1 ){
- + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
- + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
- + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_wk_buf );
- + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
- +
- + if( i_stab_flg == 1 ){
- + if( ucp_wk != 0 ){
- + i_stab_flg = 0;
- + }
- + } else {
- + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
- + i_ret = chk_is_stab( uc_wk_buf );
- + if( i_ret == 0 ){
- + fprintf (stderr, _("Error : There are too many characters of one line in assembler source file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + i_stab_flg = 1;
- + } else {
- + get_valid_string( uc_wk_buf,uc_buf );
- + i_ret = get_label_info_from_src( uc_buf,uc_wk_buf );
- + if( i_ret != 0 ){
- + ul_Cur_File_Symbol_Cnt++;
- + }
- + }
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- +
- + // Create the heap area for unsigned char*.
- + if( 0 < ul_Cur_File_Symbol_Cnt ){
- + stpp_Cur_Inf = xmalloc( sizeof(struct cur_inf*) * ul_Cur_File_Symbol_Cnt );
- + if( stpp_Cur_Inf == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( stpp_Cur_Inf,0,( sizeof(struct cur_inf*) * ul_Cur_File_Symbol_Cnt ) );
- +
- + // heap for the pointer of each struct cur_inf
- + for( ul_cnt = 0; ul_cnt < ul_Cur_File_Symbol_Cnt; ul_cnt++ ){
- + *(stpp_Cur_Inf+ul_cnt) = xmalloc( sizeof(struct cur_inf) );
- + if( *(stpp_Cur_Inf+ul_cnt) == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( *(stpp_Cur_Inf+ul_cnt),0,( sizeof(struct cur_inf) ) );
- + }
- +
- + // Second, file reopens and get symbol information.
- + f_file = fopen (cp_prm_file, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- +
- + ul_cnt = 0;
- + i_stab_flg = 0;
- + while( 1 ){
- + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
- + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
- + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_wk_buf );
- + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
- +
- + if( i_stab_flg == 1 ){
- + if( ucp_wk != 0 ){
- + i_stab_flg = 0;
- + }
- + } else {
- + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
- + i_ret = chk_is_stab( uc_wk_buf );
- + if( i_ret != 0 ){
- + i_stab_flg = 1;
- + }
- + } else {
- + get_valid_string( uc_wk_buf,uc_buf );
- + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
- + i_ret = get_label_info_from_src( uc_buf,uc_wk_buf );
- + if( i_ret != 0 ){
- + if( i_ret == 2 ){ // ".comm"
- + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 1; // attribute is global
- + }
- +
- + i_len = strlen( uc_wk_buf );
- + (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name = xmalloc( i_len + 1 );
- + if( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,0,( i_len + 1 ) );
- + memcpy( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,uc_wk_buf,i_len );
- +
- + ul_cnt++;
- + }
- + }
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- +
- + // Third, file reopens and get attribute information.
- + f_file = fopen (cp_prm_file, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- +
- + ul_cnt = 0;
- + i_stab_flg = 0;
- + while( 1 ){
- + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
- + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
- + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_wk_buf );
- + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
- +
- + if( i_stab_flg == 1 ){
- + if( ucp_wk != 0 ){
- + i_stab_flg = 0;
- + }
- + } else {
- + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
- + i_ret = chk_is_stab( uc_wk_buf );
- + if( i_ret != 0 ){
- + i_stab_flg = 1;
- + }
- + } else {
- + i_ret = get_attribute_info( uc_wk_buf,uc_buf );
- + if( i_ret != 0 ){
- + i_len_2 = strlen( uc_buf );
- + for( ul_cnt = 0; ul_cnt < ul_Cur_File_Symbol_Cnt; ul_cnt++ ){
- + i_len = strlen( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name );
- + if( i_len == i_len_2 ){
- + if( 0 == memcmp( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,uc_buf,i_len ) ){
- + if( i_ret == 1 ){
- + // ".global"
- + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 1;
- + } else {
- + // ".local"
- + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 0;
- + }
- + break;
- + }
- + }
- + }
- + }
- + }
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
- + xexit (EXIT_FAILURE);
- + }
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void get_valid_string( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt );
- +Input : unsigned char *ucp_rd -- read pointer
- + unsigned char *ucp_wt_pt -- write pointer
- +Return : None
- +Expnalantion: Read buffer and get the valid stirng.
- + Comment / tab / space / cr・lf is excepted.
- + The back of a label name is not gotten even if it is effective.
- +*******************************************************************************************/
- +void get_valid_string( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt )
- +{
- + while( 1 ){
- + if( ( (*ucp_rd_pt) == '\t' ) || ( (*ucp_rd_pt) == ' ' ) ){
- + // skip
- + ;
- + } else if ( ( (*ucp_rd_pt) == ';' ) || ( (*ucp_rd_pt) == '#' ) ) {
- + // this is comment
- + break;
- + } else if ( ( (*ucp_rd_pt) == '\r' ) || ( (*ucp_rd_pt) == '\n' ) ) {
- + // this is cr/lf
- + break;
- + } else {
- + *ucp_wt_pt = *ucp_rd_pt;
- + ucp_wt_pt++;
- + if( (*ucp_rd_pt) == ':' ){
- + // this is the end of label
- + break;
- + }
- + }
- + ucp_rd_pt++;
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int get_label_info_from_src( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt );
- +Input : unsigned char *uc_rd_pt -- pointer for read data
- + unsigned char *uc_wt_pt -- pointer for write data
- +Return : 0 -- normal
- + 1 -- the contents of this buffer is label( "xxxx:" )
- + 1 -- the contents of this buffer is label( ".comm" )
- +Expnalantion: Read the buffer and check whether it is label.
- + The key word is "xxxx:" or ".comm".
- + If it is "xxxx:", ':' is replaced to '\0'.
- + If it is ".commxxxxxx,n,n", it is replaced to "xxxxxx".
- +*******************************************************************************************/
- +int get_label_info_from_src( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt )
- +{
- + int i_ret,i_len,i_len_2;
- +
- + i_ret = 0;
- +
- + if( 0 == strchr( uc_rd_pt,'"' ) ){ // exclude if it contains '"'
- +
- + i_len = strlen( uc_rd_pt );
- +
- + if( 2 <= i_len ){ // the smalles pattern is "x:"
- + if( uc_rd_pt[i_len-1] == ':' ){
- + // "xxxx:"
- + memcpy( uc_wt_pt,uc_rd_pt,i_len-1 );
- + uc_wt_pt[i_len-1] = '\0';
- + i_ret = 1;
- + }
- + }
- +
- + if( i_ret == 0 ){
- + if( 5 <= i_len ){
- + if( 0 == memcmp( ".comm",uc_rd_pt,5 ) ){
- + // ".commxxxxxx,n,n"
- + i_len_2 = strcspn( uc_rd_pt,"," );
- + if( 0 < i_len_2 ){
- + memcpy( uc_wt_pt,(uc_rd_pt+5),(i_len_2-5 ) );
- + i_ret = 2;
- + }
- + }
- + }
- + }
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int get_attribute_info( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt );
- +Input : unsigned char *ucp_rd_pt -- pointer for read buffer
- + unsigned char *ucp_wt_pt -- pointer for write buffer
- +Return : 0 -- normal
- + 1 -- the contents of read buffer is global label
- + 2 -- the contents of read buffer is local label
- +Expnalantion: Read the buffer and check whether it is global label.
- + The key word is ".global" or ".local".
- +*******************************************************************************************/
- +int get_attribute_info( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt )
- +{
- + int i_ret;
- + int i_chk_flg;
- +
- + i_ret = 0;
- + i_chk_flg = 0;
- + while( 1 ){
- + if( ( (*ucp_rd_pt) == '\t' ) || ( (*ucp_rd_pt) == ' ' ) ){
- + // skip
- + ;
- + } else if ( 0 == memcmp( ".global",ucp_rd_pt,7 ) ) {
- + i_chk_flg = 1; // we find the key word
- + ucp_rd_pt += 7;
- +
- + } else if ( 0 == memcmp( ".local",ucp_rd_pt,6 ) ) {
- + i_chk_flg = 2; // we find the key word
- + ucp_rd_pt += 6;
- +
- + } else if ( ( (*ucp_rd_pt) == '\r' ) || ( (*ucp_rd_pt) == '\n' ) ) {
- + // this is cr/lf
- + break;
- + } else if ( ( (*ucp_rd_pt) == ';' ) || ( (*ucp_rd_pt) == '#' ) ) {
- + // this is comment
- + break;
- + } else {
- + if( i_chk_flg == 0 ){
- + break;
- + } else {
- + *ucp_wt_pt = *ucp_rd_pt;
- + ucp_wt_pt++;
- + i_ret = i_chk_flg;
- + }
- + }
- + ucp_rd_pt++;
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void free_cur_info();
- +Input : None
- +Return : None
- +Expnalantion: Free the heap area for the current file information.
- +*******************************************************************************************/
- +void free_cur_info()
- +{
- + unsigned long ul;
- +
- + if( stpp_Cur_Inf != 0 ){
- +
- + for( ul = 0; ul < ul_Cur_File_Symbol_Cnt; ul++ ){
- +
- + if( *(stpp_Cur_Inf+ul) != 0 ){
- +
- + if( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name != 0 ){
- +
- + // free member pointer
- + free( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name );
- + }
- +
- + // free the pointer of each struct cur_inf
- + free( *(stpp_Cur_Inf+ul) );
- + }
- + }
- +
- + // free the pointer of the pointer of struct cur_inf
- + free( stpp_Cur_Inf );
- + stpp_Cur_Inf = 0;
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void free_ext_heap_area();
- +Input : None
- +Return : None
- +Expnalantion: Free the heap area for ext process.
- +*******************************************************************************************/
- +void free_ext_heap_area()
- +{
- + free_cur_info();
- + free_dump_info();
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- + free_all_dump_info();
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
- +
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void read_dump_info( char* cp_dump_file_name,char* cp_out_file_name );
- +Input : char* cp_dump_file_name -- dump file name( include path )
- + char* cp_out_file_name -- output file name( include path )
- +Return : None
- +Expnalantion: Read the dump file, and get the symbol information which belongs current file
- + and is local symbol only.
- +*******************************************************************************************/
- +void read_dump_info( char* cp_dump_file_name, char* cp_out_file_name )
- +{
- + #define INPUT_DUMP_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a dump file
- +
- + FILE *f_file;
- + unsigned char uc_buf[INPUT_DUMP_LINE_MAX];
- + int i_chk_sts; // 0 -- default
- + // 1 -- check the file name
- + // 2 -- get the area information and the symbol information
- + unsigned char *ucp_wk;
- + char* cp_out_file_pt;
- + int i_cur_file_len;
- + unsigned long ul_cnt;
- + unsigned char uc_format_chk_buf[] = { "SYMBOL TABLE:" };
- + int i_len,i_chk_cnt;
- +
- + cp_out_file_pt = strrchr( cp_out_file_name,'/' );
- +
- + if( cp_out_file_pt != 0 ){
- + cp_out_file_pt++;
- + } else {
- + cp_out_file_pt = cp_out_file_name;
- + }
- + i_cur_file_len = strcspn( cp_out_file_pt,"." );
- +
- + // First, empty reading is carried out and get the total of symbols.
- + // A format check is also performed.
- + f_file = fopen (cp_dump_file_name, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + ul_Dump_Symbol_Cnt = 0;
- + i_chk_sts = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
- + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + switch( i_chk_sts ){
- + case 0:
- + // *** check the dump file format ***
- + i_len = strcspn( uc_buf,"\r\n" );
- + if( i_len == 13 ){
- + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
- + i_chk_sts++;
- + }
- + }
- + break;
- + case 1:
- + // *** check the file name ***
- + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
- + ucp_wk = strrchr( uc_buf,' ' );
- + ucp_wk++;
- + i_len = strcspn( ucp_wk,".\r\n" );
- + if( i_cur_file_len == i_len ){
- + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
- + i_chk_sts++;
- + }
- + }
- + }
- + break;
- + case 2:
- + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + ul_Dump_Symbol_Cnt++;
- + }
- + i_chk_sts++;
- + } else {
- + // *** get the area information and the symbol information ***
- + // *** cuurent local syombol & global symbol ***
- + if( ( uc_buf[9] == 'l' ) || ( uc_buf[9] == 'g' ) ){
- + ul_Dump_Symbol_Cnt++;
- + }
- + }
- + break;
- + case 3:
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + ul_Dump_Symbol_Cnt++;
- + }
- + break;
- + default:
- + ;
- + break;
- + }
- + }
- +
- + if( i_chk_sts == 0 ){
- + fprintf (stderr, _("Error : The format of the dump file is invalid.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
- + xexit (EXIT_FAILURE);
- + }
- +
- + if( 0 < ul_Dump_Symbol_Cnt ){
- + // Second, file reopens and check whether there is any file of a same name.
- + f_file = fopen (cp_dump_file_name, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + i_chk_cnt = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
- + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + // *** check the file name ***
- + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
- + ucp_wk = strrchr( uc_buf,' ' );
- + ucp_wk++;
- + i_len = strcspn( ucp_wk,".\r\n" );
- + if( i_cur_file_len == i_len ){
- + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
- + i_chk_cnt++;
- + }
- + }
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
- + xexit (EXIT_FAILURE);
- + }
- +
- + if( 1 < i_chk_cnt ){
- + ul_Dump_Symbol_Cnt = 0;
- + }
- + }
- +
- + // Create the heap area for struct dump_inf.
- + // heap for the pointer of the pointer of struct dump_inf
- + if( 0 < ul_Dump_Symbol_Cnt ){
- + stpp_Dump_Inf = xmalloc( sizeof(struct dump_inf*) * ul_Dump_Symbol_Cnt );
- + if( stpp_Dump_Inf == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( stpp_Dump_Inf,0,( sizeof(struct dump_inf*) * ul_Dump_Symbol_Cnt ) );
- +
- + // heap for the pointer of each struct dump_inf
- + for( ul_cnt = 0; ul_cnt < ul_Dump_Symbol_Cnt; ul_cnt++ ){
- + *(stpp_Dump_Inf+ul_cnt) = xmalloc( sizeof(struct dump_inf) );
- + if( *(stpp_Dump_Inf+ul_cnt) == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( *(stpp_Dump_Inf+ul_cnt),0,( sizeof(struct dump_inf) ) );
- + }
- +
- +
- + // Third, file reopens and get symbol information.
- + f_file = fopen (cp_dump_file_name, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + i_chk_sts = 0;
- + ul_cnt = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
- + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + switch( i_chk_sts ){
- + case 0:
- + // *** check the dump file format ***
- + i_len = strcspn( uc_buf,"\r\n" );
- + if( i_len == 13 ){
- + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
- + i_chk_sts++;
- + }
- + }
- + break;
- + case 1:
- + // *** check the file name ***
- + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
- + ucp_wk = strrchr( uc_buf,' ' );
- + ucp_wk++;
- + i_len = strcspn( ucp_wk,".\r\n" );
- + if( i_cur_file_len == i_len ){
- + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
- + i_chk_sts++;
- + }
- + }
- + }
- + break;
- + case 2:
- + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
- + ul_cnt++;
- + }
- + i_chk_sts++;
- + } else {
- + // *** get the area information and the symbol information ***
- + // *** cuurent local syombol & global symbol ***
- + if( ( uc_buf[9] == 'l' ) || ( uc_buf[9] == 'g' ) ){
- + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
- + ul_cnt++;
- + }
- + }
- + break;
- + case 3:
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
- + ul_cnt++;
- + }
- + break;
- + default:
- + ;
- + break;
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
- + xexit (EXIT_FAILURE);
- + }
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf );
- +Input : unsigned char *ucp_rd_pt -- pointer for read data
- + struct dump_inf **stpp_prm_dump_inf -- pointer of pointer for struct dump_inf
- +Return : None
- +Expnalantion: Read data and get the symbol information from dump file.
- +*******************************************************************************************/
- +void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf )
- +{
- + unsigned long ul_len;
- + char* cp_pt;
- +
- + // address
- + (*stpp_prm_dump_inf)->ul_Symbol_Addr = chg_str_to_val( &(ucp_rd_pt[0]) );
- + // no address masking
- +
- + // attribute
- + if( ucp_rd_pt[9] == 'g' ){
- + (*stpp_prm_dump_inf)->i_Attribute = 1; // global
- + } else {
- + (*stpp_prm_dump_inf)->i_Attribute = 0; // local
- + }
- +
- + // area
- + ul_len = strcspn( &(ucp_rd_pt[17])," \t" );
- + (*stpp_prm_dump_inf)->ucp_Area_Name = xmalloc( ul_len + 1 );
- + if( (*stpp_prm_dump_inf)->ucp_Area_Name == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( (*stpp_prm_dump_inf)->ucp_Area_Name,0,( ul_len + 1 ) );
- + memcpy( (*stpp_prm_dump_inf)->ucp_Area_Name, &(ucp_rd_pt[17]), ul_len );
- +
- + // symbol name
- + cp_pt = strrchr( ucp_rd_pt,' ' );
- + if( cp_pt != 0 ){
- + cp_pt++;
- + ul_len = strcspn( cp_pt,"\r\n" );
- + (*stpp_prm_dump_inf)->ucp_Symbol_Name = xmalloc( ul_len + 1 );
- + if( (*stpp_prm_dump_inf)->ucp_Symbol_Name == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( (*stpp_prm_dump_inf)->ucp_Symbol_Name,0,( ul_len + 1 ) );
- + memcpy( (*stpp_prm_dump_inf)->ucp_Symbol_Name, cp_pt, ul_len );
- + }
- +
- +/* >>>>> ADDED D.Fujimoto 2007/12/06 get address for .comm */
- + // Special case:
- + // for .comm areas, get the address from the 24rd column of dump file
- + if (strcmp((*stpp_prm_dump_inf)->ucp_Area_Name, ".comm") == 0) {
- + (*stpp_prm_dump_inf)->ul_Symbol_Addr = chg_str_to_val( &(ucp_rd_pt[24]) );
- + }
- +/* <<<<< ADDED D.Fujimoto 2007/12/06 get address for .comm */
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void free_dump_info();
- +Input : None
- +Return : None
- +Expnalantion: Free the heap area for the dump file information.
- +*******************************************************************************************/
- +void free_dump_info()
- +{
- + unsigned long ul;
- +
- + if( stpp_Dump_Inf != 0 ){
- +
- + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
- +
- + if( *(stpp_Dump_Inf+ul) != 0 ){
- +
- + // free member pointer
- + if( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name != 0 ){
- + free( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
- + }
- + if( (*(stpp_Dump_Inf+ul))->ucp_Area_Name != 0 ){
- + free( (*(stpp_Dump_Inf+ul))->ucp_Area_Name );
- + }
- +
- + // free the pointer of each struct dump_inf
- + free( *(stpp_Dump_Inf+ul) );
- + }
- + }
- +
- + // free the pointer of the pointer of struct dump_inf
- + free( stpp_Dump_Inf );
- + stpp_Dump_Inf = 0;
- + }
- +}
- +
- +
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- +/*******************************************************************************************
- +Format : void read_all_dump_info( char* cp_dump_file_name,char* cp_out_file_name );
- +Input : char* cp_dump_file_name -- dump file name( include path )
- + char* cp_out_file_name -- output file name( include path )
- +Return : None
- +Expnalantion: Read the dump file (for all object files), and get the symbol information into
- + the stpp_All_Dump_Inf.
- + This function is derived from read_dump_info().
- + This function uses global symbols and ul_All_Dump_Symbol_Cnt
- +*******************************************************************************************/
- +void read_all_dump_info( char* cp_dump_file_name, char* cp_out_file_name )
- +{
- + #define INPUT_DUMP_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a dump file
- +
- + FILE *f_file;
- + unsigned char uc_buf[INPUT_DUMP_LINE_MAX];
- + int i_chk_sts; // 0 -- default
- + // 1 -- check the file name
- + // 2 -- get the area information and the symbol information
- + unsigned char *ucp_wk;
- + char* cp_out_file_pt;
- + int i_cur_file_len;
- + unsigned long ul_cnt;
- + unsigned char uc_format_chk_buf[] = { "SYMBOL TABLE:" };
- + int i_len,i_chk_cnt;
- + enum CheckStatus status;
- +
- + cp_out_file_pt = strrchr( cp_out_file_name,'/' );
- +
- + if( cp_out_file_pt != 0 ){
- + cp_out_file_pt++;
- + } else {
- + cp_out_file_pt = cp_out_file_name;
- + }
- + i_cur_file_len = strcspn( cp_out_file_pt,"." );
- +
- + // First, empty reading is carried out and get the total of symbols.
- + // A format check is also performed.
- + f_file = fopen (cp_dump_file_name, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + ul_All_Dump_Symbol_Cnt = 0;
- + status = format;
- + i_chk_sts = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
- + fprintf (stderr, _("Error : There are too many characters of one line in all objects\' dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + switch( status ){
- + case format:
- + // *** check the dump file format ***
- + i_len = strcspn( uc_buf,"\r\n" );
- + if( i_len == 13 ){
- + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
- + i_chk_sts++; // format OK
- + status = global;
- + }
- + }
- + break;
- + case global:
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + ul_All_Dump_Symbol_Cnt++;
- + }
- + break;
- + default:
- + // ignore the current line
- + ;
- + break;
- + }
- + }
- +
- + if( i_chk_sts == 0 ){
- + fprintf (stderr, _("Error : The format of the all objects\' dump file is invalid.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
- + xexit (EXIT_FAILURE);
- + }
- +
- +
- + // Create the heap area for struct dump_inf.
- + // heap for the pointer of the pointer of struct dump_inf
- + if( 0 < ul_All_Dump_Symbol_Cnt ){
- + stpp_All_Dump_Inf = xmalloc( sizeof(struct dump_inf*) * ul_All_Dump_Symbol_Cnt );
- + if( stpp_All_Dump_Inf == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( stpp_All_Dump_Inf,0,( sizeof(struct dump_inf*) * ul_All_Dump_Symbol_Cnt ) );
- +
- + // heap for the pointer of each struct dump_inf
- + for( ul_cnt = 0; ul_cnt < ul_All_Dump_Symbol_Cnt; ul_cnt++ ){
- + *(stpp_All_Dump_Inf+ul_cnt) = xmalloc( sizeof(struct dump_inf) );
- + if( *(stpp_All_Dump_Inf+ul_cnt) == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( *(stpp_All_Dump_Inf+ul_cnt),0,( sizeof(struct dump_inf) ) );
- + }
- +
- +
- + // Second, file reopens and get symbol information.
- + f_file = fopen (cp_dump_file_name, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + status = format;
- + i_chk_sts = 0;
- + ul_cnt = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
- + fprintf (stderr, _("Error : There are too many characters of one line in all objects\' dump file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- +
- + switch( status ){
- + case format:
- + // *** check the dump file format ***
- + i_len = strcspn( uc_buf,"\r\n" );
- + if( i_len == 13 ){
- + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
- + i_chk_sts++; // format is OK
- + status = global;
- + }
- + }
- + break;
- + case global:
- + if( uc_buf[9] == 'g' ){
- + // *** global symbol only ***
- + get_label_info_from_dump( uc_buf,(stpp_All_Dump_Inf+ul_cnt) );
- + ul_cnt++;
- + }
- + break;
- + default:
- + ;
- + break;
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
- + xexit (EXIT_FAILURE);
- + }
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void free_all_dump_info();
- +Input : None
- +Return : None
- +Expnalantion: Free the heap area for the dump file information.
- + Uses global symbols stpp_All_Dump_Inf and ul_All_Dump_Symbol_Cnt
- +*******************************************************************************************/
- +void free_all_dump_info()
- +{
- + unsigned long ul;
- +
- + if( stpp_All_Dump_Inf != 0 ){
- +
- + for( ul = 0; ul < ul_All_Dump_Symbol_Cnt; ul++ ){
- +
- + if( *(stpp_All_Dump_Inf+ul) != 0 ){
- +
- + // free member pointer
- + if( (*(stpp_All_Dump_Inf+ul))->ucp_Symbol_Name != 0 ){
- + free( (*(stpp_All_Dump_Inf+ul))->ucp_Symbol_Name );
- + }
- + if( (*(stpp_All_Dump_Inf+ul))->ucp_Area_Name != 0 ){
- + free( (*(stpp_All_Dump_Inf+ul))->ucp_Area_Name );
- + }
- +
- + // free the pointer of each struct dump_inf
- + free( *(stpp_All_Dump_Inf+ul) );
- + }
- + }
- +
- + // free the pointer of the pointer of struct dump_inf
- + free( stpp_All_Dump_Inf );
- + stpp_All_Dump_Inf = 0;
- + }
- +}
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
- +
- +
- +/*******************************************************************************************
- +Format : void chk_is_file_inf( unsigned char *ucp_chk_file_pt );
- +Input : unsigned char *ucp_chk_pt -- pointer for file name
- +Return : None
- +Expnalantion: Check whether ".file" exists from souce file.
- +*******************************************************************************************/
- +void chk_is_file_inf( unsigned char *ucp_chk_file_pt )
- +{
- + FILE *f_file;
- + unsigned char uc_buf[INPUT_CUR_LINE_MAX];
- + unsigned char *ucp_wk;
- + int i_len;
- + int i_ret;
- + int i_stab_flg; // 0 -- normal
- + // 1 -- during ".stabs" / ".stabn" line
- +
- + f_file = fopen (ucp_chk_file_pt, "r");
- + if (f_file == NULL)
- + {
- + fprintf (stderr, _("Error : Can't open %s for reading.\n"),ucp_chk_file_pt);
- + xexit (EXIT_FAILURE);
- + }
- +
- + i_stab_flg = 0;
- + while( 1 ){
- + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
- + ucp_wk = fgets( uc_buf, INPUT_CUR_LINE_MAX, f_file );
- + if( ucp_wk == 0 ){
- + break;
- + }
- +
- + i_len = strlen( uc_buf );
- + ucp_wk = strpbrk( uc_buf,"\r\n" );
- +
- + if( i_stab_flg == 1 ){
- + if( ucp_wk != 0 ){
- + i_stab_flg = 0;
- + }
- + } else {
- + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
- + i_ret = chk_is_stab( uc_buf );
- + if( i_ret == 0 ){
- + fprintf (stderr, _("Error : There are too many characters of one line in assembler source file.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + i_stab_flg = 1;
- + } else {
- + chk_is_file_inf_from_line( uc_buf );
- + }
- + }
- + }
- +
- + if( fclose (f_file) == EOF ){
- + fprintf (stderr, _("Error : Can't close %s\n"),ucp_chk_file_pt);
- + xexit (EXIT_FAILURE);
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void chk_is_file_inf( unsigned char *ucp_chk_pt );
- +Input : unsigned char *ucp_chk_pt -- check pointer
- +Return : None
- +Expnalantion: Check whether ".file" exists from line.
- + If ".file" exists, file name is set.
- +*******************************************************************************************/
- +void chk_is_file_inf_from_line( unsigned char *ucp_chk_pt )
- +{
- + if( i_File_Inf_Flg == 0 ){
- + while( 1 ){
- + if( ( (*ucp_chk_pt) == '\t' ) || ( (*ucp_chk_pt) == ' ' ) ){
- + // skip
- + ;
- + } else if ( ( (*ucp_chk_pt) == ';' ) || ( (*ucp_chk_pt) == '#' ) ) {
- + // this is comment
- + break;
- + } else if ( ( (*ucp_chk_pt) == '\r' ) || ( (*ucp_chk_pt) == '\n' ) ) {
- + // this is cr/lf
- + break;
- + } else {
- + if( 5 <= strlen( ucp_chk_pt ) ){
- + if( 0 == memcmp( ucp_chk_pt,".file",5 ) ){
- + i_File_Inf_Flg = 1;
- + break;
- + }
- + } else {
- + break;
- + }
- + }
- + ucp_chk_pt++;
- + }
- + }
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int chk_is_stab( unsigned char *ucp_chk_pt );
- +Input : unsigned char *ucp_chk_pt -- check pointer
- +Return : 0 -- ".stabs" / ".stabn" doesn't exists.
- + 1 -- ".stabs" / ".stabn" exists.
- +Expnalantion: Check whether ".stabs" / ".stabn" exists.
- +*******************************************************************************************/
- +int chk_is_stab( unsigned char *ucp_chk_pt )
- +{
- + int i;
- + int i_ret;
- +
- + i_ret = 0;
- + for( i = 0; i < (INPUT_CUR_LINE_MAX - 1); i++ ){
- + if( ( (*ucp_chk_pt) == '\t' ) || ( (*ucp_chk_pt) == ' ' ) ){
- + // skip
- + ;
- + } else if ( ( (*ucp_chk_pt) == ';' ) || ( (*ucp_chk_pt) == '#' ) ) {
- + // this is comment
- + break;
- + } else {
- + if( 6 <= strlen( ucp_chk_pt ) ){
- + if( ( 0 == memcmp( ucp_chk_pt,".stabs",6 ) )
- + || ( 0 == memcmp( ucp_chk_pt,".stabn",6 ) ) ){
- + i_ret = 1;
- + break;
- + }
- + } else {
- + break;
- + }
- + }
- + ucp_chk_pt++;
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void s_app_file_2 ();
- +Input : None
- +Return : None
- +Expnalantion: ADD ".file" information to object file.
- + If source file has already ".file" information, don't add it here.
- +*******************************************************************************************/
- +void s_app_file_2 ()
- +{
- + register char *s,*cp_wk;
- +// int length;
- + int may_omit;
- + int appfile;
- +
- + int i_len;
- + char *cp_file_name_pt = 0;
- +
- + if( i_File_Inf_Flg == 0 ){
- + if( out_file_name != 0 ){
- + if( 0 < strlen( out_file_name ) ){
- + appfile = 0;
- +
- + /* Some assemblers tolerate immediately following '"' */
- + // if ((s = demand_copy_string (&length)) != 0)
- + // {
- + // Get the file name from the "out_file_name".
- + // And change extension to '*.s'.
- + i_len = strlen( out_file_name );
- + cp_file_name_pt = xmalloc( i_len + 1 );
- + if( cp_file_name_pt == 0 ){
- + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
- + xexit (EXIT_FAILURE);
- + }
- + memset( cp_file_name_pt,0,i_len + 1 );
- + memcpy( cp_file_name_pt,out_file_name,i_len );
- + s = strrchr( cp_file_name_pt,'/' );
- + if( s != 0 ){
- + s++;
- + } else {
- + s = cp_file_name_pt;
- + }
- + cp_wk = strrchr( s,'.' );
- + if( cp_wk != 0 ){
- + cp_wk++;
- + (*cp_wk) = 's';
- + cp_wk++;
- + (*cp_wk) = 0;
- + }
- +
- + /* If this is a fake .appfile, a fake newline was inserted into
- + the buffer. Passing -2 to new_logical_line tells it to
- + account for it. */
- + may_omit= (! new_logical_line (s, appfile ? -2 : -1) && appfile);
- +
- + /* In MRI mode, the preprocessor may have inserted an extraneous
- + backquote. */
- + if (flag_m68k_mri
- + && *input_line_pointer == '\''
- + && is_end_of_line[(unsigned char) input_line_pointer[1]])
- + ++input_line_pointer;
- +
- + // demand_empty_rest_of_line ();
- +
- + if (! may_omit)
- + {
- + #ifdef LISTING
- + if (listing)
- + listing_source_file (s);
- + #endif
- + register_dependency (s);
- + #ifdef obj_app_file
- + obj_app_file (s);
- + #endif
- + }
- + // }
- +
- + if( cp_file_name_pt != 0 ){
- + free( cp_file_name_pt );
- + }
- + }
- + }
- + }
- +}
- +
- +/*******************************************************************************************
- +Format : int reset_current_symbol(char *input_line_pointer);
- +Input : char *input_line_pointer -- pointer for reading the source file
- +Return : NONE
- +Explanation : Reset the global variables if the ".section" changes.
- +*******************************************************************************************/
- +void reset_current_symbol(char *input_line_pointer)
- +{
- + // if ".section" is found,reset the "uc_Current_All_Symbol".
- + if( 8 <= strlen( input_line_pointer ) ){
- + if( 0 == memcmp( ".section",input_line_pointer,8 ) ){
- + memset( uc_Current_All_Symbol,0,sizeof( uc_Current_All_Symbol ) );
- + }
- + }
- +
- +}
- +
- +/*******************************************************************************************
- +Format : int update_current_symbol(char *input_line_pointer);
- +Input : char *s -- label name
- +Return : NONE
- +Explanation : Check whether the label is local or global from the current file
- + and saves it to the global variables.
- +*******************************************************************************************/
- +void update_current_symbol(char *s)
- +{
- + int i_ret; // return value of a function
- + int i_len; // length of the label
- +
- + // Check whether the label is local or global from the current file only.
- + i_ret = chk_global_label_2( s );
- + if( i_ret == 1 ){
- + i_len = strlen( s );
- + }
- +
- + i_len = strlen( s );
- + memset( uc_Current_All_Symbol,0,sizeof( uc_Current_All_Symbol ) );
- + memcpy( uc_Current_All_Symbol,s,i_len );
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int evaluate_offset_from_symbol( void );
- +Input : NONE
- +Return : NONE
- +Expnalantion: Save the current symbol to the previous symbol.
- + Count up the offset from symbol if the current remains the same or,
- + reset the offset from symbol if the current changes.
- + Uses the following global vars
- + uc_Current_All_Symbol
- + uc_Pre_All_Symbol
- + ul_All_Offset
- +*******************************************************************************************/
- +void evaluate_offset_from_symbol(void)
- +{
- +
- + int i_len,i_len_2,i_chk_flg;
- +
- +
- + // get the offset form all symbol
- + i_chk_flg = 0;
- + i_len = strlen( uc_Current_All_Symbol );
- + i_len_2 = strlen( uc_Pre_All_Symbol );
- + if( i_len == 0 ){
- + i_chk_flg = 1;
- + } else {
- + if( i_len == i_len_2 ){
- + if( 0 != memcmp( uc_Current_All_Symbol,uc_Pre_All_Symbol,i_len ) ){
- + i_chk_flg = 1;
- + }
- + } else {
- + i_chk_flg = 1;
- + }
- + }
- +
- + if( i_chk_flg == 0 ){
- + // count up offset if the newest all symbol name is the same
- + ul_All_Offset++; // count up the offset
- + } else {
- + ul_All_Offset = 0; // reset the offset
- + }
- +
- + if( i_len != 0 ){
- + memset( uc_Pre_All_Symbol,0,sizeof( uc_Pre_All_Symbol ) );
- + memcpy( uc_Pre_All_Symbol,uc_Current_All_Symbol,i_len );
- + } else {
- + memset( uc_Pre_All_Symbol,0,sizeof( uc_Pre_All_Symbol ) );
- + }
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int chk_global_label_2( char* cp_label_name );
- +Input : char* cp_label_name -- pointer for label name
- +Return : 0 -- local label
- + 1 -- global label
- +Expnalantion: Check whether the label is local or global from the current file only.
- +*******************************************************************************************/
- +int chk_global_label_2( char* cp_label_name )
- +{
- + int i_ret,i_len,i_len_2;
- + unsigned long ul;
- +
- + // compare symbol name to the current file
- + i_ret = 0; // local
- + i_len = strlen( cp_label_name );
- + for( ul = 0; ul < ul_Cur_File_Symbol_Cnt; ul++ ){
- + i_len_2 = strlen( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name );
- + if( i_len == i_len_2 ){
- + if( 0 == memcmp( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name,cp_label_name,i_len ) ){
- +
- + // copy the attribute
- + i_ret = (*(stpp_Cur_Inf+ul))->i_Attribute; // 0 -- local
- + // 1 -- global
- + break;
- + }
- + }
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int chk_label_address_from_dump( char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address );
- +Input : const char* cp_label_name -- pointer for label name
- + offsetT off_offset -- offset from label address
- + unsigned long *ulp_label_address -- pointer for label address
- +Return : 0 -- don't get the address
- + 1 -- get the address
- +Expnalantion: Get the label address and add offset from the dump file.
- + First compare the current local symbol, and if don't get the addresss,
- + then compare the global symbol.
- +*******************************************************************************************/
- +int chk_label_address_from_dump( const char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address )
- +{
- + int i_ret,i_len,i_len_2;
- + int i_attr; // 0 -- local
- + // 1 -- global
- + unsigned long ul;
- +
- + i_ret = 0;
- + i_len = strlen( cp_label_name );
- +
- + // compare symbol name to the dump file
- + for( i_attr = 0; i_attr < 2; i_attr++ ){
- + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
- + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
- + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
- + if( i_len == i_len_2 ){
- + if( 0 == memcmp( cp_label_name,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
- + i_ret = 1;
- + *ulp_label_address = (*(stpp_Dump_Inf+ul))->ul_Symbol_Addr + off_offset;
- + break;
- + }
- + }
- + }
- + }
- + if( i_ret == 1 ){
- + break;
- + }
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int chk_is_same_area_from_dump( unsigned char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 );
- +Input : const char *ucp_chk_name_1 -- symbol name in expression
- + unsigned char *ucp_chk_name_2 -- current local or global symbol
- +Return : 0 -- area of check name 1 and check name 2 is not same
- + or
- + don't get the symbol information
- + 1 -- area of check name 1 and check name 2 is same
- +Expnalantion: Check whether area of check name 1 and check name 2 is same from the dump file.
- + First compare the current local symbol, and if don't get the addresss,
- + then compare the global symbol.
- +*******************************************************************************************/
- +int chk_is_same_area_from_dump( const char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 )
- +{
- + int i_ret;
- + int i_len_1,i_len_2,i_chk_flg;
- + int i_attr; // 0 -- local
- + // 1 -- global
- + unsigned char *ucp_area_1 = NULL;
- + unsigned char *ucp_area_2 = NULL;
- + unsigned long ul;
- +
- + i_ret = 0;
- +
- + // compare check name 1 to the dump file
- + i_chk_flg = 0;
- + i_len_1 = strlen( ucp_chk_name_1 );
- + if( 0 < i_len_1 ){
- + // compare symbol name to the dump file
- + for( i_attr = 0; i_attr < 2; i_attr++ ){
- + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
- + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
- + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
- + if( i_len_1 == i_len_2 ){
- + if( 0 == memcmp( ucp_chk_name_1,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
- + i_chk_flg = 1;
- + ucp_area_1 = (*(stpp_Dump_Inf+ul))->ucp_Area_Name;
- + break;
- + }
- + }
- + }
- + }
- + if( i_chk_flg == 1 ){
- + break;
- + }
- + }
- + }
- +
- + if( i_chk_flg == 1 ){
- + // compare check name 2 to the dump file
- + i_chk_flg = 0;
- + i_len_1 = strlen( ucp_chk_name_2 );
- + if( 0 < i_len_1 ){
- + // compare symbol name to the dump file
- + for( i_attr = 0; i_attr < 2; i_attr++ ){
- + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
- + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
- + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
- + if( i_len_1 == i_len_2 ){
- + if( 0 == memcmp( ucp_chk_name_2,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
- + i_chk_flg = 1;
- + ucp_area_2 = (*(stpp_Dump_Inf+ul))->ucp_Area_Name;
- + break;
- + }
- + }
- + }
- + }
- + if( i_chk_flg == 1 ){
- + break;
- + }
- + }
- + }
- + }
- +
- + if( i_chk_flg == 1 ){
- + i_len_1 = strlen( ucp_area_1 );
- + i_len_2 = strlen( ucp_area_2 );
- + if( i_len_1 == i_len_2 ){
- + if( 0 < i_len_1 ){
- + if( 0 == memcmp( ucp_area_1,ucp_area_2,i_len_1 ) ){
- + i_ret = 1;
- + }
- + }
- + }
- + }
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt );
- +Input : unsigned long* ul_address -- pointer for save address
- + unsigned long ul_tmp_cnt -- additional instruction(ext) counts for caluclating offset
- +Return : 0 -- Address was not calculated.
- + 1 -- Address was calculated.
- +Expnalantion: Calculate the current address the form dump file and offset information.
- + First compare the current local symbol, and if don't get the addresss,
- + then compare the global symbol.
- +*******************************************************************************************/
- +int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt )
- +{
- + int i_ret;
- + int i_len_1,i_len_2;
- + int i_attr; // 0 -- local
- + // 1 -- global
- + unsigned long ul;
- +
- + i_ret = 0;
- +
- + i_len_1 = strlen( uc_Current_All_Symbol );
- + if( 0 < i_len_1 ){
- + // compare symbol name to the dump file
- + for( i_attr = 0; i_attr < 2; i_attr++ ){
- + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
- + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
- + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
- + if( i_len_1 == i_len_2 ){
- + if( 0 == memcmp( uc_Current_All_Symbol,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
- + i_ret = 1;
- + *ul_address = (( ul_tmp_cnt + ul_All_Offset ) * 2) + (*(stpp_Dump_Inf+ul))->ul_Symbol_Addr;
- + // no address masking
- + break;
- + }
- + }
- + }
- + }
- + if( i_ret == 1 ){
- + break;
- + }
- + }
- + }
- +
- + return i_ret;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo)
- +Input : char *symbolName the calculated address of a symbol
- + struct dump_inf **pDumpInfo
- + pointer to the global dump_inf pointer(stpp_Dump_Inf)
- + the result will be stored in this parameter
- +Return : NONE
- +Expnalantion: Receives the pointer to dump info for symbolName
- +*******************************************************************************************/
- +void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo)
- +{
- + unsigned long i;
- +
- + struct dump_inf **pSearchDumpInfo = stpp_Dump_Inf;
- + unsigned long symbolCount = ul_Dump_Symbol_Cnt;
- +
- + for (i = 0; i < symbolCount; i++) {
- + if (strcmp(pSearchDumpInfo[i]->ucp_Symbol_Name, symbolName) == 0) {
- + *pDumpInfo = pSearchDumpInfo[i];
- + break;
- + }
- + }
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : unsigned long getDataPointerAddress(char *dpSymbol)
- +Input : char *dpSymbol the symbol for the data pointer
- +Return : unsigned long address of data pointer
- +Expnalantion: Returns the address of the data pointer.
- + The symbol must exist in the dump file and be a global symbol,
- + otherwise the value will be 0
- +*******************************************************************************************/
- +unsigned long getDataPointerAddress(char *dpSymbol)
- +{
- + unsigned long address = 0; // return value
- + struct dump_inf *pDumpInfo = NULL;
- +
- + getSymbolInfo(dpSymbol, &pDumpInfo);
- + if (pDumpInfo != NULL) {
- + // get the address when the symbol is a global symbol
- + if (pDumpInfo->i_Attribute == 1) {
- + address = pDumpInfo->ul_Symbol_Addr;
- + }
- + }
- +
- + return address;
- +
- +}
- +
- +
- +// ADD D.Fujimoto 2007/12/27 >>>>>
- +/*******************************************************************************************
- +Format : void countDuplicateSymbols(struct dump_inf **pDumpInfo, struct dump_inf **pAllDumpInfo, unsigned long symbolCount)
- +Input : struct dump_inf **pAllDumpInfo
- + pointer to the global dump_inf pointer (all object file dump).
- + This will be used to check duplicate symbols
- + unsigned long element count of *pAllDumpInfo
- +Return : none
- +Expnalantion: Count up the symbol occurence in stpp_Dump_Inf that appears in pAllDumpInfo.
- + The count for pAllDumpInfo must be given as symbolCount.
- + Global variable stpp_Dump_Inf is referenced here.
- + Prior to calling this function, all elements of stpp_Dump_Inf[]->iCount should be 0
- +*******************************************************************************************/
- +void countDuplicateSymbols(struct dump_inf **pAllDumpInfo, unsigned long symbolCount)
- +{
- + unsigned long i;
- + struct dump_inf *pDumpInfo = NULL;
- +
- + for (i = 0; i < symbolCount; i++) {
- + // search for global symbols and match that with pDumpInfo
- + if (pAllDumpInfo[i]->i_Attribute == 1) {
- + getSymbolInfo(pAllDumpInfo[i]->ucp_Symbol_Name, &pDumpInfo);
- +
- + // count it up
- + if (pDumpInfo != NULL) {
- + if (pDumpInfo->i_Attribute == 1) {
- + pDumpInfo->iCount++;
- + }
- + }
- + }
- + }
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int isDuplicateSymbol(char *symbolName)
- +Input : char *symbolName
- + symbolName to search from stpp_Dump_Inf
- +Return : 1 = true, 0 = false
- +Expnalantion: Search symbolName from stpp_Dump_Inf and check whether it is a duplicate.
- + Duplicate symbols must not be used for ext insn optimization.
- + Global variable stpp_Dump_Inf is referenced here.
- +*******************************************************************************************/
- +int isDuplicateSymbol(const char *symbolName)
- +{
- + int ret = 0;
- + unsigned long i;
- +
- + struct dump_inf **pSearchDumpInfo = stpp_Dump_Inf;
- + unsigned long symbolCount = ul_Dump_Symbol_Cnt;
- +
- + // duplicate when the global symbol count is more than 1
- + for (i = 0; i < symbolCount; i++) {
- + if (strcmp(pSearchDumpInfo[i]->ucp_Symbol_Name, symbolName) == 0 &&
- + pSearchDumpInfo[i]->i_Attribute == 1 &&
- + pSearchDumpInfo[i]->iCount > 1) {
- + ret = 1;
- + break;
- + }
- + }
- +
- + return ret;
- +
- +}
- +// ADD D.Fujimoto 2007/12/27 <<<<<
- +
- +
- +// ADD D.Fujimoto 2007/12/26 >>>>>
- +/*******************************************************************************************
- +Format : void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount)
- +Input : struct dump_inf **pDumpInfo
- + pointer to the global dump_inf pointer
- + unsigned long element count of *pDumpInfo
- +Return : none
- +Expnalantion: Print symbols in struct dump_inf for debugging.
- + The count for struct dump_inf must be given as symbolCount.
- +*******************************************************************************************/
- +void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount)
- +{
- + int i;
- +
- + for (i = 0; i < symbolCount; i++) {
- + printf("%s\t%s\t0x%x", pDumpInfo[i]->ucp_Symbol_Name, pDumpInfo[i]->ucp_Area_Name, pDumpInfo[i]->ul_Symbol_Addr);
- +
- + printf("\t%s\n", (pDumpInfo[i]->i_Attribute == 1 ? "g" : "l"));
- + }
- +
- +}
- +// ADD D.Fujimoto 2007/12/26 <<<<<
- +
- +
- +/*******************************************************************************************
- +Format : int evaluate_ext_count(expressionS ex, ExtCountFunc pfunc)
- +Input : expressionS ex expression of current line
- + unsigned long dpAddress
- + Address of data pointer(used when no medda32).
- + Specify 0 when using medda32.
- + ExtCountFunc pfunc function to count ext for the current line
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if maximum ext instructions should be added.
- +Expnalantion: Evaluates the needed ext counts for this expression.
- + The given function will determine the actual ext counts.
- + The function pointer arg should not be NULL.
- +*******************************************************************************************/
- +int evaluate_ext_count(expressionS ex, unsigned long dpAddress, ExtCountFunc pfunc)
- +{
- + int i_ext_cnt = MAX_EXT_INSN_CNT; // return value
- + int i_ret; // return values of the called functions
- +
- + unsigned long ul_address; // the address of the symbol
- +
- + if (pfunc == NULL) {
- + abort();
- + }
- +
- +// ADD D.Fujimoto 2008/01/07 >>>>>
- + // skip counting for duplicate (c++) symbols
- + if (isDuplicateSymbol(S_GET_NAME( ex.X_add_symbol ))) {
- + return MAX_EXT_INSN_CNT;
- + }
- +// ADD D.Fujimoto 2008/01/07 <<<<<
- +
- + // get symbol address ( include formula )
- + i_ret = chk_label_address_from_dump( S_GET_NAME( ex.X_add_symbol ),ex.X_add_number,&ul_address );
- + if( i_ret == 1 ){
- + // dp address is normally smaller than the symbol address
- + ul_address = (ul_address >= dpAddress) ? ul_address - dpAddress : ul_address;
- + i_ext_cnt = pfunc(ul_address); // call the apropriate ExtCountFunc
- + }
- +
- + return i_ext_cnt;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_xld_rd_symbol(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - xld.w %rd, LABEL
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_xld_rd_symbol(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x1F ) {
- + // 0 - 0x1F
- + ext_count = 0;
- + } else if ( (0x20 <= address) && (address <= 0x3FFFF) ) {
- + ext_count = 1;
- + } else if ( (0x40000 <= address) && (address <= 0x7FFFF) ) {
- + ext_count = 2;
- + }
- +
- + return ext_count;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_xld_mem_rw(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - xld.* %rd, [LABEL]
- + - xld.* [LABEL], %rd
- + - xb* [LABEL], imm3
- + for STD, PE
- + nomedda
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_xld_mem_rw(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x1FFF ) {
- + // 0 - 0x1FFF
- + ext_count = 1;
- + }
- +
- + return ext_count;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_xld_mem_rw32(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - xld.* %rd, [LABEL]
- + - xld.* [LABEL], %rd
- + - xb* [LABEL], imm3
- + for STD, PE, ADV
- + medda
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_xld_mem_rw32(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x1F ) {
- + // 0 - 0x1F
- + ext_count = 0;
- + } else if ( (0x20 <= address) && (address <= 0x3FFFF) ) {
- + ext_count = 1;
- + }
- +
- + return ext_count;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_xld_mem_rw_adv(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - xld.* %rd, [LABEL]
- + - xld.* [LABEL], %rd
- + for ADV
- + nomedda
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_xld_mem_rw_adv(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x7FFFF ) {
- + // 0x0 - 0x7FFFF
- + ext_count = 1;
- + }
- +
- + return ext_count;
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_ald_mem_rw(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - ald.* %rd, [LABEL]
- + - ald.* [LABEL], %rd
- + for ADV
- + nomedda
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_ald_mem_rw(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x7FFFF ) {
- + // 0x0 - 0x7FFFF
- + ext_count = 1;
- + }
- +
- + return ext_count;
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_ald_mem_rw32(unsigned long address)
- +Input : unsigned long address the calculated address of a symbol
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - ald.* %rd, [LABEL]
- + - ald.* [LABEL], %rd
- + for ADV
- + medda
- + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
- +*******************************************************************************************/
- +int count_ext_for_ald_mem_rw32(unsigned long address)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- +
- + if ( address <= 0x1F ) {
- + // 0 - 0x1F
- + ext_count = 0;
- + } else if ( (0x20 <= address) && (address <= 0x7FFFF) ) {
- + ext_count = 1;
- + }
- +
- + return ext_count;
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int evaluate_ext_count_for_jumps(expressionS ex)
- +Input : expressionS ex expression of current line
- + : int addInstCount additional instruction(ext) counts for calculating address
- + ExtCountFunc pfunc function to count ext for the current line
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if maximum ext instructions should be added.
- +Expnalantion: Evaluates the needed ext counts for this expression(call and jp*).
- + The given function will determine the actual ext counts.
- + The function pointer arg should not be NULL.
- +*******************************************************************************************/
- +int evaluate_ext_count_for_jumps(expressionS ex, int addInstCount, ExtCountJumpFunc pfunc)
- +{
- +
- + int i_ext_cnt = MAX_EXT_INSN_CNT; // return value
- + int i_ret; // return values of the called functions
- +
- + unsigned long ul_dst_address; // address of the LABEL(operand)
- + unsigned long ul_src_address; // address of the instruction
- +
- + if (pfunc == NULL) {
- + abort();
- + }
- +
- +// ADD D.Fujimoto 2008/01/07 >>>>>
- + // skip counting for duplicate (c++) symbols
- + if (isDuplicateSymbol(S_GET_NAME( ex.X_add_symbol ))) {
- + return MAX_EXT_INSN_CNT;
- + }
- +// ADD D.Fujimoto 2008/01/07 <<<<<
- +
- + // get symbol address ( include formula )
- + i_ret = chk_label_address_from_dump( S_GET_NAME( ex.X_add_symbol ),ex.X_add_number,&ul_dst_address );
- + if( i_ret == 1 ){
- + // check whether area is same
- + i_ret = chk_is_same_area_from_dump( S_GET_NAME( ex.X_add_symbol ),uc_Current_All_Symbol );
- + if( i_ret == 1 ){
- + i_ret = clc_cur_address_from_dump( &ul_src_address, addInstCount ); // get current_address
- + if( i_ret == 1 ){
- + i_ext_cnt = pfunc(ul_dst_address, ul_src_address); // call the apropriate ExtCountFunc
- + }
- + }
- + }
- +
- + return i_ext_cnt;
- +
- +}
- +
- +
- +/*******************************************************************************************
- +Format : int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress)
- +Input : unsigned long dstAddress the calculated address of a symbol
- + unsigned long srcAddress the calculated address of the instruction
- +Return : The count of ext instructions,
- + or MAX_EXT_INSN_CNT if it cannot be determined
- +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
- + - scall LABEL
- + - xcall LABEL
- + - sj* LABEL
- + - xj* LABEL
- + This function is used as ExtCountJumpFunc
- + to be passed to evaluate_ext_count_for_jumps().
- +*******************************************************************************************/
- +int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress)
- +{
- + int ext_count = MAX_EXT_INSN_CNT;
- + long distance;
- +
- + // distance may be negative
- + distance = (long) (dstAddress - srcAddress);
- + if ( ( -256 <= distance ) && ( distance <= 254 ) ) {
- + ext_count = 0;
- + } else if ( ((-2097152 <= distance) && (distance < -256)) ||
- + ((254 < distance) && (distance <= 2097150)) ) {
- + ext_count = 1;
- + } else if ( (distance < -2097152) || (2097150 < distance) ) {
- + ext_count = 2;
- + }
- +
- + return ext_count;
- +
- +}
- diff --git a/gas/ext_remove.h b/gas/ext_remove.h
- new file mode 100644
- index 0000000..261faad
- --- /dev/null
- +++ b/gas/ext_remove.h
- @@ -0,0 +1,176 @@
- +/* ext_remove.h - header file for 2pass assemble.
- + This program will remove redundant ext 0x0 instructions
- + which emerge from memory load from LABEL/SYMBOLS or
- + from function calls to LABEL/SYMBOLS
- + Copyright (C) 2007 SEIKO EPSON CORP.
- +
- + Written by D.Fujimoto@Irumasoft
- + DATE:2007/02/28
- +
- + This file is part of GAS, the GNU Assembler.
- +
- + GAS is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2, or (at your option)
- + any later version.
- +
- + GAS is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with GAS; see the file COPYING. If not, write to the Free
- + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- + 02111-1307, USA.
- +*/
- +#ifndef __EXT_REMOVE_H__
- +#define __EXT_REMOVE_H__
- +
- +//////////////////////////////////////////
- +// Macro definitions
- +#define EXT_REMOVE // the ext remove feature is alive where this macro appears
- + // in other source files
- +
- +#define INPUT_CUR_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a current file
- +
- +#define DATA_POINTER_SYMBOL "__dp" // symbol representing data pointer
- +
- +#define MAX_EXT_INSN_CNT (-1) // default return value for evaluate_ext_count() and related functions
- +
- +//////////////////////////////////////////
- +// Structure declarations
- +typedef struct cur_inf
- +{
- + unsigned char* ucp_Symbol_Name; // pointer for symbol name
- + int i_Attribute; // 0 -- local
- + // 1 -- global
- +} cur_inf;
- +
- +struct dump_inf
- +{
- + unsigned char* ucp_Symbol_Name; // pointer for symbol name ( cuurent local symbol & global symbol )
- + unsigned long ul_Symbol_Addr; // address where symbol name is placed
- + unsigned char* ucp_Area_Name; // pointer for area name in which symbol name belongs
- + int i_Attribute; // 0 -- local
- + // 1 -- global
- + int iCount; // symbol occurence ADD D.Fujimoto 2007/12/27
- + // symbols that are found more than 1 should not be used for ext optimization
- +};
- +
- +
- +//////////////////////////////////////////
- +// Enum declarations
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- +enum CheckStatus {format, filename, local_global, global}; // used in read_all_dump_info()
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<
- +
- +////////////////////////////////////////////
- +// Global variables
- +
- +extern int g_c33_ext; // flag indicating that -mc33ext option is specified
- + // 0=not specified, 1=-mc33ext specified
- +
- +extern int i_File_Inf_Flg ; // 0 -- initial vaule
- + // 1 -- ".file" exists.
- +
- +extern unsigned long g_dpAddress; // address of data pointer(used when no-medda32)
- +
- +// symbols information of current file
- +extern unsigned long ul_Cur_File_Symbol_Cnt;
- +extern struct cur_inf** stpp_Cur_Inf;
- +extern char *cp_Current_File_Name; // pointer for current file name( include path )
- +
- +// symbols information of dump file
- +extern unsigned long ul_Dump_Symbol_Cnt;
- +extern struct dump_inf** stpp_Dump_Inf;
- +extern char *cp_Dump_File_Name; // pointer for dump file name( include path )
- +
- +// variables for symbol offset calculation
- +extern volatile unsigned long ul_All_Offset; // offset(instruction counts) from all symbol
- +extern unsigned char uc_Current_All_Symbol[INPUT_CUR_LINE_MAX]; // current symbol( local & global )
- +extern unsigned char uc_Pre_All_Symbol[INPUT_CUR_LINE_MAX]; // pre symbol( local & global )
- +
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- +// symbols information of all object dump file
- +extern unsigned long ul_All_Dump_Symbol_Cnt;
- +extern struct dump_inf** stpp_All_Dump_Inf; // only global symbols will be stored
- +extern char *cp_All_Dump_File_Name; // pointer for dump file name( include path )
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
- +
- +
- +//////////////////////////////////////////
- +// Function prototypes
- +unsigned long chg_str_to_val PARAMS (( unsigned char* ucp_chg_ptr ));
- +
- +void read_cur_file_info PARAMS(( char *cp_prm_file ));
- +
- +void get_valid_string PARAMS(( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt ));
- +int get_label_info_from_src PARAMS(( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt ));
- +int get_attribute_info PARAMS(( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt ));
- +
- +void free_cur_info PARAMS(());
- +void free_ext_heap_area PARAMS(());
- +
- +void read_dump_info( char* cp_dump_file_name, char* cp_out_file_name );
- +void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf );
- +void free_dump_info();
- +
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
- +void read_all_dump_info( char* cp_dump_file_name, char* cp_out_file_name );
- +void free_all_dump_info();
- +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
- +
- +void chk_is_file_inf( unsigned char *ucp_chk_file_pt );
- +void chk_is_file_inf_from_line( unsigned char *ucp_chk_pt );
- +int chk_is_stab( unsigned char *ucp_chk_pt );
- +
- +
- +void s_app_file_2 (); // append .file pseudo op
- +void reset_current_symbol(char *input_line_pointer);
- +void update_current_symbol(char *s);
- +
- +int chk_global_label_2 PARAMS (( char* cp_label_name ));
- +
- +int chk_label_address_from_dump( const char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address );
- +int chk_is_same_area_from_dump( const char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 );
- +int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt );
- +
- +void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo);
- +unsigned long getDataPointerAddress(char *dataPointerSymbol);
- +
- +// ADD D.Fujimoto 2007/12/27 >>>>>
- +void countDuplicateSymbols(struct dump_inf **pAllDumpInfo, unsigned long symbolCount);
- +int isDuplicateSymbol(const char *symbolName);
- +// ADD D.Fujimoto 2007/12/27 <<<<<
- +
- +// ADD D.Fujimoto 2007/12/26 >>>>>
- +void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount); // print symbols for debugging
- +// ADD D.Fujimoto 2007/12/26 <<<<<
- +void evaluate_offset_from_symbol(void); // reset or increment the offset from symbol
- +
- +
- +// function pointer for ext counter functions
- +typedef int (*ExtCountFunc)(unsigned long address);
- +
- +int evaluate_ext_count(expressionS ex, unsigned long dpAddress, ExtCountFunc pfunc); // ext counter for mem read/write expressions
- +
- +// some ExtCountFuncs
- +int count_ext_for_xld_rd_symbol(unsigned long address);
- +int count_ext_for_xld_mem_rw(unsigned long address);
- +int count_ext_for_xld_mem_rw32(unsigned long address);
- +int count_ext_for_xld_mem_rw_adv(unsigned long address);
- +int count_ext_for_ald_mem_rw(unsigned long address);
- +int count_ext_for_ald_mem_rw32(unsigned long address);
- +
- +
- +// function pointer for ext counter functions
- +typedef int (*ExtCountJumpFunc)(unsigned long dstAddress, unsigned long srcAddress);
- +
- +int evaluate_ext_count_for_jumps(expressionS ex, int addInstCount, ExtCountJumpFunc pfunc); // ext counter for call/jp expressions
- +
- +// some ExtCountJumpFuncs
- +int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress);
- +
- +
- +#endif // __EXT_REMOVE_H__
- diff --git a/gas/input-scrub.c b/gas/input-scrub.c
- index ecbdaef..d0ce9e7 100644
- --- a/gas/input-scrub.c
- +++ b/gas/input-scrub.c
- @@ -417,6 +417,13 @@ seen_at_least_1_file () /* TRUE if we opened any file. */
- {
- return (physical_input_file != NULL);
- }
- +/* add T.Tazaki 2002.02.05 >>> */
- +line_numberT
- +get_physical_input_line()
- +{
- + return physical_input_line;
- +}
- +/* add T.Tazaki 2002.02.05 <<< */
-
- void
- bump_line_counters ()
- @@ -468,23 +475,33 @@ new_logical_line (fname, line_number)
- * namep should be char * const *, but there are compilers which screw
- * up declarations like that, and it's easier to avoid it.
- */
- +
- +
- +/* >>> add T.Tazaki 2002.03.04 */
- +extern char *c33_original_input_file;
- +/* <<< add T.Tazaki 2002.03.04 */
- +
- void
- as_where (namep, linep)
- char **namep;
- unsigned int *linep;
- {
- +
- + /* */
- +
- +
- if (logical_input_file != NULL
- && (linep == NULL || logical_input_line >= 0))
- {
- - *namep = logical_input_file;
- + *namep = logical_input_file;
- if (linep != NULL)
- *linep = logical_input_line;
- }
- else if (physical_input_file != NULL)
- {
- - *namep = physical_input_file;
- + *namep = physical_input_file;
- if (linep != NULL)
- - *linep = physical_input_line;
- + *linep = physical_input_line;
- }
- else
- {
- @@ -492,6 +509,14 @@ as_where (namep, linep)
- if (linep != NULL)
- *linep = 0;
- }
- +
- + /* >>> add T.Tazaki 2002.03.04 */
- + /* input file name pointer set */
- + if( *c33_original_input_file != NULL ){
- + *namep = c33_original_input_file; /* cpp :# 1 "sample.s" */
- + }
- + /* <<< add T.Tazaki 2002.03.04 */
- +
- } /* as_where() */
-
-
- diff --git a/gas/read.c b/gas/read.c
- index 1522842..db40169 100644
- --- a/gas/read.c
- +++ b/gas/read.c
- @@ -20,11 +20,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
- #if 0
- -#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
- - change this a bit. But then, GNU isn't
- - spozed to run on your machine anyway.
- - (RMS is so shortsighted sometimes.)
- - */
- +#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
- + change this a bit. But then, GNU isn't
- + spozed to run on your machine anyway.
- + (RMS is so shortsighted sometimes.)
- + */
- #else
- #define MASK_CHAR ((int)(unsigned char)-1)
- #endif
- @@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- #include "obstack.h"
- #include "listing.h"
- #include "ecoff.h"
- +#include "ext_remove.h" // add D.Fujimoto 2007/02/28
-
- #ifndef TC_START_LABEL
- #define TC_START_LABEL(x,y) (x==':')
- @@ -76,7 +77,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- #define NOP_OPCODE 0x00
- #endif
-
- -char *input_line_pointer; /*->next char of source file to parse. */
- +char *input_line_pointer; /*->next char of source file to parse. */
-
- #if BITS_PER_CHAR != 8
- /* The following table is indexed by[(char)] and will break if
- @@ -121,13 +122,13 @@ die horribly;
- /* used by is_... macros. our ctype[] */
- char lex_type[256] =
- {
- - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
- - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
- + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
- + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
- 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
- - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
- - LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
- + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
- + LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
- - 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
- + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- @@ -148,48 +149,48 @@ char lex_type[256] =
- char is_end_of_line[256] =
- {
- #ifdef CR_EOL
- - 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, 99, Z_, Z_, /* @abcdefghijklmno */
- + 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, 99, Z_, Z_, /* @abcdefghijklmno */
- #else
- - 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, Z_, /* @abcdefghijklmno */
- + 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, Z_, /* @abcdefghijklmno */
- #endif
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- #ifdef TC_HPPA
- - Z_,99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* _!"#$%&'()*+,-./ */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
- + Z_,99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* _!"#$%&'()*+,-./ */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
- #else
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
- #endif
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
- };
- #undef Z_
-
- /* Functions private to this file. */
-
- -static char *buffer; /* 1st char of each buffer of lines is here. */
- -static char *buffer_limit; /*->1 + last char in buffer. */
- +static char *buffer; /* 1st char of each buffer of lines is here. */
- +static char *buffer_limit; /*->1 + last char in buffer. */
-
- /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1 in the
- tc-<CPU>.h file. See the "Porting GAS" section of the internals manual. */
- int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
-
- -static char *old_buffer; /* JF a hack */
- +static char *old_buffer; /* JF a hack */
- static char *old_input;
- static char *old_limit;
-
- /* Variables for handling include file directory table. */
-
- -char **include_dirs; /* Table of pointers to directories to
- - search for .include's */
- -int include_dir_count; /* How many are in the table */
- +char **include_dirs; /* Table of pointers to directories to
- + search for .include's */
- +int include_dir_count; /* How many are in the table */
- int include_dir_maxlen = 1;/* Length of longest in table */
-
- #ifndef WORKING_DOT_WORD
- @@ -318,7 +319,7 @@ static const pseudo_typeS potable[] =
- /* dim */
- {"double", float_cons, 'd'},
- /* dsect */
- - {"eject", listing_eject, 0}, /* Formfeed listing */
- + {"eject", listing_eject, 0}, /* Formfeed listing */
- {"else", s_else, 0},
- {"elsec", s_else, 0},
- {"elseif", s_elseif, (int) O_ne},
- @@ -332,7 +333,7 @@ static const pseudo_typeS potable[] =
- {"err", s_err, 0},
- {"exitm", s_mexit, 0},
- /* extend */
- - {"extern", s_ignore, 0}, /* We treat all undef as ext */
- + {"extern", s_ignore, 0}, /* We treat all undef as ext */
- {"appfile", s_app_file, 1},
- {"appline", s_app_line, 0},
- {"fail", s_fail, 0},
- @@ -365,19 +366,19 @@ static const pseudo_typeS potable[] =
- {"irpc", s_irp, 1},
- {"irepc", s_irp, 1},
- {"lcomm", s_lcomm, 0},
- - {"lflags", listing_flags, 0}, /* Listing flags */
- + {"lflags", listing_flags, 0}, /* Listing flags */
- {"linkonce", s_linkonce, 0},
- - {"list", listing_list, 1}, /* Turn listing on */
- + {"list", listing_list, 1}, /* Turn listing on */
- {"llen", listing_psize, 1},
- {"long", cons, 4},
- {"lsym", s_lsym, 0},
- {"macro", s_macro, 0},
- {"mexit", s_mexit, 0},
- {"mri", s_mri, 0},
- - {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
- + {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
- {"name", s_ignore, 0},
- {"noformat", s_ignore, 0},
- - {"nolist", listing_list, 0}, /* Turn listing off */
- + {"nolist", listing_list, 0}, /* Turn listing off */
- {"nopage", listing_nopage, 0},
- {"octa", cons, 16},
- {"offset", s_struct, 0},
- @@ -388,13 +389,13 @@ static const pseudo_typeS potable[] =
- {"page", listing_eject, 0},
- {"plen", listing_psize, 0},
- {"print", s_print, 0},
- - {"psize", listing_psize, 0}, /* set paper size */
- + {"psize", listing_psize, 0}, /* set paper size */
- {"purgem", s_purgem, 0},
- {"quad", cons, 8},
- {"rep", s_rept, 0},
- {"rept", s_rept, 0},
- {"rva", s_rva, 4},
- - {"sbttl", listing_title, 1}, /* Subtitle of listing */
- + {"sbttl", listing_title, 1}, /* Subtitle of listing */
- /* scl */
- /* sect */
- {"set", s_set, 0},
- @@ -423,7 +424,7 @@ static const pseudo_typeS potable[] =
- this one. Match it either way... */
- {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
-
- - {"title", listing_title, 0}, /* Listing title */
- + {"title", listing_title, 0}, /* Listing title */
- {"ttl", listing_title, 0},
- /* type */
- {"uleb128", s_leb128, 0},
- @@ -435,7 +436,7 @@ static const pseudo_typeS potable[] =
- {"xstabs", s_xstab, 's'},
- {"word", cons, 2},
- {"zero", s_space, 0},
- - {NULL, NULL, 0} /* end sentinel */
- + {NULL, NULL, 0} /* end sentinel */
- };
-
- static int pop_override_ok = 0;
- @@ -451,17 +452,17 @@ pop_insert (table)
- {
- errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
- if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
- - as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
- - errtxt);
- + as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
- + errtxt);
- }
- }
-
- #ifndef md_pop_insert
- -#define md_pop_insert() pop_insert(md_pseudo_table)
- +#define md_pop_insert() pop_insert(md_pseudo_table)
- #endif
-
- #ifndef obj_pop_insert
- -#define obj_pop_insert() pop_insert(obj_pseudo_table)
- +#define obj_pop_insert() pop_insert(obj_pseudo_table)
- #endif
-
- static void
- @@ -483,13 +484,13 @@ pobegin ()
- pop_insert (potable);
- }
-
- -#define HANDLE_CONDITIONAL_ASSEMBLY() \
- - if (ignore_input ()) \
- - { \
- - while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
- - if (input_line_pointer == buffer_limit) \
- - break; \
- - continue; \
- +#define HANDLE_CONDITIONAL_ASSEMBLY() \
- + if (ignore_input ()) \
- + { \
- + while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
- + if (input_line_pointer == buffer_limit) \
- + break; \
- + continue; \
- }
-
-
- @@ -514,19 +515,48 @@ scrub_from_string (buf, buflen)
- return copy;
- }
-
- -/* read_a_source_file()
- +/* read_a_source_file()
- *
- * We read the file, putting things into a web that
- * represents what we have been reading.
- */
- +
- +/* add T.Tazaki 2002.03.04 >>> */
- +char *c33_stabs_input_file;
- +char szC33_stabs_input_file[300];
- +char *c33_original_input_file;
- +char szC33_original_input_file[300];
- +extern enum debug_info_type debug_type;
- +/* add T.Tazaki 2002.03.04 <<< */
- +
- void
- read_a_source_file (name)
- char *name;
- {
- register char c;
- - register char *s; /* string of symbol, '\0' appended */
- + register char *s; /* string of symbol, '\0' appended */
- register int temp;
- pseudo_typeS *pop;
- +
- + /* add T.Tazaki 2002.03.04 >>> */
- + int i;
- + char *hold;
- + char *hold2;
- + char *file;
- + unsigned int lineno;
- + int iPrepro = 0;
- + int iFirst_stabs = 0; /* OFF */
- + int iFirst_original = 0; /* OFF */
- + int iLinePlusFirst = 0; /* 0=first # line add T.Tazaki 2003/05/20 */
- +
- +
- + c33_stabs_input_file = &szC33_stabs_input_file[0];
- + *c33_stabs_input_file = NULL;
- +
- + c33_original_input_file = &szC33_original_input_file[0];
- + *c33_original_input_file = NULL;
- +
- + /* add T.Tazaki 2002.03.04 <<< */
-
- buffer = input_scrub_new_file (name);
-
- @@ -537,569 +567,815 @@ read_a_source_file (name)
- /* Generate debugging information before we've read anything in to denote
- this file as the "main" source file and not a subordinate one
- (e.g. N_SO vs N_SOL in stabs). */
- - generate_file_debug ();
- +
- + hold = input_line_pointer;
- +
- +/* generate_file_debug (); */ /* del T.Tazaki 2002.02.26 */
- +
- +// ADD D.Fujimoto append .file pseudo op 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + s_app_file_2();
- +#endif
- +// ADD D.Fujimoto append .file pseudo op 2007/06/25 <<<<<<<
-
- while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
- - { /* We have another line to parse. */
- - know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
- - contin: /* JF this goto is my fault I admit it.
- - Someone brave please re-write the whole
- - input section here? Pleeze??? */
- + { /* We have another line to parse. */
- + know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
- + contin: /* JF this goto is my fault I admit it.
- + Someone brave please re-write the whole
- + input section here? Pleeze??? */
- +
- + as_where (&file, &lineno); /* debug */
- +
- +
- while (input_line_pointer < buffer_limit)
- - {
- - /* We have more of this buffer to parse. */
- -
- - /*
- - * We now have input_line_pointer->1st char of next line.
- - * If input_line_pointer [-1] == '\n' then we just
- - * scanned another line: so bump line counters.
- - */
- - if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
- - {
- + {
- + /* We have more of this buffer to parse. */
- +
- + /*
- + * We now have input_line_pointer->1st char of next line.
- + * If input_line_pointer [-1] == '\n' then we just
- + * scanned another line: so bump line counters.
- + */
- + if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
- + {
- #ifdef md_start_line_hook
- - md_start_line_hook ();
- + md_start_line_hook ();
- #endif
-
- - if (input_line_pointer[-1] == '\n')
- - bump_line_counters ();
- -
- - line_label = NULL;
- -
- - if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
- - {
- - /* Text at the start of a line must be a label, we
- - run down and stick a colon in. */
- - if (is_name_beginner (*input_line_pointer))
- - {
- - char *line_start = input_line_pointer;
- - char c;
- - int mri_line_macro;
- -
- - LISTING_NEWLINE ();
- - HANDLE_CONDITIONAL_ASSEMBLY ();
- -
- - c = get_symbol_end ();
- -
- - /* In MRI mode, the EQU and MACRO pseudoops must
- - be handled specially. */
- - mri_line_macro = 0;
- - if (flag_m68k_mri)
- - {
- - char *rest = input_line_pointer + 1;
- -
- - if (*rest == ':')
- - ++rest;
- - if (*rest == ' ' || *rest == '\t')
- - ++rest;
- - if ((strncasecmp (rest, "EQU", 3) == 0
- - || strncasecmp (rest, "SET", 3) == 0)
- - && (rest[3] == ' ' || rest[3] == '\t'))
- - {
- - input_line_pointer = rest + 3;
- - equals (line_start,
- - strncasecmp (rest, "SET", 3) == 0);
- - continue;
- - }
- - if (strncasecmp (rest, "MACRO", 5) == 0
- - && (rest[5] == ' '
- - || rest[5] == '\t'
- - || is_end_of_line[(unsigned char) rest[5]]))
- - mri_line_macro = 1;
- - }
- -
- - /* In MRI mode, we need to handle the MACRO
- + if (input_line_pointer[-1] == '\n')
- + {
- +
- + /* add T.Tazaki 2002.03.18 >>> */
- +
- + if( *input_line_pointer == '\n' ){
- + if( iFirst_stabs != 1 && iFirst_original != 1 ){ /* Non PrePro Source ? */
- + ++input_line_pointer;
- + bump_line_counters (); /* ++lineno */
- + continue;
- + }
- + }
- +
- + /*==============================================================*/
- + /* CPP Assembler debug Info : line number(stab info) modify */
- + /*==============================================================*/
- + /* <format> */
- + /* # 999 "filename1" */
- + /* # 999 "filename2" 999 */
- + /* . */
- + /* . */
- + /* . */
- + /* # 999 "filename1" 999 */
- + /* . */
- + /*--------------------------------------------------------------*/
- + if( *input_line_pointer == '#' ){ /* After CPP Mode ? */
- +
- + /*==============================================================*/
- + /* # */
- + /*==============================================================*/
- +
- + ++input_line_pointer;
- +
- + as_where (&file, &lineno);
- +
- + if( debug_type == DEBUG_STABS ){
- + /*==============================================================*/
- + /* GSTABS */
- + /*==============================================================*/
- +
- + if( lineno == 0 ){
- + if( iFirst_stabs == 1 ){
- + ++input_line_pointer;
- + }
- + /* Get True file name */
- + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- +
- + }else{
- + while( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){ /* Skip until value */
- + ++input_line_pointer;
- + }
- + ++input_line_pointer;
- + if( *input_line_pointer != ' ' ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }else{
- + ++input_line_pointer;
- + if( *input_line_pointer != '\"' ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }else{
- + ++input_line_pointer;
- + if( iFirst_stabs == 1 ){ /* ON ?*/
- + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
- + ++input_line_pointer;
- + }
- + bump_line_counters (); /* ++lineno */
- + }else{
- + /* Get Original Assembler File Name */
- + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
- + szC33_stabs_input_file[i] = szC33_original_input_file[i]
- + = *input_line_pointer;
- + ++input_line_pointer;
- + }
- +
- + hold2 = input_line_pointer;
- + input_line_pointer = hold;
- + generate_file_debug ();
- + input_line_pointer = hold2;
- +
- + iFirst_stabs = 1; /* ON */
- + }
- + }
- + }
- + }
- + }
- + }
- + else
- + {
- + /*==============================================================*/
- + /* NO GSTABS */
- + /*==============================================================*/
- +
- + if( lineno == 0 ){
- + if( iFirst_original == 1 ){
- + ++input_line_pointer;
- + }
- + /* Get True file name */
- + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }else{
- + while( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){ /* Skip until value */
- + ++input_line_pointer;
- + }
- + ++input_line_pointer;
- + if( *input_line_pointer != ' ' ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }else{
- + ++input_line_pointer;
- + if( *input_line_pointer != '\"' ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }else{
- + ++input_line_pointer;
- + if( iFirst_original == 1 ){ /* ON ?*/
- + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
- + ++input_line_pointer;
- + }
- + bump_line_counters (); /* ++lineno */
- + }else{
- + /* Get Original Assembler File Name */
- + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
- + szC33_original_input_file[i] = *input_line_pointer;
- + ++input_line_pointer;
- + }
- + iFirst_original = 1; /* ON */
- + }
- + }
- + }
- + }
- + }
- + else
- + {
- + ++input_line_pointer;
- +
- + /* smaple #include "file.h" <----- NG!! */
- + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
- + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
- + bump_line_counters ();
- + }
- + ++input_line_pointer;
- + }
- + }
- +
- + while( *input_line_pointer != '\n' ){ /* Skip until CRLF */
- + ++input_line_pointer;
- + }
- + ++input_line_pointer;
- +
- + /* Assembler Source Name Get ? */
- +
- + if( iFirst_stabs == 1 || iFirst_original == 1 ){
- +
- + /* form # 1 "XXXXX" to # 1 "YYYYY" + 1 : not increment line number */
- + as_where (&file, &lineno);
- + if( lineno > 0 ){
- + if( iPrepro == 0 ){ /* line count ON/OFF switch */
- + iPrepro = 1; /* ON */
- + }else{
- + iPrepro = 0; /* OFF */
- + /* Skip 1 line */
- + while( *input_line_pointer != '\n' ){
- + ++input_line_pointer;
- + }
- + ++input_line_pointer;
- + /* add T.Tazaki bug fix 2003/05/21 >>> */
- + if( iLinePlusFirst == 1 )
- + {
- + bump_line_counters ();
- + }
- + else
- + {
- + iLinePlusFirst = 1;
- + }
- + /* add T.Tazaki bug fix 2003/05/21 >>> */
- + }
- + }
- + }
- +
- + continue;
- + }
- + else{
- + /*==============================================================*/
- + /* NOT # */
- + /*==============================================================*/
- + as_where (&file, &lineno);
- + if( lineno == 0 ){
- + hold2 = input_line_pointer;
- + input_line_pointer = hold;
- + generate_file_debug ();
- + input_line_pointer = hold2;
- + }
- + /*--------------------------------------------------------------*/
- + /* line count up CASE : iPrepro == 0(OFF) */
- + /* <format> */
- + /* ; comment or text <== ++lineno */
- + /* ; comment <== ++lineno */
- + /* # 999 "filename2" 999 */
- + /* .SET SYM1,1 */
- + /* # 999 "filename1" */
- + /* ; comment <== ++lineno */
- + /* ; comment <== ++lineno */
- + /* ; comment <== ++lineno */
- + /*--------------------------------------------------------------*/
- + if( iPrepro == 0 ){ /* OFF ? : line count increment ? */
- + iLinePlusFirst = 1; /* add T.Tazaki bug fix 2003/05/22 */
- + bump_line_counters ();
- + }
- + }
- + }
- +
- + /* add T.Tazaki 2002.02.26 <<< */
- +
- + line_label = NULL;
- +
- + if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
- + {
- + /* Text at the start of a line must be a label, we
- + run down and stick a colon in. */
- + if (is_name_beginner (*input_line_pointer))
- + {
- + char *line_start = input_line_pointer;
- + char c;
- + int mri_line_macro;
- +
- + LISTING_NEWLINE ();
- + HANDLE_CONDITIONAL_ASSEMBLY ();
- +
- + c = get_symbol_end ();
- +
- + /* In MRI mode, the EQU and MACRO pseudoops must
- + be handled specially. */
- + mri_line_macro = 0;
- + if (flag_m68k_mri)
- + {
- + char *rest = input_line_pointer + 1;
- +
- + if (*rest == ':')
- + ++rest;
- + if (*rest == ' ' || *rest == '\t')
- + ++rest;
- + if ((strncasecmp (rest, "EQU", 3) == 0
- + || strncasecmp (rest, "SET", 3) == 0)
- + && (rest[3] == ' ' || rest[3] == '\t'))
- + {
- + input_line_pointer = rest + 3;
- + equals (line_start,
- + strncasecmp (rest, "SET", 3) == 0);
- + continue;
- + }
- + if (strncasecmp (rest, "MACRO", 5) == 0
- + && (rest[5] == ' '
- + || rest[5] == '\t'
- + || is_end_of_line[(unsigned char) rest[5]]))
- + mri_line_macro = 1;
- + }
- +
- + /* In MRI mode, we need to handle the MACRO
- pseudo-op specially: we don't want to put the
- symbol in the symbol table. */
- - if (! mri_line_macro
- + if (! mri_line_macro
- #ifdef TC_START_LABEL_WITHOUT_COLON
- && TC_START_LABEL_WITHOUT_COLON(c,
- input_line_pointer)
- #endif
- )
- - line_label = colon (line_start);
- - else
- - line_label = symbol_create (line_start,
- - absolute_section,
- - (valueT) 0,
- - &zero_address_frag);
- -
- - *input_line_pointer = c;
- - if (c == ':')
- - input_line_pointer++;
- - }
- - }
- - }
- -
- - /*
- - * We are at the begining of a line, or similar place.
- - * We expect a well-formed assembler statement.
- - * A "symbol-name:" is a statement.
- - *
- - * Depending on what compiler is used, the order of these tests
- - * may vary to catch most common case 1st.
- - * Each test is independent of all other tests at the (top) level.
- - * PLEASE make a compiler that doesn't use this assembler.
- - * It is crufty to waste a compiler's time encoding things for this
- - * assembler, which then wastes more time decoding it.
- - * (And communicating via (linear) files is silly!
- - * If you must pass stuff, please pass a tree!)
- - */
- - if ((c = *input_line_pointer++) == '\t'
- - || c == ' '
- - || c == '\f'
- - || c == 0)
- - {
- - c = *input_line_pointer++;
- - }
- - know (c != ' '); /* No further leading whitespace. */
- + line_label = colon (line_start);
- + else
- + line_label = symbol_create (line_start,
- + absolute_section,
- + (valueT) 0,
- + &zero_address_frag);
- +
- + *input_line_pointer = c;
- + if (c == ':')
- + input_line_pointer++;
- + }
- + }
- + }
- +
- + /*
- + * We are at the begining of a line, or similar place.
- + * We expect a well-formed assembler statement.
- + * A "symbol-name:" is a statement.
- + *
- + * Depending on what compiler is used, the order of these tests
- + * may vary to catch most common case 1st.
- + * Each test is independent of all other tests at the (top) level.
- + * PLEASE make a compiler that doesn't use this assembler.
- + * It is crufty to waste a compiler's time encoding things for this
- + * assembler, which then wastes more time decoding it.
- + * (And communicating via (linear) files is silly!
- + * If you must pass stuff, please pass a tree!)
- + */
- + if ((c = *input_line_pointer++) == '\t'
- + || c == ' '
- + || c == '\f'
- + || c == 0)
- + {
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + reset_current_symbol(input_line_pointer);
- +#endif
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + c = *input_line_pointer++;
- + }
- + know (c != ' '); /* No further leading whitespace. */
-
- #ifndef NO_LISTING
- - /* If listing is on, and we are expanding a macro, then give
- - the listing code the contents of the expanded line. */
- - if (listing)
- - {
- - if ((listing & LISTING_MACEXP) && macro_nest > 0)
- - {
- - char *copy;
- - int len;
- -
- - /* Find the end of the current expanded macro line. */
- - for (s = input_line_pointer-1; *s ; ++s)
- - if (is_end_of_line[(unsigned char) *s])
- - break;
- -
- - /* Copy it for safe keeping. Also give an indication of
- - how much macro nesting is involved at this point. */
- - len = s - (input_line_pointer-1);
- - copy = (char *) xmalloc (len + macro_nest + 2);
- - memset (copy, '>', macro_nest);
- - copy[macro_nest] = ' ';
- - memcpy (copy + macro_nest + 1, input_line_pointer-1, len);
- - copy[macro_nest+1+len] = '\0';
- -
- - /* Install the line with the listing facility. */
- - listing_newline (copy);
- - }
- - else
- - listing_newline (NULL);
- - }
- + /* If listing is on, and we are expanding a macro, then give
- + the listing code the contents of the expanded line. */
- + if (listing)
- + {
- + if ((listing & LISTING_MACEXP) && macro_nest > 0)
- + {
- + char *copy;
- + int len;
- +
- + /* Find the end of the current expanded macro line. */
- + for (s = input_line_pointer-1; *s ; ++s)
- + if (is_end_of_line[(unsigned char) *s])
- + break;
- +
- + /* Copy it for safe keeping. Also give an indication of
- + how much macro nesting is involved at this point. */
- + len = s - (input_line_pointer-1);
- + copy = (char *) xmalloc (len + macro_nest + 2);
- + memset (copy, '>', macro_nest);
- + copy[macro_nest] = ' ';
- + memcpy (copy + macro_nest + 1, input_line_pointer-1, len);
- + copy[macro_nest+1+len] = '\0';
- +
- + /* Install the line with the listing facility. */
- + listing_newline (copy);
- + }
- + else
- + listing_newline (NULL);
- + }
- +#endif
- +
- + /*
- + * C is the 1st significant character.
- + * Input_line_pointer points after that character.
- + */
- + if (is_name_beginner (c))
- + {
- + /* want user-defined label or pseudo/opcode */
- + HANDLE_CONDITIONAL_ASSEMBLY ();
- +
- + s = --input_line_pointer;
- + c = get_symbol_end (); /* name's delimiter */
- + /*
- + * C is character after symbol.
- + * That character's place in the input line is now '\0'.
- + * S points to the beginning of the symbol.
- + * [In case of pseudo-op, s->'.'.]
- + * Input_line_pointer->'\0' where c was.
- + */
- + if (TC_START_LABEL(c, input_line_pointer))
- + {
- + if (flag_m68k_mri)
- + {
- + char *rest = input_line_pointer + 1;
- +
- + /* In MRI mode, \tsym: set 0 is permitted. */
- +
- + if (*rest == ':')
- + ++rest;
- + if (*rest == ' ' || *rest == '\t')
- + ++rest;
- + if ((strncasecmp (rest, "EQU", 3) == 0
- + || strncasecmp (rest, "SET", 3) == 0)
- + && (rest[3] == ' ' || rest[3] == '\t'))
- + {
- + input_line_pointer = rest + 3;
- + equals (s, 1);
- + continue;
- + }
- + }
- +
- + line_label = colon (s); /* user-defined label */
- +
- +// ADD D.Fujimoto 2007/06/25 >>>>>>>
- +#ifdef EXT_REMOVE
- + update_current_symbol(s);
- #endif
- +// ADD D.Fujimoto 2007/06/25 <<<<<<<
- +
- + *input_line_pointer++ = ':'; /* Put ':' back for error messages' sake. */
- + /* Input_line_pointer->after ':'. */
- + SKIP_WHITESPACE ();
-
- - /*
- - * C is the 1st significant character.
- - * Input_line_pointer points after that character.
- - */
- - if (is_name_beginner (c))
- - {
- - /* want user-defined label or pseudo/opcode */
- - HANDLE_CONDITIONAL_ASSEMBLY ();
- -
- - s = --input_line_pointer;
- - c = get_symbol_end (); /* name's delimiter */
- - /*
- - * C is character after symbol.
- - * That character's place in the input line is now '\0'.
- - * S points to the beginning of the symbol.
- - * [In case of pseudo-op, s->'.'.]
- - * Input_line_pointer->'\0' where c was.
- - */
- - if (TC_START_LABEL(c, input_line_pointer))
- - {
- - if (flag_m68k_mri)
- - {
- - char *rest = input_line_pointer + 1;
- -
- - /* In MRI mode, \tsym: set 0 is permitted. */
- -
- - if (*rest == ':')
- - ++rest;
- - if (*rest == ' ' || *rest == '\t')
- - ++rest;
- - if ((strncasecmp (rest, "EQU", 3) == 0
- - || strncasecmp (rest, "SET", 3) == 0)
- - && (rest[3] == ' ' || rest[3] == '\t'))
- - {
- - input_line_pointer = rest + 3;
- - equals (s, 1);
- - continue;
- - }
- - }
- -
- - line_label = colon (s); /* user-defined label */
- - *input_line_pointer++ = ':'; /* Put ':' back for error messages' sake. */
- - /* Input_line_pointer->after ':'. */
- - SKIP_WHITESPACE ();
- -
- -
- - }
- - else if (c == '='
- - || ((c == ' ' || c == '\t')
- - && input_line_pointer[1] == '='
- +
- + }
- + else if (c == '='
- + || ((c == ' ' || c == '\t')
- + && input_line_pointer[1] == '='
- #ifdef TC_EQUAL_IN_INSN
- - && ! TC_EQUAL_IN_INSN (c, input_line_pointer)
- + && ! TC_EQUAL_IN_INSN (c, input_line_pointer)
- #endif
- - ))
- - {
- - equals (s, 1);
- - demand_empty_rest_of_line ();
- - }
- - else
- - { /* expect pseudo-op or machine instruction */
- - pop = NULL;
- + ))
- + {
- + equals (s, 1);
- + demand_empty_rest_of_line ();
- + }
- + else
- + { /* expect pseudo-op or machine instruction */
- + pop = NULL;
-
- #define IGNORE_OPCODE_CASE
- #ifdef IGNORE_OPCODE_CASE
- - {
- - char *s2 = s;
- - while (*s2)
- - {
- - if (isupper ((unsigned char) *s2))
- - *s2 = tolower (*s2);
- - s2++;
- - }
- - }
- + {
- + char *s2 = s;
- + while (*s2)
- + {
- + if (isupper ((unsigned char) *s2))
- + *s2 = tolower (*s2);
- + s2++;
- + }
- + }
- #endif
-
- - if (NO_PSEUDO_DOT || flag_m68k_mri)
- - {
- - /* The MRI assembler and the m88k use pseudo-ops
- + if (NO_PSEUDO_DOT || flag_m68k_mri)
- + {
- + /* The MRI assembler and the m88k use pseudo-ops
- without a period. */
- - pop = (pseudo_typeS *) hash_find (po_hash, s);
- - if (pop != NULL && pop->poc_handler == NULL)
- - pop = NULL;
- - }
- -
- - if (pop != NULL
- - || (! flag_m68k_mri && *s == '.'))
- - {
- - /*
- - * PSEUDO - OP.
- - *
- - * WARNING: c has next char, which may be end-of-line.
- - * We lookup the pseudo-op table with s+1 because we
- - * already know that the pseudo-op begins with a '.'.
- - */
- -
- - if (pop == NULL)
- - pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
- -
- - /* In MRI mode, we may need to insert an
- + pop = (pseudo_typeS *) hash_find (po_hash, s);
- + if (pop != NULL && pop->poc_handler == NULL)
- + pop = NULL;
- + }
- +
- + if (pop != NULL
- + || (! flag_m68k_mri && *s == '.'))
- + {
- + /*
- + * PSEUDO - OP.
- + *
- + * WARNING: c has next char, which may be end-of-line.
- + * We lookup the pseudo-op table with s+1 because we
- + * already know that the pseudo-op begins with a '.'.
- + */
- +
- + if (pop == NULL)
- + pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
- +
- + /* In MRI mode, we may need to insert an
- automatic alignment directive. What a hack
- this is. */
- - if (mri_pending_align
- - && (pop == NULL
- - || ! ((pop->poc_handler == cons
- - && pop->poc_val == 1)
- - || (pop->poc_handler == s_space
- - && pop->poc_val == 1)
- + if (mri_pending_align
- + && (pop == NULL
- + || ! ((pop->poc_handler == cons
- + && pop->poc_val == 1)
- + || (pop->poc_handler == s_space
- + && pop->poc_val == 1)
- #ifdef tc_conditional_pseudoop
- - || tc_conditional_pseudoop (pop)
- + || tc_conditional_pseudoop (pop)
- #endif
- - || pop->poc_handler == s_if
- - || pop->poc_handler == s_ifdef
- - || pop->poc_handler == s_ifc
- - || pop->poc_handler == s_ifeqs
- - || pop->poc_handler == s_else
- - || pop->poc_handler == s_endif
- - || pop->poc_handler == s_globl
- - || pop->poc_handler == s_ignore)))
- - {
- - do_align (1, (char *) NULL, 0, 0);
- - mri_pending_align = 0;
- - if (line_label != NULL)
- - {
- - symbol_set_frag (line_label, frag_now);
- - S_SET_VALUE (line_label, frag_now_fix ());
- - }
- - }
- -
- - /* Print the error msg now, while we still can */
- - if (pop == NULL)
- - {
- - as_bad (_("Unknown pseudo-op: `%s'"), s);
- - *input_line_pointer = c;
- - s_ignore (0);
- - continue;
- - }
- -
- - /* Put it back for error messages etc. */
- - *input_line_pointer = c;
- - /* The following skip of whitespace is compulsory.
- - A well shaped space is sometimes all that separates
- - keyword from operands. */
- - if (c == ' ' || c == '\t')
- - input_line_pointer++;
- - /*
- - * Input_line is restored.
- - * Input_line_pointer->1st non-blank char
- - * after pseudo-operation.
- - */
- - (*pop->poc_handler) (pop->poc_val);
- -
- - /* If that was .end, just get out now. */
- - if (pop->poc_handler == s_end)
- - goto quit;
- - }
- - else
- - {
- - int inquote = 0;
- + || pop->poc_handler == s_if
- + || pop->poc_handler == s_ifdef
- + || pop->poc_handler == s_ifc
- + || pop->poc_handler == s_ifeqs
- + || pop->poc_handler == s_else
- + || pop->poc_handler == s_endif
- + || pop->poc_handler == s_globl
- + || pop->poc_handler == s_ignore)))
- + {
- + do_align (1, (char *) NULL, 0, 0);
- + mri_pending_align = 0;
- + if (line_label != NULL)
- + {
- + symbol_set_frag (line_label, frag_now);
- + S_SET_VALUE (line_label, frag_now_fix ());
- + }
- + }
- +
- + /* Print the error msg now, while we still can */
- + if (pop == NULL)
- + {
- + as_bad (_("Unknown pseudo-op: `%s'"), s);
- + *input_line_pointer = c;
- + s_ignore (0);
- + continue;
- + }
- +
- + /* Put it back for error messages etc. */
- + *input_line_pointer = c;
- + /* The following skip of whitespace is compulsory.
- + A well shaped space is sometimes all that separates
- + keyword from operands. */
- + if (c == ' ' || c == '\t')
- + input_line_pointer++;
- + /*
- + * Input_line is restored.
- + * Input_line_pointer->1st non-blank char
- + * after pseudo-operation.
- + */
- + (*pop->poc_handler) (pop->poc_val);
- +
- + /* If that was .end, just get out now. */
- + if (pop->poc_handler == s_end)
- + goto quit;
- + }
- + else
- + {
- + int inquote = 0;
- #ifdef QUOTES_IN_INSN
- - int inescape = 0;
- + int inescape = 0;
- #endif
-
- - /* WARNING: c has char, which may be end-of-line. */
- - /* Also: input_line_pointer->`\0` where c was. */
- - *input_line_pointer = c;
- - while (!is_end_of_line[(unsigned char) *input_line_pointer]
- - || inquote
- + /* WARNING: c has char, which may be end-of-line. */
- + /* Also: input_line_pointer->`\0` where c was. */
- + *input_line_pointer = c;
- + while (!is_end_of_line[(unsigned char) *input_line_pointer]
- + || inquote
- #ifdef TC_EOL_IN_INSN
- - || TC_EOL_IN_INSN (input_line_pointer)
- + || TC_EOL_IN_INSN (input_line_pointer)
- #endif
- - )
- - {
- - if (flag_m68k_mri && *input_line_pointer == '\'')
- - inquote = ! inquote;
- + )
- + {
- + if (flag_m68k_mri && *input_line_pointer == '\'')
- + inquote = ! inquote;
- #ifdef QUOTES_IN_INSN
- - if (inescape)
- - inescape = 0;
- - else if (*input_line_pointer == '"')
- - inquote = ! inquote;
- - else if (*input_line_pointer == '\\')
- - inescape = 1;
- + if (inescape)
- + inescape = 0;
- + else if (*input_line_pointer == '"')
- + inquote = ! inquote;
- + else if (*input_line_pointer == '\\')
- + inescape = 1;
- #endif
- - input_line_pointer++;
- - }
- + input_line_pointer++;
- + }
-
- - c = *input_line_pointer;
- - *input_line_pointer = '\0';
- + c = *input_line_pointer;
- + *input_line_pointer = '\0';
-
- - generate_lineno_debug ();
- + generate_lineno_debug ();
-
- - if (macro_defined)
- - {
- - sb out;
- - const char *err;
- + if (macro_defined)
- + {
- + sb out;
- + const char *err;
- macro_entry *macro;
-
- - if (check_macro (s, &out, '\0', &err, ¯o))
- - {
- - if (err != NULL)
- - as_bad ("%s", err);
- - *input_line_pointer++ = c;
- - input_scrub_include_sb (&out,
- - input_line_pointer, 1);
- - sb_kill (&out);
- - buffer_limit =
- - input_scrub_next_buffer (&input_line_pointer);
- + if (check_macro (s, &out, '\0', &err, ¯o))
- + {
- + if (err != NULL)
- + as_bad ("%s", err);
- + *input_line_pointer++ = c;
- + input_scrub_include_sb (&out,
- + input_line_pointer, 1);
- + sb_kill (&out);
- + buffer_limit =
- + input_scrub_next_buffer (&input_line_pointer);
- #ifdef md_macro_info
- md_macro_info (macro);
- #endif
- - continue;
- - }
- - }
- -
- - if (mri_pending_align)
- - {
- - do_align (1, (char *) NULL, 0, 0);
- - mri_pending_align = 0;
- - if (line_label != NULL)
- - {
- - symbol_set_frag (line_label, frag_now);
- - S_SET_VALUE (line_label, frag_now_fix ());
- - }
- - }
- -
- - md_assemble (s); /* Assemble 1 instruction. */
- -
- - *input_line_pointer++ = c;
- -
- - /* We resume loop AFTER the end-of-line from
- - this instruction. */
- - } /* if (*s=='.') */
- - } /* if c==':' */
- - continue;
- - } /* if (is_name_beginner(c) */
- -
- -
- - /* Empty statement? */
- - if (is_end_of_line[(unsigned char) c])
- - continue;
- -
- - if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
- - && isdigit ((unsigned char) c))
- - {
- - /* local label ("4:") */
- - char *backup = input_line_pointer;
- -
- - HANDLE_CONDITIONAL_ASSEMBLY ();
- -
- - temp = c - '0';
- -
- - while (isdigit ((unsigned char) *input_line_pointer))
- - {
- - temp = (temp * 10) + *input_line_pointer - '0';
- - ++input_line_pointer;
- - } /* read the whole number */
- -
- - if (LOCAL_LABELS_DOLLAR
- - && *input_line_pointer == '$'
- - && *(input_line_pointer + 1) == ':')
- - {
- - input_line_pointer += 2;
- -
- - if (dollar_label_defined (temp))
- - {
- - as_fatal (_("label \"%d$\" redefined"), temp);
- - }
- -
- - define_dollar_label (temp);
- - colon (dollar_label_name (temp, 0));
- - continue;
- - }
- -
- - if (LOCAL_LABELS_FB
- - && *input_line_pointer++ == ':')
- - {
- - fb_label_instance_inc (temp);
- - colon (fb_label_name (temp, 0));
- - continue;
- - }
- -
- - input_line_pointer = backup;
- - } /* local label ("4:") */
- -
- - if (c && strchr (line_comment_chars, c))
- - { /* Its a comment. Better say APP or NO_APP */
- - char *ends;
- - char *new_buf;
- - char *new_tmp;
- - unsigned int new_length;
- - char *tmp_buf = 0;
- -
- - bump_line_counters ();
- - s = input_line_pointer;
- - if (strncmp (s, "APP\n", 4))
- - continue; /* We ignore it */
- - s += 4;
- -
- - ends = strstr (s, "#NO_APP\n");
- -
- - if (!ends)
- - {
- - unsigned int tmp_len;
- - unsigned int num;
- -
- - /* The end of the #APP wasn't in this buffer. We
- - keep reading in buffers until we find the #NO_APP
- - that goes with this #APP There is one. The specs
- - guarentee it. . . */
- - tmp_len = buffer_limit - s;
- - tmp_buf = xmalloc (tmp_len + 1);
- - memcpy (tmp_buf, s, tmp_len);
- - do
- - {
- - new_tmp = input_scrub_next_buffer (&buffer);
- - if (!new_tmp)
- - break;
- - else
- - buffer_limit = new_tmp;
- - input_line_pointer = buffer;
- - ends = strstr (buffer, "#NO_APP\n");
- - if (ends)
- - num = ends - buffer;
- - else
- - num = buffer_limit - buffer;
- -
- - tmp_buf = xrealloc (tmp_buf, tmp_len + num);
- - memcpy (tmp_buf + tmp_len, buffer, num);
- - tmp_len += num;
- - }
- - while (!ends);
- -
- - input_line_pointer = ends ? ends + 8 : NULL;
- -
- - s = tmp_buf;
- - ends = s + tmp_len;
- -
- - }
- - else
- - {
- - input_line_pointer = ends + 8;
- - }
- -
- - scrub_string = s;
- - scrub_string_end = ends;
- -
- - new_length = ends - s;
- - new_buf = (char *) xmalloc (new_length);
- - new_tmp = new_buf;
- - for (;;)
- - {
- - int space;
- - int size;
- -
- - space = (new_buf + new_length) - new_tmp;
- - size = do_scrub_chars (scrub_from_string, new_tmp, space);
- -
- - if (size < space)
- - {
- - new_tmp += size;
- - break;
- - }
- -
- - new_buf = xrealloc (new_buf, new_length + 100);
- - new_tmp = new_buf + new_length;
- - new_length += 100;
- - }
- -
- - if (tmp_buf)
- - free (tmp_buf);
- - old_buffer = buffer;
- - old_input = input_line_pointer;
- - old_limit = buffer_limit;
- - buffer = new_buf;
- - input_line_pointer = new_buf;
- - buffer_limit = new_tmp;
- - continue;
- - }
- -
- - HANDLE_CONDITIONAL_ASSEMBLY ();
- + continue;
- + }
- + }
- +
- + if (mri_pending_align)
- + {
- + do_align (1, (char *) NULL, 0, 0);
- + mri_pending_align = 0;
- + if (line_label != NULL)
- + {
- + symbol_set_frag (line_label, frag_now);
- + S_SET_VALUE (line_label, frag_now_fix ());
- + }
- + }
- +
- + md_assemble (s); /* Assemble 1 instruction. */
- +
- +/* add T.Tazaki 2002.03.18 >>> */
- + if( *input_line_pointer == '\n' && c == '\n' ){
- + bump_line_counters (); /* ++lineno */
- + }
- +/* add T.Tazaki 2002.03.18 <<< */
- + *input_line_pointer++ = c;
- +
- + /* We resume loop AFTER the end-of-line from
- + this instruction. */
- + } /* if (*s=='.') */
- + } /* if c==':' */
- + continue;
- + } /* if (is_name_beginner(c) */
- +
- +
- + /* Empty statement? */
- + if (is_end_of_line[(unsigned char) c])
- + continue;
- +
- + if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
- + && isdigit ((unsigned char) c))
- + {
- + /* local label ("4:") */
- + char *backup = input_line_pointer;
- +
- + HANDLE_CONDITIONAL_ASSEMBLY ();
- +
- + temp = c - '0';
- +
- + while (isdigit ((unsigned char) *input_line_pointer))
- + {
- + temp = (temp * 10) + *input_line_pointer - '0';
- + ++input_line_pointer;
- + } /* read the whole number */
- +
- + if (LOCAL_LABELS_DOLLAR
- + && *input_line_pointer == '$'
- + && *(input_line_pointer + 1) == ':')
- + {
- + input_line_pointer += 2;
- +
- + if (dollar_label_defined (temp))
- + {
- + as_fatal (_("label \"%d$\" redefined"), temp);
- + }
- +
- + define_dollar_label (temp);
- + colon (dollar_label_name (temp, 0));
- + continue;
- + }
- +
- + if (LOCAL_LABELS_FB
- + && *input_line_pointer++ == ':')
- + {
- + fb_label_instance_inc (temp);
- + colon (fb_label_name (temp, 0));
- + continue;
- + }
- +
- + input_line_pointer = backup;
- + } /* local label ("4:") */
- +
- + if (c && strchr (line_comment_chars, c))
- + { /* Its a comment. Better say APP or NO_APP */
- + char *ends;
- + char *new_buf;
- + char *new_tmp;
- + unsigned int new_length;
- + char *tmp_buf = 0;
- +
- + bump_line_counters ();
- + s = input_line_pointer;
- + if (strncmp (s, "APP\n", 4))
- + continue; /* We ignore it */
- + s += 4;
- +
- + ends = strstr (s, "#NO_APP\n");
- +
- + if (!ends)
- + {
- + unsigned int tmp_len;
- + unsigned int num;
- +
- + /* The end of the #APP wasn't in this buffer. We
- + keep reading in buffers until we find the #NO_APP
- + that goes with this #APP There is one. The specs
- + guarentee it. . . */
- + tmp_len = buffer_limit - s;
- + tmp_buf = xmalloc (tmp_len + 1);
- + memcpy (tmp_buf, s, tmp_len);
- + do
- + {
- + new_tmp = input_scrub_next_buffer (&buffer);
- + if (!new_tmp)
- + break;
- + else
- + buffer_limit = new_tmp;
- + input_line_pointer = buffer;
- + ends = strstr (buffer, "#NO_APP\n");
- + if (ends)
- + num = ends - buffer;
- + else
- + num = buffer_limit - buffer;
- +
- + tmp_buf = xrealloc (tmp_buf, tmp_len + num);
- + memcpy (tmp_buf + tmp_len, buffer, num);
- + tmp_len += num;
- + }
- + while (!ends);
- +
- + input_line_pointer = ends ? ends + 8 : NULL;
- +
- + s = tmp_buf;
- + ends = s + tmp_len;
- +
- + }
- + else
- + {
- + input_line_pointer = ends + 8;
- + }
- +
- + scrub_string = s;
- + scrub_string_end = ends;
- +
- + new_length = ends - s;
- + new_buf = (char *) xmalloc (new_length);
- + new_tmp = new_buf;
- + for (;;)
- + {
- + int space;
- + int size;
- +
- + space = (new_buf + new_length) - new_tmp;
- + size = do_scrub_chars (scrub_from_string, new_tmp, space);
- +
- + if (size < space)
- + {
- + new_tmp += size;
- + break;
- + }
- +
- + new_buf = xrealloc (new_buf, new_length + 100);
- + new_tmp = new_buf + new_length;
- + new_length += 100;
- + }
- +
- + if (tmp_buf)
- + free (tmp_buf);
- + old_buffer = buffer;
- + old_input = input_line_pointer;
- + old_limit = buffer_limit;
- + buffer = new_buf;
- + input_line_pointer = new_buf;
- + buffer_limit = new_tmp;
- + continue;
- + }
- +
- + HANDLE_CONDITIONAL_ASSEMBLY ();
-
- #ifdef tc_unrecognized_line
- - if (tc_unrecognized_line (c))
- - continue;
- + if (tc_unrecognized_line (c))
- + continue;
- #endif
-
- - /* as_warn("Junk character %d.",c); Now done by ignore_rest */
- - input_line_pointer--; /* Report unknown char as ignored. */
- - ignore_rest_of_line ();
- - } /* while (input_line_pointer<buffer_limit) */
- + /* as_warn("Junk character %d.",c); Now done by ignore_rest */
- + input_line_pointer--; /* Report unknown char as ignored. */
- + ignore_rest_of_line ();
- + } /* while (input_line_pointer<buffer_limit) */
-
- #ifdef md_after_pass_hook
- md_after_pass_hook ();
- #endif
-
- if (old_buffer)
- - {
- - free (buffer);
- - bump_line_counters ();
- - if (old_input != 0)
- - {
- - buffer = old_buffer;
- - input_line_pointer = old_input;
- - buffer_limit = old_limit;
- - old_buffer = 0;
- - goto contin;
- - }
- - }
- - } /* while (more buffers to scan) */
- + {
- + free (buffer);
- + bump_line_counters ();
- + if (old_input != 0)
- + {
- + buffer = old_buffer;
- + input_line_pointer = old_input;
- + buffer_limit = old_limit;
- + old_buffer = 0;
- + goto contin;
- + }
- + }
- + } /* while (more buffers to scan) */
-
- quit:
-
- #ifdef md_cleanup
- md_cleanup();
- #endif
- - input_scrub_close (); /* Close the input file */
- + input_scrub_close (); /* Close the input file */
- }
-
- /* For most MRI pseudo-ops, the line actually ends at the first
- @@ -1123,11 +1399,11 @@ mri_comment_field (stopcp)
-
- for (s = input_line_pointer;
- ((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
- - || inquote);
- + || inquote);
- s++)
- {
- if (*s == '\'')
- - inquote = ! inquote;
- + inquote = ! inquote;
- }
- *stopcp = *s;
- *s = '\0';
- @@ -1191,9 +1467,9 @@ do_align (n, fill, len, max)
- if (fill == NULL)
- {
- if (subseg_text_p (now_seg))
- - default_fill = NOP_OPCODE;
- + default_fill = NOP_OPCODE;
- else
- - default_fill = 0;
- + default_fill = 0;
- fill = &default_fill;
- len = 1;
- }
- @@ -1202,9 +1478,9 @@ do_align (n, fill, len, max)
- if (n != 0 && !need_pass_2)
- {
- if (len <= 1)
- - frag_align (n, *fill, max);
- + frag_align (n, *fill, max);
- else
- - frag_align_pattern (n, fill, len, max);
- + frag_align_pattern (n, fill, len, max);
- }
-
- #ifdef md_do_align
- @@ -1237,9 +1513,9 @@ s_align (arg, bytes_p)
- if (is_end_of_line[(unsigned char) *input_line_pointer])
- {
- if (arg < 0)
- - align = 0;
- + align = 0;
- else
- - align = arg; /* Default value from pseudo-op table */
- + align = arg; /* Default value from pseudo-op table */
- }
- else
- {
- @@ -1251,15 +1527,15 @@ s_align (arg, bytes_p)
- {
- /* Convert to a power of 2. */
- if (align != 0)
- - {
- - unsigned int i;
- + {
- + unsigned int i;
-
- - for (i = 0; (align & 1) == 0; align >>= 1, ++i)
- - ;
- - if (align != 1)
- - as_bad (_("Alignment not a power of 2"));
- - align = i;
- - }
- + for (i = 0; (align & 1) == 0; align >>= 1, ++i)
- + ;
- + if (align != 1)
- + as_bad (_("Alignment not a power of 2"));
- + align = i;
- + }
- }
-
- if (align > 15)
- @@ -1277,27 +1553,27 @@ s_align (arg, bytes_p)
- {
- ++input_line_pointer;
- if (*input_line_pointer == ',')
- - fill_p = 0;
- + fill_p = 0;
- else
- - {
- - fill = get_absolute_expression ();
- - SKIP_WHITESPACE ();
- - fill_p = 1;
- - }
- + {
- + fill = get_absolute_expression ();
- + SKIP_WHITESPACE ();
- + fill_p = 1;
- + }
-
- if (*input_line_pointer != ',')
- - max = 0;
- + max = 0;
- else
- - {
- - ++input_line_pointer;
- - max = get_absolute_expression ();
- - }
- + {
- + ++input_line_pointer;
- + max = get_absolute_expression ();
- + }
- }
-
- if (! fill_p)
- {
- if (arg < 0)
- - as_warn (_("expected fill pattern missing"));
- + as_warn (_("expected fill pattern missing"));
- do_align (align, (char *) NULL, 0, max);
- }
- else
- @@ -1305,25 +1581,25 @@ s_align (arg, bytes_p)
- int fill_len;
-
- if (arg >= 0)
- - fill_len = 1;
- + fill_len = 1;
- else
- - fill_len = - arg;
- + fill_len = - arg;
- if (fill_len <= 1)
- - {
- - char fill_char;
- + {
- + char fill_char;
-
- - fill_char = fill;
- - do_align (align, &fill_char, fill_len, max);
- - }
- + fill_char = fill;
- + do_align (align, &fill_char, fill_len, max);
- + }
- else
- - {
- - char ab[16];
- + {
- + char ab[16];
-
- - if ((size_t) fill_len > sizeof ab)
- - abort ();
- - md_number_to_chars (ab, fill, fill_len);
- - do_align (align, ab, fill_len, max);
- - }
- + if ((size_t) fill_len > sizeof ab)
- + abort ();
- + md_number_to_chars (ab, fill, fill_len);
- + do_align (align, ab, fill_len, max);
- + }
- }
-
- demand_empty_rest_of_line ();
- @@ -1378,16 +1654,16 @@ s_comm (ignore)
- as_bad (_("Expected comma after symbol-name: rest of line ignored."));
- ignore_rest_of_line ();
- if (flag_mri)
- - mri_comment_end (stop, stopc);
- + mri_comment_end (stop, stopc);
- return;
- }
- - input_line_pointer++; /* skip ',' */
- + input_line_pointer++; /* skip ',' */
- if ((temp = get_absolute_expression ()) < 0)
- {
- as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp);
- ignore_rest_of_line ();
- if (flag_mri)
- - mri_comment_end (stop, stopc);
- + mri_comment_end (stop, stopc);
- return;
- }
- *p = 0;
- @@ -1396,19 +1672,19 @@ s_comm (ignore)
- if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
- {
- as_bad (_("Ignoring attempt to re-define symbol `%s'."),
- - S_GET_NAME (symbolP));
- + S_GET_NAME (symbolP));
- ignore_rest_of_line ();
- if (flag_mri)
- - mri_comment_end (stop, stopc);
- + mri_comment_end (stop, stopc);
- return;
- }
- if (S_GET_VALUE (symbolP))
- {
- if (S_GET_VALUE (symbolP) != (valueT) temp)
- - as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
- - S_GET_NAME (symbolP),
- - (long) S_GET_VALUE (symbolP),
- - (long) temp);
- + as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
- + S_GET_NAME (symbolP),
- + (long) S_GET_VALUE (symbolP),
- + (long) temp);
- }
- else
- {
- @@ -1428,7 +1704,7 @@ s_comm (ignore)
-
- if (flag_mri)
- mri_comment_end (stop, stopc);
- -} /* s_comm() */
- +} /* s_comm() */
-
- /* The MRI COMMON pseudo-op. We handle this by creating a common
- symbol with the appropriate name. We make s_space do the right
- @@ -1462,21 +1738,21 @@ s_mri_common (small)
- else
- {
- do
- - {
- - ++input_line_pointer;
- - }
- + {
- + ++input_line_pointer;
- + }
- while (isdigit ((unsigned char) *input_line_pointer));
- c = *input_line_pointer;
- *input_line_pointer = '\0';
-
- if (line_label != NULL)
- - {
- - alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
- - + (input_line_pointer - name)
- - + 1);
- - sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
- - name = alc;
- - }
- + {
- + alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
- + + (input_line_pointer - name)
- + + 1);
- + sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
- + name = alc;
- + }
- }
-
- sym = symbol_find_or_make (name);
- @@ -1575,30 +1851,30 @@ s_app_file (appfile)
- if ((s = demand_copy_string (&length)) != 0)
- {
- /* If this is a fake .appfile, a fake newline was inserted into
- - the buffer. Passing -2 to new_logical_line tells it to
- - account for it. */
- + the buffer. Passing -2 to new_logical_line tells it to
- + account for it. */
- int may_omit
- - = (! new_logical_line (s, appfile ? -2 : -1) && appfile);
- + = (! new_logical_line (s, appfile ? -2 : -1) && appfile);
-
- /* In MRI mode, the preprocessor may have inserted an extraneous
- backquote. */
- if (flag_m68k_mri
- - && *input_line_pointer == '\''
- - && is_end_of_line[(unsigned char) input_line_pointer[1]])
- - ++input_line_pointer;
- + && *input_line_pointer == '\''
- + && is_end_of_line[(unsigned char) input_line_pointer[1]])
- + ++input_line_pointer;
-
- demand_empty_rest_of_line ();
- if (! may_omit)
- - {
- + {
- #ifdef LISTING
- - if (listing)
- - listing_source_file (s);
- + if (listing)
- + listing_source_file (s);
- #endif
- - register_dependency (s);
- + register_dependency (s);
- #ifdef obj_app_file
- - obj_app_file (s);
- + obj_app_file (s);
- #endif
- - }
- + }
- }
- }
-
- @@ -1624,7 +1900,7 @@ s_app_line (ignore)
- new_logical_line ((char *) NULL, l);
- #ifdef LISTING
- if (listing)
- - listing_source_line (l);
- + listing_source_line (l);
- #endif
- }
- demand_empty_rest_of_line ();
- @@ -1643,9 +1919,9 @@ s_end (ignore)
- but we don't support that. */
- SKIP_WHITESPACE ();
- if (! is_end_of_line[(unsigned char) *input_line_pointer]
- - && *input_line_pointer != '*'
- - && *input_line_pointer != '!')
- - as_warn (_("start address not supported"));
- + && *input_line_pointer != '*'
- + && *input_line_pointer != '!')
- + as_warn (_("start address not supported"));
- }
- }
-
- @@ -1703,10 +1979,10 @@ s_fill (ignore)
- input_line_pointer++;
- size = get_absolute_expression ();
- if (*input_line_pointer == ',')
- - {
- - input_line_pointer++;
- - fill = get_absolute_expression ();
- - }
- + {
- + input_line_pointer++;
- + fill = get_absolute_expression ();
- + }
- }
-
- /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
- @@ -1724,44 +2000,44 @@ s_fill (ignore)
- else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
- {
- if (rep_exp.X_add_number < 0)
- - as_warn (_("Repeat < 0, .fill ignored"));
- + as_warn (_("Repeat < 0, .fill ignored"));
- size = 0;
- }
-
- if (size && !need_pass_2)
- {
- if (rep_exp.X_op == O_constant)
- - {
- - p = frag_var (rs_fill, (int) size, (int) size,
- - (relax_substateT) 0, (symbolS *) 0,
- - (offsetT) rep_exp.X_add_number,
- - (char *) 0);
- - }
- + {
- + p = frag_var (rs_fill, (int) size, (int) size,
- + (relax_substateT) 0, (symbolS *) 0,
- + (offsetT) rep_exp.X_add_number,
- + (char *) 0);
- + }
- else
- - {
- - /* We don't have a constant repeat count, so we can't use
- - rs_fill. We can get the same results out of rs_space,
- - but its argument is in bytes, so we must multiply the
- - repeat count by size. */
- -
- - symbolS *rep_sym;
- - rep_sym = make_expr_symbol (&rep_exp);
- - if (size != 1)
- - {
- - expressionS size_exp;
- - size_exp.X_op = O_constant;
- - size_exp.X_add_number = size;
- -
- - rep_exp.X_op = O_multiply;
- - rep_exp.X_add_symbol = rep_sym;
- - rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
- - rep_exp.X_add_number = 0;
- - rep_sym = make_expr_symbol (&rep_exp);
- - }
- -
- - p = frag_var (rs_space, (int) size, (int) size,
- - (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
- - }
- + {
- + /* We don't have a constant repeat count, so we can't use
- + rs_fill. We can get the same results out of rs_space,
- + but its argument is in bytes, so we must multiply the
- + repeat count by size. */
- +
- + symbolS *rep_sym;
- + rep_sym = make_expr_symbol (&rep_exp);
- + if (size != 1)
- + {
- + expressionS size_exp;
- + size_exp.X_op = O_constant;
- + size_exp.X_add_number = size;
- +
- + rep_exp.X_op = O_multiply;
- + rep_exp.X_add_symbol = rep_sym;
- + rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
- + rep_exp.X_add_number = 0;
- + rep_sym = make_expr_symbol (&rep_exp);
- + }
- +
- + p = frag_var (rs_space, (int) size, (int) size,
- + (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
- + }
- memset (p, 0, (unsigned int) size);
- /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
- * flavoured AS. The following bizzare behaviour is to be
- @@ -1770,9 +2046,9 @@ s_fill (ignore)
- * extend. Un*x Sux. */
- #define BSD_FILL_SIZE_CROCK_4 (4)
- md_number_to_chars (p, (valueT) fill,
- - (size > BSD_FILL_SIZE_CROCK_4
- - ? BSD_FILL_SIZE_CROCK_4
- - : (int) size));
- + (size > BSD_FILL_SIZE_CROCK_4
- + ? BSD_FILL_SIZE_CROCK_4
- + : (int) size));
- /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
- * but emits no error message because it seems a legal thing to do.
- * It is a degenerate case of .fill but could be emitted by a compiler.
- @@ -1805,12 +2081,12 @@ s_globl (ignore)
- SKIP_WHITESPACE ();
- c = *input_line_pointer;
- if (c == ',')
- - {
- - input_line_pointer++;
- - SKIP_WHITESPACE ();
- - if (*input_line_pointer == '\n')
- - c = '\n';
- - }
- + {
- + input_line_pointer++;
- + SKIP_WHITESPACE ();
- + if (*input_line_pointer == '\n')
- + c = '\n';
- + }
- }
- while (c == ',');
-
- @@ -1874,15 +2150,15 @@ s_linkonce (ignore)
- s = input_line_pointer;
- c = get_symbol_end ();
- if (strcasecmp (s, "discard") == 0)
- - type = LINKONCE_DISCARD;
- + type = LINKONCE_DISCARD;
- else if (strcasecmp (s, "one_only") == 0)
- - type = LINKONCE_ONE_ONLY;
- + type = LINKONCE_ONE_ONLY;
- else if (strcasecmp (s, "same_size") == 0)
- - type = LINKONCE_SAME_SIZE;
- + type = LINKONCE_SAME_SIZE;
- else if (strcasecmp (s, "same_contents") == 0)
- - type = LINKONCE_SAME_CONTENTS;
- + type = LINKONCE_SAME_CONTENTS;
- else
- - as_warn (_("unrecognized .linkonce type `%s'"), s);
- + as_warn (_("unrecognized .linkonce type `%s'"), s);
-
- *input_line_pointer = c;
- }
- @@ -1902,23 +2178,23 @@ s_linkonce (ignore)
- switch (type)
- {
- default:
- - abort ();
- + abort ();
- case LINKONCE_DISCARD:
- - flags |= SEC_LINK_DUPLICATES_DISCARD;
- - break;
- + flags |= SEC_LINK_DUPLICATES_DISCARD;
- + break;
- case LINKONCE_ONE_ONLY:
- - flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
- - break;
- + flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
- + break;
- case LINKONCE_SAME_SIZE:
- - flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
- - break;
- + flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
- + break;
- case LINKONCE_SAME_CONTENTS:
- - flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
- - break;
- + flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
- + break;
- }
- if (! bfd_set_section_flags (stdoutput, now_seg, flags))
- as_bad (_("bfd_set_section_flags: %s"),
- - bfd_errmsg (bfd_get_error ()));
- + bfd_errmsg (bfd_get_error ()));
- }
- #else /* ! defined (BFD_ASSEMBLER) */
- as_warn (_(".linkonce is not supported for this object file format"));
- @@ -1931,10 +2207,10 @@ s_linkonce (ignore)
- static void
- s_lcomm_internal (needs_align, bytes_p)
- /* 1 if this was a ".bss" directive, which may require a 3rd argument
- - (alignment); 0 if it was an ".lcomm" (2 args only) */
- + (alignment); 0 if it was an ".lcomm" (2 args only) */
- int needs_align;
- /* 1 if the alignment value should be interpreted as the byte boundary,
- - rather than the power of 2. */
- + rather than the power of 2. */
- int bytes_p;
- {
- register char *name;
- @@ -1981,15 +2257,15 @@ s_lcomm_internal (needs_align, bytes_p)
- {
- /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
- if (temp <= bfd_get_gp_size (stdoutput))
- - {
- - bss_seg = subseg_new (".sbss", 1);
- - seg_info (bss_seg)->bss = 1;
- + {
- + bss_seg = subseg_new (".sbss", 1);
- + seg_info (bss_seg)->bss = 1;
- #ifdef BFD_ASSEMBLER
- - if (! bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
- - as_warn (_("error setting flags for \".sbss\": %s"),
- - bfd_errmsg (bfd_get_error ()));
- + if (! bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
- + as_warn (_("error setting flags for \".sbss\": %s"),
- + bfd_errmsg (bfd_get_error ()));
- #endif
- - }
- + }
- }
- #endif
-
- @@ -2007,55 +2283,55 @@ s_lcomm_internal (needs_align, bytes_p)
- align = 0;
- SKIP_WHITESPACE ();
- if (*input_line_pointer != ',')
- - {
- - as_bad (_("Expected comma after size"));
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_bad (_("Expected comma after size"));
- + ignore_rest_of_line ();
- + return;
- + }
- input_line_pointer++;
- SKIP_WHITESPACE ();
- if (*input_line_pointer == '\n')
- - {
- - as_bad (_("Missing alignment"));
- - return;
- - }
- + {
- + as_bad (_("Missing alignment"));
- + return;
- + }
- align = get_absolute_expression ();
- if (bytes_p)
- - {
- - /* Convert to a power of 2. */
- - if (align != 0)
- - {
- - unsigned int i;
- -
- - for (i = 0; (align & 1) == 0; align >>= 1, ++i)
- - ;
- - if (align != 1)
- - as_bad (_("Alignment not a power of 2"));
- - align = i;
- - }
- - }
- + {
- + /* Convert to a power of 2. */
- + if (align != 0)
- + {
- + unsigned int i;
- +
- + for (i = 0; (align & 1) == 0; align >>= 1, ++i)
- + ;
- + if (align != 1)
- + as_bad (_("Alignment not a power of 2"));
- + align = i;
- + }
- + }
- if (align > max_alignment)
- - {
- - align = max_alignment;
- - as_warn (_("Alignment too large: %d. assumed."), align);
- - }
- + {
- + align = max_alignment;
- + as_warn (_("Alignment too large: %d. assumed."), align);
- + }
- else if (align < 0)
- - {
- - align = 0;
- - as_warn (_("Alignment negative. 0 assumed."));
- - }
- + {
- + align = 0;
- + as_warn (_("Alignment negative. 0 assumed."));
- + }
- record_alignment (bss_seg, align);
- - } /* if needs align */
- + } /* if needs align */
- else
- {
- /* Assume some objects may require alignment on some systems. */
- #if defined (TC_ALPHA) && ! defined (VMS)
- if (temp > 1)
- - {
- - align = ffs (temp) - 1;
- - if (temp % (1 << align))
- - abort ();
- - }
- + {
- + align = ffs (temp) - 1;
- + if (temp % (1 << align))
- + abort ();
- + }
- #endif
- }
-
- @@ -2081,14 +2357,14 @@ s_lcomm_internal (needs_align, bytes_p)
- subseg_set (bss_seg, 1);
-
- if (align)
- - frag_align (align, 0, 0);
- - /* detach from old frag */
- + frag_align (align, 0, 0);
- + /* detach from old frag */
- if (S_GET_SEGMENT (symbolP) == bss_seg)
- - symbol_get_frag (symbolP)->fr_symbol = NULL;
- + symbol_get_frag (symbolP)->fr_symbol = NULL;
-
- symbol_set_frag (symbolP, frag_now);
- pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
- - (offsetT) temp, (char *) 0);
- + (offsetT) temp, (char *) 0);
- *pfrag = 0;
-
- S_SET_SEGMENT (symbolP, bss_seg);
- @@ -2098,9 +2374,9 @@ s_lcomm_internal (needs_align, bytes_p)
- ".globl" directive -- be careful not to step on storage class
- in that case. Otherwise, set it to static. */
- if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
- - {
- - S_SET_STORAGE_CLASS (symbolP, C_STAT);
- - }
- + {
- + S_SET_STORAGE_CLASS (symbolP, C_STAT);
- + }
- #endif /* OBJ_COFF */
-
- #ifdef S_SET_SIZE
- @@ -2109,12 +2385,12 @@ s_lcomm_internal (needs_align, bytes_p)
- }
- else
- as_bad (_("Ignoring attempt to re-define symbol `%s'."),
- - S_GET_NAME (symbolP));
- + S_GET_NAME (symbolP));
-
- subseg_set (current_seg, current_subseg);
-
- demand_empty_rest_of_line ();
- -} /* s_lcomm_internal() */
- +} /* s_lcomm_internal() */
-
- void
- s_lcomm (needs_align)
- @@ -2176,11 +2452,11 @@ s_lsym (ignore)
- && S_GET_VALUE (symbolP) == 0)
- {
- /* The name might be an undefined .global symbol; be sure to
- - keep the "external" bit. */
- + keep the "external" bit. */
- S_SET_SEGMENT (symbolP,
- - (exp.X_op == O_constant
- - ? absolute_section
- - : reg_section));
- + (exp.X_op == O_constant
- + ? absolute_section
- + : reg_section));
- S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
- }
- else
- @@ -2189,7 +2465,7 @@ s_lsym (ignore)
- }
- *p = c;
- demand_empty_rest_of_line ();
- -} /* s_lsym() */
- +} /* s_lsym() */
-
- /* Read a line into an sb. */
-
- @@ -2206,7 +2482,7 @@ get_line_sb (line)
- {
- buffer_limit = input_scrub_next_buffer (&input_line_pointer);
- if (buffer_limit == 0)
- - return 0;
- + return 0;
- }
-
- /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
- @@ -2225,24 +2501,24 @@ get_line_sb (line)
-
- inquote = '\0';
- while (! is_end_of_line[(unsigned char) *input_line_pointer]
- - || (inquote != '\0' && *input_line_pointer != '\n'))
- + || (inquote != '\0' && *input_line_pointer != '\n'))
- {
- if (inquote == *input_line_pointer)
- - inquote = '\0';
- + inquote = '\0';
- else if (inquote == '\0')
- - {
- - if (*input_line_pointer == quote1)
- - inquote = quote1;
- - else if (*input_line_pointer == quote2)
- - inquote = quote2;
- - }
- + {
- + if (*input_line_pointer == quote1)
- + inquote = quote1;
- + else if (*input_line_pointer == quote2)
- + inquote = quote2;
- + }
- sb_add_char (line, *input_line_pointer++);
- }
- while (input_line_pointer < buffer_limit
- - && is_end_of_line[(unsigned char) *input_line_pointer])
- + && is_end_of_line[(unsigned char) *input_line_pointer])
- {
- if (input_line_pointer[-1] == '\n')
- - bump_line_counters ();
- + bump_line_counters ();
- ++input_line_pointer;
- }
- return 1;
- @@ -2278,19 +2554,19 @@ s_macro (ignore)
- else
- {
- if (line_label != NULL)
- - {
- - S_SET_SEGMENT (line_label, undefined_section);
- - S_SET_VALUE (line_label, 0);
- - symbol_set_frag (line_label, &zero_address_frag);
- - }
- + {
- + S_SET_SEGMENT (line_label, undefined_section);
- + S_SET_VALUE (line_label, 0);
- + symbol_set_frag (line_label, &zero_address_frag);
- + }
-
- if (((NO_PSEUDO_DOT || flag_m68k_mri)
- - && hash_find (po_hash, name) != NULL)
- - || (! flag_m68k_mri
- - && *name == '.'
- - && hash_find (po_hash, name + 1) != NULL))
- - as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
- - name);
- + && hash_find (po_hash, name) != NULL)
- + || (! flag_m68k_mri
- + && *name == '.'
- + && hash_find (po_hash, name + 1) != NULL))
- + as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
- + name);
- }
-
- sb_kill (&s);
- @@ -2356,17 +2632,17 @@ do_org (segment, exp, fill)
- {
- if (segment != now_seg && segment != absolute_section)
- as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"),
- - segment_name (segment), segment_name (now_seg));
- + segment_name (segment), segment_name (now_seg));
-
- if (now_seg == absolute_section)
- {
- if (fill != 0)
- - as_warn (_("ignoring fill value in absolute section"));
- + as_warn (_("ignoring fill value in absolute section"));
- if (exp->X_op != O_constant)
- - {
- - as_bad (_("only constant offsets supported in absolute section"));
- - exp->X_add_number = 0;
- - }
- + {
- + as_bad (_("only constant offsets supported in absolute section"));
- + exp->X_add_number = 0;
- + }
- abs_section_offset = exp->X_add_number;
- }
- else
- @@ -2374,7 +2650,7 @@ do_org (segment, exp, fill)
- char *p;
-
- p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
- - exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
- + exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
- *p = fill;
- }
- }
- @@ -2426,7 +2702,7 @@ s_org (ignore)
- do_org (segment, &exp, temp_fill);
-
- demand_empty_rest_of_line ();
- -} /* s_org() */
- +} /* s_org() */
-
- /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
- called by the obj-format routine which handles section changing
- @@ -2453,9 +2729,9 @@ s_mri_sect (type)
- else
- {
- do
- - {
- - ++input_line_pointer;
- - }
- + {
- + ++input_line_pointer;
- + }
- while (isdigit ((unsigned char) *input_line_pointer));
- c = *input_line_pointer;
- *input_line_pointer = '\0';
- @@ -2482,29 +2758,29 @@ s_mri_sect (type)
- c = *++input_line_pointer;
- c = toupper ((unsigned char) c);
- if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
- - *type = c;
- + *type = c;
- else
- - as_bad (_("unrecognized section type"));
- + as_bad (_("unrecognized section type"));
- ++input_line_pointer;
-
- #ifdef BFD_ASSEMBLER
- {
- - flagword flags;
- -
- - flags = SEC_NO_FLAGS;
- - if (*type == 'C')
- - flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
- - else if (*type == 'D' || *type == 'M')
- - flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
- - else if (*type == 'R')
- - flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
- - if (flags != SEC_NO_FLAGS)
- - {
- - if (! bfd_set_section_flags (stdoutput, seg, flags))
- - as_warn (_("error setting flags for \"%s\": %s"),
- - bfd_section_name (stdoutput, seg),
- - bfd_errmsg (bfd_get_error ()));
- - }
- + flagword flags;
- +
- + flags = SEC_NO_FLAGS;
- + if (*type == 'C')
- + flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
- + else if (*type == 'D' || *type == 'M')
- + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
- + else if (*type == 'R')
- + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
- + if (flags != SEC_NO_FLAGS)
- + {
- + if (! bfd_set_section_flags (stdoutput, seg, flags))
- + as_warn (_("error setting flags for \"%s\": %s"),
- + bfd_section_name (stdoutput, seg),
- + bfd_errmsg (bfd_get_error ()));
- + }
- }
- #endif
- }
- @@ -2544,15 +2820,15 @@ s_mri_sect (type)
- sectype = input_line_pointer;
- c = get_symbol_end ();
- if (*sectype == '\0')
- - *type = 'C';
- + *type = 'C';
- else if (strcasecmp (sectype, "text") == 0)
- - *type = 'C';
- + *type = 'C';
- else if (strcasecmp (sectype, "data") == 0)
- - *type = 'D';
- + *type = 'D';
- else if (strcasecmp (sectype, "romdata") == 0)
- - *type = 'R';
- + *type = 'R';
- else
- - as_warn (_("unrecognized section type `%s'"), sectype);
- + as_warn (_("unrecognized section type `%s'"), sectype);
- *input_line_pointer = c;
- }
-
- @@ -2565,28 +2841,28 @@ s_mri_sect (type)
- seccmd = input_line_pointer;
- c = get_symbol_end ();
- if (strcasecmp (seccmd, "absolute") == 0)
- - {
- - as_bad (_("absolute sections are not supported"));
- - *input_line_pointer = c;
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_bad (_("absolute sections are not supported"));
- + *input_line_pointer = c;
- + ignore_rest_of_line ();
- + return;
- + }
- else if (strcasecmp (seccmd, "align") == 0)
- - {
- - int align;
- + {
- + int align;
-
- - *input_line_pointer = c;
- - align = get_absolute_expression ();
- - record_alignment (seg, align);
- - }
- + *input_line_pointer = c;
- + align = get_absolute_expression ();
- + record_alignment (seg, align);
- + }
- else
- - {
- - as_warn (_("unrecognized section command `%s'"), seccmd);
- - *input_line_pointer = c;
- - }
- + {
- + as_warn (_("unrecognized section command `%s'"), seccmd);
- + *input_line_pointer = c;
- + }
- }
-
- - demand_empty_rest_of_line ();
- + demand_empty_rest_of_line ();
-
- #else /* ! TC_I960 */
- /* The MRI assembler seems to use different forms of .sect for
- @@ -2746,7 +3022,7 @@ s_set (equiv)
- segment = get_known_segmented_expression (&exp);
-
- if (!need_pass_2)
- - do_org (segment, &exp, 0);
- + do_org (segment, &exp, 0);
-
- *end_name = delim;
- return;
- @@ -2757,28 +3033,28 @@ s_set (equiv)
- {
- #ifndef NO_LISTING
- /* When doing symbol listings, play games with dummy fragments living
- - outside the normal fragment chain to record the file and line info
- + outside the normal fragment chain to record the file and line info
- for this symbol. */
- if (listing & LISTING_SYMBOLS)
- - {
- - extern struct list_info_struct *listing_tail;
- - fragS *dummy_frag = (fragS *) xmalloc (sizeof(fragS));
- - memset (dummy_frag, 0, sizeof(fragS));
- - dummy_frag->fr_type = rs_fill;
- - dummy_frag->line = listing_tail;
- - symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
- - dummy_frag->fr_symbol = symbolP;
- - }
- + {
- + extern struct list_info_struct *listing_tail;
- + fragS *dummy_frag = (fragS *) xmalloc (sizeof(fragS));
- + memset (dummy_frag, 0, sizeof(fragS));
- + dummy_frag->fr_type = rs_fill;
- + dummy_frag->line = listing_tail;
- + symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
- + dummy_frag->fr_symbol = symbolP;
- + }
- else
- #endif
- symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag);
- -
- +
- #ifdef OBJ_COFF
- /* "set" symbols are local unless otherwise specified. */
- SF_SET_LOCAL (symbolP);
- #endif /* OBJ_COFF */
-
- - } /* make a new symbol */
- + } /* make a new symbol */
-
- symbol_table_insert (symbolP);
-
- @@ -2791,7 +3067,7 @@ s_set (equiv)
-
- pseudo_set (symbolP);
- demand_empty_rest_of_line ();
- -} /* s_set() */
- +} /* s_set() */
-
- void
- s_space (mult)
- @@ -2816,39 +3092,39 @@ s_space (mult)
- if (flag_m68k_mri && mult > 1)
- {
- if (now_seg == absolute_section)
- - {
- - abs_section_offset += abs_section_offset & 1;
- - if (line_label != NULL)
- - S_SET_VALUE (line_label, abs_section_offset);
- - }
- + {
- + abs_section_offset += abs_section_offset & 1;
- + if (line_label != NULL)
- + S_SET_VALUE (line_label, abs_section_offset);
- + }
- else if (mri_common_symbol != NULL)
- - {
- - valueT val;
- -
- - val = S_GET_VALUE (mri_common_symbol);
- - if ((val & 1) != 0)
- - {
- - S_SET_VALUE (mri_common_symbol, val + 1);
- - if (line_label != NULL)
- - {
- - expressionS *symexp;
- -
- - symexp = symbol_get_value_expression (line_label);
- - know (symexp->X_op == O_symbol);
- - know (symexp->X_add_symbol == mri_common_symbol);
- - symexp->X_add_number += 1;
- - }
- - }
- - }
- + {
- + valueT val;
- +
- + val = S_GET_VALUE (mri_common_symbol);
- + if ((val & 1) != 0)
- + {
- + S_SET_VALUE (mri_common_symbol, val + 1);
- + if (line_label != NULL)
- + {
- + expressionS *symexp;
- +
- + symexp = symbol_get_value_expression (line_label);
- + know (symexp->X_op == O_symbol);
- + know (symexp->X_add_symbol == mri_common_symbol);
- + symexp->X_add_number += 1;
- + }
- + }
- + }
- else
- - {
- - do_align (1, (char *) NULL, 0, 0);
- - if (line_label != NULL)
- - {
- - symbol_set_frag (line_label, frag_now);
- - S_SET_VALUE (line_label, frag_now_fix ());
- - }
- - }
- + {
- + do_align (1, (char *) NULL, 0, 0);
- + if (line_label != NULL)
- + {
- + symbol_set_frag (line_label, frag_now);
- + S_SET_VALUE (line_label, frag_now_fix ());
- + }
- + }
- }
-
- bytes = mult;
- @@ -2873,77 +3149,77 @@ s_space (mult)
- || (mult != 0 && mult != 1 && val.X_add_number != 0))
- {
- if (exp.X_op != O_constant)
- - as_bad (_("Unsupported variable size or fill value"));
- + as_bad (_("Unsupported variable size or fill value"));
- else
- - {
- - offsetT i;
- + {
- + offsetT i;
-
- - if (mult == 0)
- - mult = 1;
- - bytes = mult * exp.X_add_number;
- - for (i = 0; i < exp.X_add_number; i++)
- - emit_expr (&val, mult);
- - }
- + if (mult == 0)
- + mult = 1;
- + bytes = mult * exp.X_add_number;
- + for (i = 0; i < exp.X_add_number; i++)
- + emit_expr (&val, mult);
- + }
- }
- else
- {
- if (exp.X_op == O_constant)
- - {
- - long repeat;
- -
- - repeat = exp.X_add_number;
- - if (mult)
- - repeat *= mult;
- - bytes = repeat;
- - if (repeat <= 0)
- - {
- - if (! flag_mri)
- - as_warn (_(".space repeat count is zero, ignored"));
- - else if (repeat < 0)
- - as_warn (_(".space repeat count is negative, ignored"));
- - goto getout;
- - }
- -
- - /* If we are in the absolute section, just bump the offset. */
- - if (now_seg == absolute_section)
- - {
- - abs_section_offset += repeat;
- - goto getout;
- - }
- -
- - /* If we are secretly in an MRI common section, then
- - creating space just increases the size of the common
- - symbol. */
- - if (mri_common_symbol != NULL)
- - {
- - S_SET_VALUE (mri_common_symbol,
- - S_GET_VALUE (mri_common_symbol) + repeat);
- - goto getout;
- - }
- -
- - if (!need_pass_2)
- - p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
- - (offsetT) repeat, (char *) 0);
- - }
- + {
- + long repeat;
- +
- + repeat = exp.X_add_number;
- + if (mult)
- + repeat *= mult;
- + bytes = repeat;
- + if (repeat <= 0)
- + {
- + if (! flag_mri)
- + as_warn (_(".space repeat count is zero, ignored"));
- + else if (repeat < 0)
- + as_warn (_(".space repeat count is negative, ignored"));
- + goto getout;
- + }
- +
- + /* If we are in the absolute section, just bump the offset. */
- + if (now_seg == absolute_section)
- + {
- + abs_section_offset += repeat;
- + goto getout;
- + }
- +
- + /* If we are secretly in an MRI common section, then
- + creating space just increases the size of the common
- + symbol. */
- + if (mri_common_symbol != NULL)
- + {
- + S_SET_VALUE (mri_common_symbol,
- + S_GET_VALUE (mri_common_symbol) + repeat);
- + goto getout;
- + }
- +
- + if (!need_pass_2)
- + p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
- + (offsetT) repeat, (char *) 0);
- + }
- else
- - {
- - if (now_seg == absolute_section)
- - {
- - as_bad (_("space allocation too complex in absolute section"));
- - subseg_set (text_section, 0);
- - }
- - if (mri_common_symbol != NULL)
- - {
- - as_bad (_("space allocation too complex in common section"));
- - mri_common_symbol = NULL;
- - }
- - if (!need_pass_2)
- - p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
- - make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
- - }
- + {
- + if (now_seg == absolute_section)
- + {
- + as_bad (_("space allocation too complex in absolute section"));
- + subseg_set (text_section, 0);
- + }
- + if (mri_common_symbol != NULL)
- + {
- + as_bad (_("space allocation too complex in common section"));
- + mri_common_symbol = NULL;
- + }
- + if (!need_pass_2)
- + p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
- + make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
- + }
-
- if (p)
- - *p = val.X_add_number;
- + *p = val.X_add_number;
- }
-
- getout:
- @@ -2985,7 +3261,7 @@ s_float_space (float_type)
- as_bad (_("missing value"));
- ignore_rest_of_line ();
- if (flag_mri)
- - mri_comment_end (stop, stopc);
- + mri_comment_end (stop, stopc);
- return;
- }
-
- @@ -3005,12 +3281,12 @@ s_float_space (float_type)
- {
- flen = hex_float (float_type, temp);
- if (flen < 0)
- - {
- - ignore_rest_of_line ();
- - if (flag_mri)
- - mri_comment_end (stop, stopc);
- - return;
- - }
- + {
- + ignore_rest_of_line ();
- + if (flag_mri)
- + mri_comment_end (stop, stopc);
- + return;
- + }
- }
- else
- {
- @@ -3020,13 +3296,13 @@ s_float_space (float_type)
- know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
- know (flen > 0);
- if (err)
- - {
- - as_bad (_("Bad floating literal: %s"), err);
- - ignore_rest_of_line ();
- - if (flag_mri)
- - mri_comment_end (stop, stopc);
- - return;
- - }
- + {
- + as_bad (_("Bad floating literal: %s"), err);
- + ignore_rest_of_line ();
- + if (flag_mri)
- + mri_comment_end (stop, stopc);
- + return;
- + }
- }
-
- while (--count >= 0)
- @@ -3073,7 +3349,7 @@ s_text (ignore)
- #ifdef OBJ_VMS
- const_flag &= ~IN_DEFAULT_SECTION;
- #endif
- -} /* s_text() */
- +} /* s_text() */
-
-
- void
- @@ -3089,26 +3365,26 @@ demand_empty_rest_of_line ()
- ignore_rest_of_line ();
- }
- /* Return having already swallowed end-of-line. */
- -} /* Return pointing just after end-of-line. */
- +} /* Return pointing just after end-of-line. */
-
- void
- -ignore_rest_of_line () /* For suspect lines: gives warning. */
- +ignore_rest_of_line () /* For suspect lines: gives warning. */
- {
- if (!is_end_of_line[(unsigned char) *input_line_pointer])
- {
- if (isprint ((unsigned char) *input_line_pointer))
- - as_bad (_("Rest of line ignored. First ignored character is `%c'."),
- - *input_line_pointer);
- + as_bad (_("Rest of line ignored. First ignored character is `%c'."),
- + *input_line_pointer);
- else
- - as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
- - *input_line_pointer);
- + as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
- + *input_line_pointer);
- while (input_line_pointer < buffer_limit
- - && !is_end_of_line[(unsigned char) *input_line_pointer])
- - {
- - input_line_pointer++;
- - }
- + && !is_end_of_line[(unsigned char) *input_line_pointer])
- + {
- + input_line_pointer++;
- + }
- }
- - input_line_pointer++; /* Return pointing just after end-of-line. */
- + input_line_pointer++; /* Return pointing just after end-of-line. */
- know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
- }
-
- @@ -3125,14 +3401,14 @@ discard_rest_of_line ()
- }
-
- /*
- - * pseudo_set()
- + * pseudo_set()
- *
- - * In: Pointer to a symbol.
- - * Input_line_pointer->expression.
- + * In: Pointer to a symbol.
- + * Input_line_pointer->expression.
- *
- - * Out: Input_line_pointer->just after any whitespace after expression.
- - * Tried to set symbol to value of expression.
- - * Will change symbols type, value, and frag;
- + * Out: Input_line_pointer->just after any whitespace after expression.
- + * Tried to set symbol to value of expression.
- + * Will change symbols type, value, and frag;
- */
- void
- pseudo_set (symbolP)
- @@ -3143,7 +3419,7 @@ pseudo_set (symbolP)
- int ext;
- #endif /* OBJ_AOUT or OBJ_BOUT */
-
- - know (symbolP); /* NULL pointer is logic error. */
- + know (symbolP); /* NULL pointer is logic error. */
- #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
- ext = S_IS_EXTERNAL (symbolP);
- #endif /* OBJ_AOUT or OBJ_BOUT */
- @@ -3157,20 +3433,20 @@ pseudo_set (symbolP)
- else if (exp.X_op == O_big)
- {
- if (exp.X_add_number > 0)
- - as_bad (_("bignum invalid; zero assumed"));
- + as_bad (_("bignum invalid; zero assumed"));
- else
- - as_bad (_("floating point number invalid; zero assumed"));
- + as_bad (_("floating point number invalid; zero assumed"));
- }
- else if (exp.X_op == O_subtract
- - && (S_GET_SEGMENT (exp.X_add_symbol)
- - == S_GET_SEGMENT (exp.X_op_symbol))
- - && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
- - && (symbol_get_frag (exp.X_add_symbol)
- - == symbol_get_frag (exp.X_op_symbol)))
- + && (S_GET_SEGMENT (exp.X_add_symbol)
- + == S_GET_SEGMENT (exp.X_op_symbol))
- + && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
- + && (symbol_get_frag (exp.X_add_symbol)
- + == symbol_get_frag (exp.X_op_symbol)))
- {
- exp.X_op = O_constant;
- exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
- - - S_GET_VALUE (exp.X_op_symbol));
- + - S_GET_VALUE (exp.X_op_symbol));
- }
-
- switch (exp.X_op)
- @@ -3184,9 +3460,9 @@ pseudo_set (symbolP)
- S_SET_SEGMENT (symbolP, absolute_section);
- #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
- if (ext)
- - S_SET_EXTERNAL (symbolP);
- + S_SET_EXTERNAL (symbolP);
- else
- - S_CLEAR_EXTERNAL (symbolP);
- + S_CLEAR_EXTERNAL (symbolP);
- #endif /* OBJ_AOUT or OBJ_BOUT */
- S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
- if (exp.X_op != O_constant)
- @@ -3201,38 +3477,38 @@ pseudo_set (symbolP)
-
- case O_symbol:
- if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section
- - || exp.X_add_number != 0)
- - symbol_set_value_expression (symbolP, &exp);
- + || exp.X_add_number != 0)
- + symbol_set_value_expression (symbolP, &exp);
- else if (symbol_section_p (symbolP))
- - as_bad ("invalid attempt to set value of section symbol");
- + as_bad ("invalid attempt to set value of section symbol");
- else
- - {
- - symbolS *s = exp.X_add_symbol;
- + {
- + symbolS *s = exp.X_add_symbol;
-
- - S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
- + S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
- #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
- - if (ext)
- - S_SET_EXTERNAL (symbolP);
- - else
- - S_CLEAR_EXTERNAL (symbolP);
- + if (ext)
- + S_SET_EXTERNAL (symbolP);
- + else
- + S_CLEAR_EXTERNAL (symbolP);
- #endif /* OBJ_AOUT or OBJ_BOUT */
- - S_SET_VALUE (symbolP,
- - exp.X_add_number + S_GET_VALUE (s));
- - symbol_set_frag (symbolP, symbol_get_frag (s));
- - copy_symbol_attributes (symbolP, s);
- - }
- + S_SET_VALUE (symbolP,
- + exp.X_add_number + S_GET_VALUE (s));
- + symbol_set_frag (symbolP, symbol_get_frag (s));
- + copy_symbol_attributes (symbolP, s);
- + }
- break;
-
- default:
- /* The value is some complex expression.
- - FIXME: Should we set the segment to anything? */
- + FIXME: Should we set the segment to anything? */
- symbol_set_value_expression (symbolP, &exp);
- break;
- }
- }
-
- /*
- - * cons()
- + * cons()
- *
- * CONStruct more frag of .bytes, or .words etc.
- * Should need_pass_2 be 1 then emit no frag(s).
- @@ -3284,7 +3560,7 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
- /* end-of-line. */
- static void
- cons_worker (nbytes, rva)
- - register int nbytes; /* 1=.byte, 2=.word, 4=.long */
- + register int nbytes; /* 1=.byte, 2=.word, 4=.long */
- int rva;
- {
- int c;
- @@ -3303,7 +3579,7 @@ cons_worker (nbytes, rva)
- {
- demand_empty_rest_of_line ();
- if (flag_mri)
- - mri_comment_end (stop, stopc);
- + mri_comment_end (stop, stopc);
- return;
- }
-
- @@ -3316,18 +3592,18 @@ cons_worker (nbytes, rva)
- {
- #ifdef TC_M68K
- if (flag_m68k_mri)
- - parse_mri_cons (&exp, (unsigned int) nbytes);
- + parse_mri_cons (&exp, (unsigned int) nbytes);
- else
- #endif
- - TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
- + TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
-
- if (rva)
- - {
- - if (exp.X_op == O_symbol)
- - exp.X_op = O_symbol_rva;
- - else
- - as_fatal (_("rva without symbol"));
- - }
- + {
- + if (exp.X_op == O_symbol)
- + exp.X_op = O_symbol_rva;
- + else
- + as_fatal (_("rva without symbol"));
- + }
- emit_expr (&exp, (unsigned int) nbytes);
- ++c;
- }
- @@ -3339,7 +3615,7 @@ cons_worker (nbytes, rva)
- if (flag_mri && nbytes == 1 && (c & 1) != 0)
- mri_pending_align = 1;
-
- - input_line_pointer--; /* Put terminator back into stream. */
- + input_line_pointer--; /* Put terminator back into stream. */
-
- demand_empty_rest_of_line ();
-
- @@ -3389,13 +3665,13 @@ emit_expr (exp, nbytes)
- if (strcmp (segment_name (now_seg), ".line") != 0)
- dwarf_line = -1;
- else if (dwarf_line >= 0
- - && nbytes == 2
- - && exp->X_op == O_constant
- - && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
- + && nbytes == 2
- + && exp->X_op == O_constant
- + && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
- listing_source_line ((unsigned int) dwarf_line);
- else if (nbytes == 4
- - && exp->X_op == O_constant
- - && exp->X_add_number >= 0)
- + && exp->X_op == O_constant
- + && exp->X_add_number >= 0)
- dwarf_line = exp->X_add_number;
- else
- dwarf_line = -1;
- @@ -3412,22 +3688,22 @@ emit_expr (exp, nbytes)
- if (strcmp (segment_name (now_seg), ".debug") != 0)
- dwarf_file = 0;
- else if (dwarf_file == 0
- - && nbytes == 2
- - && exp->X_op == O_constant
- - && exp->X_add_number == 0x11)
- + && nbytes == 2
- + && exp->X_op == O_constant
- + && exp->X_add_number == 0x11)
- dwarf_file = 1;
- else if (dwarf_file == 1
- - && nbytes == 2
- - && exp->X_op == O_constant
- - && exp->X_add_number == 0x12)
- + && nbytes == 2
- + && exp->X_op == O_constant
- + && exp->X_add_number == 0x12)
- dwarf_file = 2;
- else if (dwarf_file == 2
- - && nbytes == 4)
- + && nbytes == 4)
- dwarf_file = 3;
- else if (dwarf_file == 3
- - && nbytes == 2
- - && exp->X_op == O_constant
- - && exp->X_add_number == 0x38)
- + && nbytes == 2
- + && exp->X_op == O_constant
- + && exp->X_add_number == 0x38)
- dwarf_file = 4;
- else
- dwarf_file = 0;
- @@ -3451,7 +3727,7 @@ emit_expr (exp, nbytes)
- if (now_seg == absolute_section)
- {
- if (op != O_constant || exp->X_add_number != 0)
- - as_bad (_("attempt to store value in absolute section"));
- + as_bad (_("attempt to store value in absolute section"));
- abs_section_offset += nbytes;
- return;
- }
- @@ -3470,18 +3746,18 @@ emit_expr (exp, nbytes)
- /* Negate the bignum: one's complement each digit and add 1. */
- carry = 1;
- for (i = 0; i < exp->X_add_number; i++)
- - {
- - unsigned long next;
- + {
- + unsigned long next;
-
- - next = (((~ (generic_bignum[i] & LITTLENUM_MASK))
- - & LITTLENUM_MASK)
- - + carry);
- - generic_bignum[i] = next & LITTLENUM_MASK;
- - carry = next >> LITTLENUM_NUMBER_OF_BITS;
- - }
- + next = (((~ (generic_bignum[i] & LITTLENUM_MASK))
- + & LITTLENUM_MASK)
- + + carry);
- + generic_bignum[i] = next & LITTLENUM_MASK;
- + carry = next >> LITTLENUM_NUMBER_OF_BITS;
- + }
-
- /* We can ignore any carry out, because it will be handled by
- - extra_digit if it is needed. */
- + extra_digit if it is needed. */
-
- extra_digit = (valueT) -1;
- op = O_big;
- @@ -3539,15 +3815,15 @@ emit_expr (exp, nbytes)
- int gencnt;
-
- if (! exp->X_unsigned && exp->X_add_number < 0)
- - extra_digit = (valueT) -1;
- + extra_digit = (valueT) -1;
- val = (valueT) exp->X_add_number;
- gencnt = 0;
- do
- - {
- - generic_bignum[gencnt] = val & LITTLENUM_MASK;
- - val >>= LITTLENUM_NUMBER_OF_BITS;
- - ++gencnt;
- - }
- + {
- + generic_bignum[gencnt] = val & LITTLENUM_MASK;
- + val >>= LITTLENUM_NUMBER_OF_BITS;
- + ++gencnt;
- + }
- while (val != 0);
- op = exp->X_op = O_big;
- exp->X_add_number = gencnt;
- @@ -3562,38 +3838,38 @@ emit_expr (exp, nbytes)
- register valueT unmask;
-
- /* JF << of >= number of bits in the object is undefined. In
- - particular SPARC (Sun 4) has problems */
- + particular SPARC (Sun 4) has problems */
- if (nbytes >= sizeof (valueT))
- - {
- - mask = 0;
- - if (nbytes > sizeof (valueT))
- - hibit = 0;
- - else
- - hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
- - }
- + {
- + mask = 0;
- + if (nbytes > sizeof (valueT))
- + hibit = 0;
- + else
- + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
- + }
- else
- - {
- - /* Don't store these bits. */
- - mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
- - hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
- - }
- + {
- + /* Don't store these bits. */
- + mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
- + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
- + }
-
- - unmask = ~mask; /* Do store these bits. */
- + unmask = ~mask; /* Do store these bits. */
-
- #ifdef NEVER
- "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
- - mask = ~(unmask >> 1); /* Includes sign bit now. */
- + mask = ~(unmask >> 1); /* Includes sign bit now. */
- #endif
-
- get = exp->X_add_number;
- use = get & unmask;
- if ((get & mask) != 0
- - && ((get & mask) != mask
- - || (get & hibit) == 0))
- - { /* Leading bits contain both 0s & 1s. */
- - as_warn (_("Value 0x%lx truncated to 0x%lx."),
- - (unsigned long) get, (unsigned long) use);
- - }
- + && ((get & mask) != mask
- + || (get & hibit) == 0))
- + { /* Leading bits contain both 0s & 1s. */
- + as_warn (_("Value 0x%lx truncated to 0x%lx."),
- + (unsigned long) get, (unsigned long) use);
- + }
- /* put bytes in right order. */
- md_number_to_chars (p, use, (int) nbytes);
- }
- @@ -3606,90 +3882,90 @@ emit_expr (exp, nbytes)
-
- size = exp->X_add_number * CHARS_PER_LITTLENUM;
- if (nbytes < size)
- - {
- - as_warn (_("Bignum truncated to %d bytes"), nbytes);
- - size = nbytes;
- - }
- + {
- + as_warn (_("Bignum truncated to %d bytes"), nbytes);
- + size = nbytes;
- + }
-
- if (target_big_endian)
- - {
- - while (nbytes > size)
- - {
- - md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
- - nbytes -= CHARS_PER_LITTLENUM;
- - p += CHARS_PER_LITTLENUM;
- - }
- -
- - nums = generic_bignum + size / CHARS_PER_LITTLENUM;
- - while (size > 0)
- - {
- - --nums;
- - md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
- - size -= CHARS_PER_LITTLENUM;
- - p += CHARS_PER_LITTLENUM;
- - }
- - }
- + {
- + while (nbytes > size)
- + {
- + md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
- + nbytes -= CHARS_PER_LITTLENUM;
- + p += CHARS_PER_LITTLENUM;
- + }
- +
- + nums = generic_bignum + size / CHARS_PER_LITTLENUM;
- + while (size > 0)
- + {
- + --nums;
- + md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
- + size -= CHARS_PER_LITTLENUM;
- + p += CHARS_PER_LITTLENUM;
- + }
- + }
- else
- - {
- - nums = generic_bignum;
- - while (size > 0)
- - {
- - md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
- - ++nums;
- - size -= CHARS_PER_LITTLENUM;
- - p += CHARS_PER_LITTLENUM;
- - nbytes -= CHARS_PER_LITTLENUM;
- - }
- -
- - while (nbytes > 0)
- - {
- - md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
- - nbytes -= CHARS_PER_LITTLENUM;
- - p += CHARS_PER_LITTLENUM;
- - }
- - }
- + {
- + nums = generic_bignum;
- + while (size > 0)
- + {
- + md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
- + ++nums;
- + size -= CHARS_PER_LITTLENUM;
- + p += CHARS_PER_LITTLENUM;
- + nbytes -= CHARS_PER_LITTLENUM;
- + }
- +
- + while (nbytes > 0)
- + {
- + md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
- + nbytes -= CHARS_PER_LITTLENUM;
- + p += CHARS_PER_LITTLENUM;
- + }
- + }
- }
- else
- {
- memset (p, 0, nbytes);
-
- /* Now we need to generate a fixS to record the symbol value.
- - This is easy for BFD. For other targets it can be more
- - complex. For very complex cases (currently, the HPPA and
- - NS32K), you can define TC_CONS_FIX_NEW to do whatever you
- - want. For simpler cases, you can define TC_CONS_RELOC to be
- - the name of the reloc code that should be stored in the fixS.
- - If neither is defined, the code uses NO_RELOC if it is
- - defined, and otherwise uses 0. */
- + This is easy for BFD. For other targets it can be more
- + complex. For very complex cases (currently, the HPPA and
- + NS32K), you can define TC_CONS_FIX_NEW to do whatever you
- + want. For simpler cases, you can define TC_CONS_RELOC to be
- + the name of the reloc code that should be stored in the fixS.
- + If neither is defined, the code uses NO_RELOC if it is
- + defined, and otherwise uses 0. */
-
- #ifdef BFD_ASSEMBLER
- #ifdef TC_CONS_FIX_NEW
- TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
- #else
- {
- - bfd_reloc_code_real_type r;
- -
- - switch (nbytes)
- - {
- - case 1:
- - r = BFD_RELOC_8;
- - break;
- - case 2:
- - r = BFD_RELOC_16;
- - break;
- - case 4:
- - r = BFD_RELOC_32;
- - break;
- - case 8:
- - r = BFD_RELOC_64;
- - break;
- - default:
- - as_bad (_("unsupported BFD relocation size %u"), nbytes);
- - r = BFD_RELOC_32;
- - break;
- - }
- - fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
- - 0, r);
- + bfd_reloc_code_real_type r;
- +
- + switch (nbytes)
- + {
- + case 1:
- + r = BFD_RELOC_8;
- + break;
- + case 2:
- + r = BFD_RELOC_16;
- + break;
- + case 4:
- + r = BFD_RELOC_32;
- + break;
- + case 8:
- + r = BFD_RELOC_64;
- + break;
- + default:
- + as_bad (_("unsupported BFD relocation size %u"), nbytes);
- + r = BFD_RELOC_32;
- + break;
- + }
- + fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
- + 0, r);
- }
- #endif
- #else
- @@ -3697,8 +3973,8 @@ emit_expr (exp, nbytes)
- TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
- #else
- /* Figure out which reloc number to use. Use TC_CONS_RELOC if
- - it is defined, otherwise use NO_RELOC if it is defined,
- - otherwise use 0. */
- + it is defined, otherwise use NO_RELOC if it is defined,
- + otherwise use 0. */
- #ifndef TC_CONS_RELOC
- #ifdef NO_RELOC
- #define TC_CONS_RELOC NO_RELOC
- @@ -3707,7 +3983,7 @@ emit_expr (exp, nbytes)
- #endif
- #endif
- fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
- - TC_CONS_RELOC);
- + TC_CONS_RELOC);
- #endif /* TC_CONS_FIX_NEW */
- #endif /* BFD_ASSEMBLER */
- }
- @@ -3740,101 +4016,101 @@ parse_bitfield_cons (exp, nbytes)
- (void) expression (exp);
-
- if (*input_line_pointer == ':')
- - { /* bitfields */
- + { /* bitfields */
- long value = 0;
-
- for (;;)
- - {
- - unsigned long width;
- -
- - if (*input_line_pointer != ':')
- - {
- - input_line_pointer = hold;
- - break;
- - } /* next piece is not a bitfield */
- -
- - /* In the general case, we can't allow
- - full expressions with symbol
- - differences and such. The relocation
- - entries for symbols not defined in this
- - assembly would require arbitrary field
- - widths, positions, and masks which most
- - of our current object formats don't
- - support.
- -
- - In the specific case where a symbol
- - *is* defined in this assembly, we
- - *could* build fixups and track it, but
- - this could lead to confusion for the
- - backends. I'm lazy. I'll take any
- - SEG_ABSOLUTE. I think that means that
- - you can use a previous .set or
- - .equ type symbol. xoxorich. */
- -
- - if (exp->X_op == O_absent)
- - {
- - as_warn (_("using a bit field width of zero"));
- - exp->X_add_number = 0;
- - exp->X_op = O_constant;
- - } /* implied zero width bitfield */
- -
- - if (exp->X_op != O_constant)
- - {
- - *input_line_pointer = '\0';
- - as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
- - *input_line_pointer = ':';
- - demand_empty_rest_of_line ();
- - return;
- - } /* too complex */
- -
- - if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
- - {
- - as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
- - width, nbytes, (BITS_PER_CHAR * nbytes));
- - width = BITS_PER_CHAR * nbytes;
- - } /* too big */
- -
- - if (width > bits_available)
- - {
- - /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
- - input_line_pointer = hold;
- - exp->X_add_number = value;
- - break;
- - } /* won't fit */
- -
- - hold = ++input_line_pointer; /* skip ':' */
- -
- - (void) expression (exp);
- - if (exp->X_op != O_constant)
- - {
- - char cache = *input_line_pointer;
- -
- - *input_line_pointer = '\0';
- - as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
- - *input_line_pointer = cache;
- - demand_empty_rest_of_line ();
- - return;
- - } /* too complex */
- -
- - value |= ((~(-1 << width) & exp->X_add_number)
- - << ((BITS_PER_CHAR * nbytes) - bits_available));
- -
- - if ((bits_available -= width) == 0
- - || is_it_end_of_statement ()
- - || *input_line_pointer != ',')
- - {
- - break;
- - } /* all the bitfields we're gonna get */
- -
- - hold = ++input_line_pointer;
- - (void) expression (exp);
- - } /* forever loop */
- + {
- + unsigned long width;
- +
- + if (*input_line_pointer != ':')
- + {
- + input_line_pointer = hold;
- + break;
- + } /* next piece is not a bitfield */
- +
- + /* In the general case, we can't allow
- + full expressions with symbol
- + differences and such. The relocation
- + entries for symbols not defined in this
- + assembly would require arbitrary field
- + widths, positions, and masks which most
- + of our current object formats don't
- + support.
- +
- + In the specific case where a symbol
- + *is* defined in this assembly, we
- + *could* build fixups and track it, but
- + this could lead to confusion for the
- + backends. I'm lazy. I'll take any
- + SEG_ABSOLUTE. I think that means that
- + you can use a previous .set or
- + .equ type symbol. xoxorich. */
- +
- + if (exp->X_op == O_absent)
- + {
- + as_warn (_("using a bit field width of zero"));
- + exp->X_add_number = 0;
- + exp->X_op = O_constant;
- + } /* implied zero width bitfield */
- +
- + if (exp->X_op != O_constant)
- + {
- + *input_line_pointer = '\0';
- + as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
- + *input_line_pointer = ':';
- + demand_empty_rest_of_line ();
- + return;
- + } /* too complex */
- +
- + if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
- + {
- + as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
- + width, nbytes, (BITS_PER_CHAR * nbytes));
- + width = BITS_PER_CHAR * nbytes;
- + } /* too big */
- +
- + if (width > bits_available)
- + {
- + /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
- + input_line_pointer = hold;
- + exp->X_add_number = value;
- + break;
- + } /* won't fit */
- +
- + hold = ++input_line_pointer; /* skip ':' */
- +
- + (void) expression (exp);
- + if (exp->X_op != O_constant)
- + {
- + char cache = *input_line_pointer;
- +
- + *input_line_pointer = '\0';
- + as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
- + *input_line_pointer = cache;
- + demand_empty_rest_of_line ();
- + return;
- + } /* too complex */
- +
- + value |= ((~(-1 << width) & exp->X_add_number)
- + << ((BITS_PER_CHAR * nbytes) - bits_available));
- +
- + if ((bits_available -= width) == 0
- + || is_it_end_of_statement ()
- + || *input_line_pointer != ',')
- + {
- + break;
- + } /* all the bitfields we're gonna get */
- +
- + hold = ++input_line_pointer;
- + (void) expression (exp);
- + } /* forever loop */
-
- exp->X_add_number = value;
- exp->X_op = O_constant;
- exp->X_unsigned = 1;
- - } /* if looks like a bitfield */
- -} /* parse_bitfield_cons() */
- + } /* if looks like a bitfield */
- +} /* parse_bitfield_cons() */
-
- #endif /* BITFIELD_CONS_EXPRESSIONS */
-
- @@ -3848,8 +4124,8 @@ parse_mri_cons (exp, nbytes)
- {
- if (*input_line_pointer != '\''
- && (input_line_pointer[1] != '\''
- - || (*input_line_pointer != 'A'
- - && *input_line_pointer != 'E')))
- + || (*input_line_pointer != 'A'
- + && *input_line_pointer != 'E')))
- TC_PARSE_CONS_EXPRESSION (exp, nbytes);
- else
- {
- @@ -3857,50 +4133,50 @@ parse_mri_cons (exp, nbytes)
- unsigned int result = 0;
-
- /* An MRI style string. Cut into as many bytes as will fit into
- - a nbyte chunk, left justify if necessary, and separate with
- - commas so we can try again later. */
- + a nbyte chunk, left justify if necessary, and separate with
- + commas so we can try again later. */
- if (*input_line_pointer == 'A')
- - ++input_line_pointer;
- + ++input_line_pointer;
- else if (*input_line_pointer == 'E')
- - {
- - as_bad (_("EBCDIC constants are not supported"));
- - ++input_line_pointer;
- - }
- + {
- + as_bad (_("EBCDIC constants are not supported"));
- + ++input_line_pointer;
- + }
-
- input_line_pointer++;
- for (scan = 0; scan < nbytes; scan++)
- - {
- - if (*input_line_pointer == '\'')
- - {
- - if (input_line_pointer[1] == '\'')
- - {
- - input_line_pointer++;
- - }
- - else
- - break;
- - }
- - result = (result << 8) | (*input_line_pointer++);
- - }
- + {
- + if (*input_line_pointer == '\'')
- + {
- + if (input_line_pointer[1] == '\'')
- + {
- + input_line_pointer++;
- + }
- + else
- + break;
- + }
- + result = (result << 8) | (*input_line_pointer++);
- + }
-
- /* Left justify */
- while (scan < nbytes)
- - {
- - result <<= 8;
- - scan++;
- - }
- + {
- + result <<= 8;
- + scan++;
- + }
- /* Create correct expression */
- exp->X_op = O_constant;
- exp->X_add_number = result;
- /* Fake it so that we can read the next char too */
- if (input_line_pointer[0] != '\'' ||
- - (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
- - {
- - input_line_pointer -= 2;
- - input_line_pointer[0] = ',';
- - input_line_pointer[1] = '\'';
- - }
- + (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
- + {
- + input_line_pointer -= 2;
- + input_line_pointer[0] = ',';
- + input_line_pointer[1] = '\'';
- + }
- else
- - input_line_pointer++;
- + input_line_pointer++;
- }
- }
- #endif /* TC_M68K */
- @@ -3998,47 +4274,47 @@ hex_float (float_type, bytes)
- int d;
-
- /* The MRI assembler accepts arbitrary underscores strewn about
- - through the hex constant, so we ignore them as well. */
- + through the hex constant, so we ignore them as well. */
- if (*input_line_pointer == '_')
- - {
- - ++input_line_pointer;
- - continue;
- - }
- + {
- + ++input_line_pointer;
- + continue;
- + }
-
- if (i >= length)
- - {
- - as_warn (_("Floating point constant too large"));
- - return -1;
- - }
- + {
- + as_warn (_("Floating point constant too large"));
- + return -1;
- + }
- d = hex_value (*input_line_pointer) << 4;
- ++input_line_pointer;
- while (*input_line_pointer == '_')
- - ++input_line_pointer;
- + ++input_line_pointer;
- if (hex_p (*input_line_pointer))
- - {
- - d += hex_value (*input_line_pointer);
- - ++input_line_pointer;
- - }
- + {
- + d += hex_value (*input_line_pointer);
- + ++input_line_pointer;
- + }
- if (target_big_endian)
- - bytes[i] = d;
- + bytes[i] = d;
- else
- - bytes[length - i - 1] = d;
- + bytes[length - i - 1] = d;
- ++i;
- }
-
- if (i < length)
- {
- if (target_big_endian)
- - memset (bytes + i, 0, length - i);
- + memset (bytes + i, 0, length - i);
- else
- - memset (bytes, 0, length - i);
- + memset (bytes, 0, length - i);
- }
-
- return length;
- }
-
- /*
- - * float_cons()
- + * float_cons()
- *
- * CONStruct some more frag chars of .floats .ffloats etc.
- * Makes 0 or more new frags.
- @@ -4053,18 +4329,18 @@ hex_float (float_type, bytes)
- * a choice of 2 flavours of noise according to which of 2 floating-point
- * scanners you directed AS to use.
- *
- - * In: input_line_pointer->whitespace before, or '0' of flonum.
- + * In: input_line_pointer->whitespace before, or '0' of flonum.
- *
- */
-
- void
- float_cons (float_type)
- /* Clobbers input_line-pointer, checks end-of-line. */
- - register int float_type; /* 'f':.ffloat ... 'F':.float ... */
- + register int float_type; /* 'f':.ffloat ... 'F':.float ... */
- {
- register char *p;
- - int length; /* Number of chars in an object. */
- - register char *err; /* Error from scanning floating literal. */
- + int length; /* Number of chars in an object. */
- + register char *err; /* Error from scanning floating literal. */
- char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
-
- if (is_it_end_of_statement ())
- @@ -4088,70 +4364,70 @@ float_cons (float_type)
- * diagnostics if your input is ill-conditioned.
- */
- if (input_line_pointer[0] == '0'
- - && isalpha ((unsigned char) input_line_pointer[1]))
- - input_line_pointer += 2;
- + && isalpha ((unsigned char) input_line_pointer[1]))
- + input_line_pointer += 2;
-
- /* Accept :xxxx, where the x's are hex digits, for a floating
- point with the exact digits specified. */
- if (input_line_pointer[0] == ':')
- - {
- - ++input_line_pointer;
- - length = hex_float (float_type, temp);
- - if (length < 0)
- - {
- - ignore_rest_of_line ();
- - return;
- - }
- - }
- + {
- + ++input_line_pointer;
- + length = hex_float (float_type, temp);
- + if (length < 0)
- + {
- + ignore_rest_of_line ();
- + return;
- + }
- + }
- else
- - {
- - err = md_atof (float_type, temp, &length);
- - know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
- - know (length > 0);
- - if (err)
- - {
- - as_bad (_("Bad floating literal: %s"), err);
- - ignore_rest_of_line ();
- - return;
- - }
- - }
- + {
- + err = md_atof (float_type, temp, &length);
- + know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
- + know (length > 0);
- + if (err)
- + {
- + as_bad (_("Bad floating literal: %s"), err);
- + ignore_rest_of_line ();
- + return;
- + }
- + }
-
- if (!need_pass_2)
- - {
- - int count;
- + {
- + int count;
-
- - count = 1;
- + count = 1;
-
- #ifdef REPEAT_CONS_EXPRESSIONS
- - if (*input_line_pointer == ':')
- - {
- - expressionS count_exp;
- -
- - ++input_line_pointer;
- - expression (&count_exp);
- - if (count_exp.X_op != O_constant
- - || count_exp.X_add_number <= 0)
- - {
- - as_warn (_("unresolvable or nonpositive repeat count; using 1"));
- - }
- - else
- - count = count_exp.X_add_number;
- - }
- + if (*input_line_pointer == ':')
- + {
- + expressionS count_exp;
- +
- + ++input_line_pointer;
- + expression (&count_exp);
- + if (count_exp.X_op != O_constant
- + || count_exp.X_add_number <= 0)
- + {
- + as_warn (_("unresolvable or nonpositive repeat count; using 1"));
- + }
- + else
- + count = count_exp.X_add_number;
- + }
- #endif
-
- - while (--count >= 0)
- - {
- - p = frag_more (length);
- - memcpy (p, temp, (unsigned int) length);
- - }
- - }
- + while (--count >= 0)
- + {
- + p = frag_more (length);
- + memcpy (p, temp, (unsigned int) length);
- + }
- + }
- SKIP_WHITESPACE ();
- }
- while (*input_line_pointer++ == ',');
-
- - --input_line_pointer; /* Put terminator back into stream. */
- + --input_line_pointer; /* Put terminator back into stream. */
- demand_empty_rest_of_line ();
- -} /* float_cons() */
- +} /* float_cons() */
-
- /* Return the size of a LEB128 value */
-
- @@ -4166,13 +4442,13 @@ sizeof_sleb128 (value)
- {
- byte = (value & 0x7f);
- /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
- - Fortunately, we can structure things so that the extra work reduces
- - to a noop on systems that do things "properly". */
- + Fortunately, we can structure things so that the extra work reduces
- + to a noop on systems that do things "properly". */
- value = (value >> 7) | ~(-(offsetT)1 >> 7);
- size += 1;
- }
- while (!(((value == 0) && ((byte & 0x40) == 0))
- - || ((value == -1) && ((byte & 0x40) != 0))));
- + || ((value == -1) && ((byte & 0x40) != 0))));
-
- return size;
- }
- @@ -4221,14 +4497,14 @@ output_sleb128 (p, value)
- unsigned byte = (value & 0x7f);
-
- /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
- - Fortunately, we can structure things so that the extra work reduces
- - to a noop on systems that do things "properly". */
- + Fortunately, we can structure things so that the extra work reduces
- + to a noop on systems that do things "properly". */
- value = (value >> 7) | ~(-(offsetT)1 >> 7);
-
- more = !((((value == 0) && ((byte & 0x40) == 0))
- - || ((value == -1) && ((byte & 0x40) != 0))));
- + || ((value == -1) && ((byte & 0x40) != 0))));
- if (more)
- - byte |= 0x80;
- + byte |= 0x80;
-
- *p++ = byte;
- }
- @@ -4249,8 +4525,8 @@ output_uleb128 (p, value)
- unsigned byte = (value & 0x7f);
- value >>= 7;
- if (value != 0)
- - /* More bytes to follow. */
- - byte |= 0x80;
- + /* More bytes to follow. */
- + byte |= 0x80;
-
- *p++ = byte;
- }
- @@ -4293,27 +4569,27 @@ output_big_sleb128 (p, bignum, size)
- do
- {
- if (loaded < 7 && size > 0)
- - {
- - val |= (*bignum << loaded);
- - loaded += 8 * CHARS_PER_LITTLENUM;
- - size--;
- - bignum++;
- - }
- + {
- + val |= (*bignum << loaded);
- + loaded += 8 * CHARS_PER_LITTLENUM;
- + size--;
- + bignum++;
- + }
-
- byte = val & 0x7f;
- loaded -= 7;
- val >>= 7;
-
- if (size == 0)
- - {
- - if ((val == 0 && (byte & 0x40) == 0)
- - || (~(val | ~(((valueT)1 << loaded) - 1)) == 0
- - && (byte & 0x40) != 0))
- - byte |= 0x80;
- - }
- + {
- + if ((val == 0 && (byte & 0x40) == 0)
- + || (~(val | ~(((valueT)1 << loaded) - 1)) == 0
- + && (byte & 0x40) != 0))
- + byte |= 0x80;
- + }
-
- if (orig)
- - *p = byte;
- + *p = byte;
- p++;
- }
- while (byte & 0x80);
- @@ -4340,22 +4616,22 @@ output_big_uleb128 (p, bignum, size)
- do
- {
- if (loaded < 7 && size > 0)
- - {
- - val |= (*bignum << loaded);
- - loaded += 8 * CHARS_PER_LITTLENUM;
- - size--;
- - bignum++;
- - }
- + {
- + val |= (*bignum << loaded);
- + loaded += 8 * CHARS_PER_LITTLENUM;
- + size--;
- + bignum++;
- + }
-
- byte = val & 0x7f;
- loaded -= 7;
- val >>= 7;
-
- if (size > 0 || val)
- - byte |= 0x80;
- + byte |= 0x80;
-
- if (orig)
- - *p = byte;
- + *p = byte;
- p++;
- }
- while (byte & 0x80);
- @@ -4429,10 +4705,10 @@ emit_leb128_expr(exp, sign)
- else
- {
- /* Otherwise, we have to create a variable sized fragment and
- - resolve things later. */
- + resolve things later. */
-
- frag_var (rs_leb128, sizeof_uleb128 (~(valueT)0), 0, sign,
- - make_expr_symbol (exp), 0, (char *) NULL);
- + make_expr_symbol (exp), 0, (char *) NULL);
- }
- }
-
- @@ -4454,7 +4730,7 @@ s_leb128 (sign)
- }
-
- /*
- - * stringer()
- + * stringer()
- *
- * We read 0 or more ',' separated, double-quoted strings.
- *
- @@ -4463,9 +4739,9 @@ s_leb128 (sign)
-
-
- void
- -stringer (append_zero) /* Worker to do .ascii etc statements. */
- +stringer (append_zero) /* Worker to do .ascii etc statements. */
- /* Checks end-of-line. */
- - register int append_zero; /* 0: don't append '\0', else 1 */
- + register int append_zero; /* 0: don't append '\0', else 1 */
- {
- register unsigned int c;
- char *start;
- @@ -4484,72 +4760,72 @@ stringer (append_zero) /* Worker to do .ascii etc statements. */
- */
- if (is_it_end_of_statement ())
- {
- - c = 0; /* Skip loop. */
- - ++input_line_pointer; /* Compensate for end of loop. */
- + c = 0; /* Skip loop. */
- + ++input_line_pointer; /* Compensate for end of loop. */
- }
- else
- {
- - c = ','; /* Do loop. */
- + c = ','; /* Do loop. */
- }
- while (c == ',' || c == '<' || c == '"')
- {
- SKIP_WHITESPACE ();
- switch (*input_line_pointer)
- - {
- - case '\"':
- - ++input_line_pointer; /*->1st char of string. */
- - start = input_line_pointer;
- - while (is_a_char (c = next_char_of_string ()))
- - {
- - FRAG_APPEND_1_CHAR (c);
- - }
- - if (append_zero)
- - {
- - FRAG_APPEND_1_CHAR (0);
- - }
- - know (input_line_pointer[-1] == '\"');
- + {
- + case '\"':
- + ++input_line_pointer; /*->1st char of string. */
- + start = input_line_pointer;
- + while (is_a_char (c = next_char_of_string ()))
- + {
- + FRAG_APPEND_1_CHAR (c);
- + }
- + if (append_zero)
- + {
- + FRAG_APPEND_1_CHAR (0);
- + }
- + know (input_line_pointer[-1] == '\"');
-
- #ifndef NO_LISTING
- #ifdef OBJ_ELF
- - /* In ELF, when gcc is emitting DWARF 1 debugging output, it
- + /* In ELF, when gcc is emitting DWARF 1 debugging output, it
- will emit .string with a filename in the .debug section
- after a sequence of constants. See the comment in
- emit_expr for the sequence. emit_expr will set
- dwarf_file_string to non-zero if this string might be a
- source file name. */
- - if (strcmp (segment_name (now_seg), ".debug") != 0)
- - dwarf_file_string = 0;
- - else if (dwarf_file_string)
- - {
- - c = input_line_pointer[-1];
- - input_line_pointer[-1] = '\0';
- - listing_source_file (start);
- - input_line_pointer[-1] = c;
- - }
- + if (strcmp (segment_name (now_seg), ".debug") != 0)
- + dwarf_file_string = 0;
- + else if (dwarf_file_string)
- + {
- + c = input_line_pointer[-1];
- + input_line_pointer[-1] = '\0';
- + listing_source_file (start);
- + input_line_pointer[-1] = c;
- + }
- #endif
- #endif
-
- - break;
- - case '<':
- - input_line_pointer++;
- - c = get_single_number ();
- - FRAG_APPEND_1_CHAR (c);
- - if (*input_line_pointer != '>')
- - {
- - as_bad (_("Expected <nn>"));
- - }
- - input_line_pointer++;
- - break;
- - case ',':
- - input_line_pointer++;
- - break;
- - }
- + break;
- + case '<':
- + input_line_pointer++;
- + c = get_single_number ();
- + FRAG_APPEND_1_CHAR (c);
- + if (*input_line_pointer != '>')
- + {
- + as_bad (_("Expected <nn>"));
- + }
- + input_line_pointer++;
- + break;
- + case ',':
- + input_line_pointer++;
- + break;
- + }
- SKIP_WHITESPACE ();
- c = *input_line_pointer;
- }
-
- demand_empty_rest_of_line ();
- -} /* stringer() */
- +} /* stringer() */
-
- /* FIXME-SOMEDAY: I had trouble here on characters with the
- high bits set. We'll probably also have trouble with
- @@ -4576,104 +4852,104 @@ next_char_of_string ()
- #ifndef NO_STRING_ESCAPES
- case '\\':
- switch (c = *input_line_pointer++)
- - {
- - case 'b':
- - c = '\b';
- - break;
- -
- - case 'f':
- - c = '\f';
- - break;
- -
- - case 'n':
- - c = '\n';
- - break;
- -
- - case 'r':
- - c = '\r';
- - break;
- -
- - case 't':
- - c = '\t';
- - break;
- -
- - case 'v':
- - c = '\013';
- - break;
- -
- - case '\\':
- - case '"':
- - break; /* As itself. */
- -
- - case '0':
- - case '1':
- - case '2':
- - case '3':
- - case '4':
- - case '5':
- - case '6':
- - case '7':
- - case '8':
- - case '9':
- - {
- - long number;
- - int i;
- -
- - for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
- - {
- - number = number * 8 + c - '0';
- - }
- - c = number & 0xff;
- - }
- - --input_line_pointer;
- - break;
- -
- - case 'x':
- - case 'X':
- - {
- - long number;
- -
- - number = 0;
- - c = *input_line_pointer++;
- - while (isxdigit (c))
- - {
- - if (isdigit (c))
- - number = number * 16 + c - '0';
- - else if (isupper (c))
- - number = number * 16 + c - 'A' + 10;
- - else
- - number = number * 16 + c - 'a' + 10;
- - c = *input_line_pointer++;
- - }
- - c = number & 0xff;
- - --input_line_pointer;
- - }
- - break;
- -
- - case '\n':
- - /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
- - as_warn (_("Unterminated string: Newline inserted."));
- - c = '\n';
- - bump_line_counters ();
- - break;
- -
- - default:
- + {
- + case 'b':
- + c = '\b';
- + break;
- +
- + case 'f':
- + c = '\f';
- + break;
- +
- + case 'n':
- + c = '\n';
- + break;
- +
- + case 'r':
- + c = '\r';
- + break;
- +
- + case 't':
- + c = '\t';
- + break;
- +
- + case 'v':
- + c = '\013';
- + break;
- +
- + case '\\':
- + case '"':
- + break; /* As itself. */
- +
- + case '0':
- + case '1':
- + case '2':
- + case '3':
- + case '4':
- + case '5':
- + case '6':
- + case '7':
- + case '8':
- + case '9':
- + {
- + long number;
- + int i;
- +
- + for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
- + {
- + number = number * 8 + c - '0';
- + }
- + c = number & 0xff;
- + }
- + --input_line_pointer;
- + break;
- +
- + case 'x':
- + case 'X':
- + {
- + long number;
- +
- + number = 0;
- + c = *input_line_pointer++;
- + while (isxdigit (c))
- + {
- + if (isdigit (c))
- + number = number * 16 + c - '0';
- + else if (isupper (c))
- + number = number * 16 + c - 'A' + 10;
- + else
- + number = number * 16 + c - 'a' + 10;
- + c = *input_line_pointer++;
- + }
- + c = number & 0xff;
- + --input_line_pointer;
- + }
- + break;
- +
- + case '\n':
- + /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
- + as_warn (_("Unterminated string: Newline inserted."));
- + c = '\n';
- + bump_line_counters ();
- + break;
- +
- + default:
-
- #ifdef ONLY_STANDARD_ESCAPES
- - as_bad (_("Bad escaped character in string, '?' assumed"));
- - c = '?';
- + as_bad (_("Bad escaped character in string, '?' assumed"));
- + c = '?';
- #endif /* ONLY_STANDARD_ESCAPES */
-
- - break;
- - } /* switch on escaped char */
- + break;
- + } /* switch on escaped char */
- break;
- #endif /* ! defined (NO_STRING_ESCAPES) */
-
- default:
- break;
- - } /* switch on char */
- + } /* switch on char */
- return (c);
- -} /* next_char_of_string() */
- +} /* next_char_of_string() */
-
- static segT
- get_segmented_expression (expP)
- @@ -4703,20 +4979,20 @@ get_known_segmented_expression (expP)
- if ((retval = get_segmented_expression (expP)) == undefined_section)
- {
- /* There is no easy way to extract the undefined symbol from the
- - expression. */
- + expression. */
- if (expP->X_add_symbol != NULL
- - && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
- - as_warn (_("symbol \"%s\" undefined; zero assumed"),
- - S_GET_NAME (expP->X_add_symbol));
- + && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
- + as_warn (_("symbol \"%s\" undefined; zero assumed"),
- + S_GET_NAME (expP->X_add_symbol));
- else
- - as_warn (_("some symbol undefined; zero assumed"));
- + as_warn (_("some symbol undefined; zero assumed"));
- retval = absolute_section;
- expP->X_op = O_constant;
- expP->X_add_number = 0;
- }
- know (retval == absolute_section || SEG_NORMAL (retval));
- return (retval);
- -} /* get_known_segmented_expression() */
- +} /* get_known_segmented_expression() */
-
- offsetT
- get_absolute_expression ()
- @@ -4727,15 +5003,15 @@ get_absolute_expression ()
- if (exp.X_op != O_constant)
- {
- if (exp.X_op != O_absent)
- - as_bad (_("bad or irreducible absolute expression; zero assumed"));
- + as_bad (_("bad or irreducible absolute expression; zero assumed"));
- exp.X_add_number = 0;
- }
- return exp.X_add_number;
- }
-
- -char /* return terminator */
- +char /* return terminator */
- get_absolute_expression_and_terminator (val_pointer)
- - long *val_pointer; /* return value of expression */
- + long *val_pointer; /* return value of expression */
- {
- /* FIXME: val_pointer should probably be offsetT *. */
- *val_pointer = (long) get_absolute_expression ();
- @@ -4743,7 +5019,7 @@ get_absolute_expression_and_terminator (val_pointer)
- }
-
- /*
- - * demand_copy_C_string()
- + * demand_copy_C_string()
- *
- * Like demand_copy_string, but return NULL if the string contains any '\0's.
- * Give a warning if that happens.
- @@ -4759,21 +5035,21 @@ demand_copy_C_string (len_pointer)
- register int len;
-
- for (len = *len_pointer; len > 0; len--)
- - {
- - if (*s == 0)
- - {
- - s = 0;
- - len = 1;
- - *len_pointer = 0;
- - as_bad (_("This string may not contain \'\\0\'"));
- - }
- - }
- + {
- + if (*s == 0)
- + {
- + s = 0;
- + len = 1;
- + *len_pointer = 0;
- + as_bad (_("This string may not contain \'\\0\'"));
- + }
- + }
- }
- return s;
- }
-
- /*
- - * demand_copy_string()
- + * demand_copy_string()
- *
- * Demand string, but return a safe (=private) copy of the string.
- * Return NULL if we can't read a string here.
- @@ -4790,15 +5066,15 @@ demand_copy_string (lenP)
- SKIP_WHITESPACE ();
- if (*input_line_pointer == '\"')
- {
- - input_line_pointer++; /* Skip opening quote. */
- + input_line_pointer++; /* Skip opening quote. */
-
- while (is_a_char (c = next_char_of_string ()))
- - {
- - obstack_1grow (¬es, c);
- - len++;
- - }
- + {
- + obstack_1grow (¬es, c);
- + len++;
- + }
- /* JF this next line is so demand_copy_C_string will return a
- - null terminated string. */
- + null terminated string. */
- obstack_1grow (¬es, '\0');
- retval = obstack_finish (¬es);
- }
- @@ -4810,30 +5086,30 @@ demand_copy_string (lenP)
- }
- *lenP = len;
- return (retval);
- -} /* demand_copy_string() */
- +} /* demand_copy_string() */
-
- /*
- - * is_it_end_of_statement()
- + * is_it_end_of_statement()
- *
- - * In: Input_line_pointer->next character.
- + * In: Input_line_pointer->next character.
- *
- - * Do: Skip input_line_pointer over all whitespace.
- + * Do: Skip input_line_pointer over all whitespace.
- *
- - * Out: 1 if input_line_pointer->end-of-line.
- + * Out: 1 if input_line_pointer->end-of-line.
- */
- int
- is_it_end_of_statement ()
- {
- SKIP_WHITESPACE ();
- return (is_end_of_line[(unsigned char) *input_line_pointer]);
- -} /* is_it_end_of_statement() */
- +} /* is_it_end_of_statement() */
-
- void
- equals (sym_name, reassign)
- char *sym_name;
- int reassign;
- {
- - register symbolS *symbolP; /* symbol we are working with */
- + register symbolS *symbolP; /* symbol we are working with */
- char *stop = NULL;
- char stopc;
-
- @@ -4855,16 +5131,16 @@ equals (sym_name, reassign)
-
- segment = get_known_segmented_expression (&exp);
- if (!need_pass_2)
- - do_org (segment, &exp, 0);
- + do_org (segment, &exp, 0);
- }
- else
- {
- symbolP = symbol_find_or_make (sym_name);
- /* Permit register names to be redefined. */
- if (! reassign
- - && S_IS_DEFINED (symbolP)
- - && S_GET_SEGMENT (symbolP) != reg_section)
- - as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
- + && S_IS_DEFINED (symbolP)
- + && S_GET_SEGMENT (symbolP) != reg_section)
- + as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
- pseudo_set (symbolP);
- }
-
- @@ -4873,7 +5149,7 @@ equals (sym_name, reassign)
- ignore_rest_of_line (); /* check garbage after the expression */
- mri_comment_end (stop, stopc);
- }
- -} /* equals() */
- +} /* equals() */
-
- /* .include -- include a file at this point. */
-
- @@ -4891,28 +5167,28 @@ s_include (arg)
- {
- filename = demand_copy_string (&i);
- if (filename == NULL)
- - {
- - /* demand_copy_string has already printed an error and
- + {
- + /* demand_copy_string has already printed an error and
- called ignore_rest_of_line. */
- - return;
- - }
- + return;
- + }
- }
- else
- {
- SKIP_WHITESPACE ();
- i = 0;
- while (! is_end_of_line[(unsigned char) *input_line_pointer]
- - && *input_line_pointer != ' '
- - && *input_line_pointer != '\t')
- - {
- - obstack_1grow (¬es, *input_line_pointer);
- - ++input_line_pointer;
- - ++i;
- - }
- + && *input_line_pointer != ' '
- + && *input_line_pointer != '\t')
- + {
- + obstack_1grow (¬es, *input_line_pointer);
- + ++input_line_pointer;
- + ++i;
- + }
- obstack_1grow (¬es, '\0');
- filename = obstack_finish (¬es);
- while (! is_end_of_line[(unsigned char) *input_line_pointer])
- - ++input_line_pointer;
- + ++input_line_pointer;
- }
- demand_empty_rest_of_line ();
- path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
- @@ -4922,10 +5198,10 @@ s_include (arg)
- strcat (path, "/");
- strcat (path, filename);
- if (0 != (try = fopen (path, "r")))
- - {
- - fclose (try);
- - goto gotit;
- - }
- + {
- + fclose (try);
- + goto gotit;
- + }
- }
- free (path);
- path = filename;
- @@ -4933,7 +5209,7 @@ gotit:
- /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
- register_dependency (path);
- input_scrub_insert_file (path);
- -} /* s_include() */
- +} /* s_include() */
-
- void
- add_include_dir (path)
- @@ -4944,29 +5220,29 @@ add_include_dir (path)
- if (include_dir_count == 0)
- {
- include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
- - include_dirs[0] = "."; /* Current dir */
- + include_dirs[0] = "."; /* Current dir */
- include_dir_count = 2;
- }
- else
- {
- include_dir_count++;
- include_dirs = (char **) realloc (include_dirs,
- - include_dir_count * sizeof (*include_dirs));
- + include_dir_count * sizeof (*include_dirs));
- }
-
- - include_dirs[include_dir_count - 1] = path; /* New one */
- + include_dirs[include_dir_count - 1] = path; /* New one */
-
- i = strlen (path);
- if (i > include_dir_maxlen)
- include_dir_maxlen = i;
- -} /* add_include_dir() */
- +} /* add_include_dir() */
-
- /* Output debugging information to denote the source file. */
-
- static void
- generate_file_debug ()
- {
- - if (debug_type == DEBUG_STABS)
- + if (debug_type == DEBUG_STABS)
- stabs_generate_asm_file ();
- }
-
- @@ -4983,7 +5259,7 @@ generate_lineno_debug ()
- if (ECOFF_DEBUGGING && ecoff_no_current_file ())
- debug_type = DEBUG_ECOFF;
- else
- - debug_type = DEBUG_NONE;
- + debug_type = DEBUG_NONE;
- }
- #endif
-
- @@ -5032,14 +5308,14 @@ do_s_func (end_p, default_prefix)
- if (end_p)
- {
- if (current_name == NULL)
- - {
- - as_bad (_("missing .func"));
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_bad (_("missing .func"));
- + ignore_rest_of_line ();
- + return;
- + }
-
- if (debug_type == DEBUG_STABS)
- - stabs_generate_asm_endfunc (current_name, current_label);
- + stabs_generate_asm_endfunc (current_name, current_label);
-
- current_name = current_label = NULL;
- }
- @@ -5049,11 +5325,11 @@ do_s_func (end_p, default_prefix)
- char delim1,delim2;
-
- if (current_name != NULL)
- - {
- - as_bad (_(".endfunc missing for previous .func"));
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_bad (_(".endfunc missing for previous .func"));
- + ignore_rest_of_line ();
- + return;
- + }
-
- name = input_line_pointer;
- delim1 = get_symbol_end ();
- @@ -5061,35 +5337,35 @@ do_s_func (end_p, default_prefix)
- *input_line_pointer = delim1;
- SKIP_WHITESPACE ();
- if (*input_line_pointer != ',')
- - {
- - if (default_prefix)
- - asprintf (&label, "%s%s", default_prefix, name);
- - else
- - {
- - char leading_char = 0;
- + {
- + if (default_prefix)
- + asprintf (&label, "%s%s", default_prefix, name);
- + else
- + {
- + char leading_char = 0;
- #ifdef BFD_ASSEMBLER
- - leading_char = bfd_get_symbol_leading_char (stdoutput);
- + leading_char = bfd_get_symbol_leading_char (stdoutput);
- #endif
- - /* Missing entry point, use function's name with the leading
- - char prepended. */
- - if (leading_char)
- - asprintf (&label, "%c%s", leading_char, name);
- - else
- - label = name;
- - }
- - }
- + /* Missing entry point, use function's name with the leading
- + char prepended. */
- + if (leading_char)
- + asprintf (&label, "%c%s", leading_char, name);
- + else
- + label = name;
- + }
- + }
- else
- - {
- - ++input_line_pointer;
- - SKIP_WHITESPACE ();
- - label = input_line_pointer;
- - delim2 = get_symbol_end ();
- - label = xstrdup (label);
- - *input_line_pointer = delim2;
- - }
- + {
- + ++input_line_pointer;
- + SKIP_WHITESPACE ();
- + label = input_line_pointer;
- + delim2 = get_symbol_end ();
- + label = xstrdup (label);
- + *input_line_pointer = delim2;
- + }
-
- if (debug_type == DEBUG_STABS)
- - stabs_generate_asm_func (name, label);
- + stabs_generate_asm_func (name, label);
-
- current_name = name;
- current_label = label;
- diff --git a/gas/stabs.c b/gas/stabs.c
- index 7c13c2f..bbd8bfc 100644
- --- a/gas/stabs.c
- +++ b/gas/stabs.c
- @@ -107,12 +107,12 @@ get_stab_string_offset (string, stabstr_secname)
- #ifdef BFD_ASSEMBLER
- bfd_set_section_flags (stdoutput, seg, SEC_READONLY | SEC_DEBUGGING);
- if (seg->name == stabstr_secname)
- - seg->name = xstrdup (stabstr_secname);
- + seg->name = xstrdup (stabstr_secname);
- #endif
- }
-
- if (length > 0)
- - { /* Ordinary case. */
- + { /* Ordinary case. */
- p = frag_more (length + 1);
- strcpy (p, string);
-
- @@ -128,7 +128,7 @@ get_stab_string_offset (string, stabstr_secname)
-
- #ifdef AOUT_STABS
- #ifndef OBJ_PROCESS_STAB
- -#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D)
- +#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D)
- #endif
-
- static void aout_process_stab PARAMS ((int, const char *, int, int, int));
- @@ -148,7 +148,7 @@ aout_process_stab (what, string, type, other, desc)
- ends in "\" and the debug info is continued in the next .stabs
- directive) from being separated by other random symbols. */
- symbol = symbol_create (string, undefined_section, 0,
- - (struct frag *) NULL);
- + (struct frag *) NULL);
- if (what == 's' || what == 'n')
- {
- /* Pick up the value from the input line. */
- @@ -203,13 +203,13 @@ s_stab_generic (what, stab_secname, stabstr_secname)
- string = demand_copy_C_string (&length);
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- - input_line_pointer++;
- + input_line_pointer++;
- else
- - {
- - as_warn (_(".stabs: Missing comma"));
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_warn (_(".stabs: Missing comma"));
- + ignore_rest_of_line ();
- + return;
- + }
- }
-
- if (get_absolute_expression_and_terminator (&longint) != ',')
- @@ -232,11 +232,11 @@ s_stab_generic (what, stab_secname, stabstr_secname)
- if (what == 's' || what == 'n')
- {
- if (*input_line_pointer != ',')
- - {
- - as_warn (_(".stab%c: Missing comma"), what);
- - ignore_rest_of_line ();
- - return;
- - }
- + {
- + as_warn (_(".stab%c: Missing comma"), what);
- + ignore_rest_of_line ();
- + return;
- + }
- input_line_pointer++;
- SKIP_WHITESPACE ();
- }
- @@ -251,12 +251,12 @@ s_stab_generic (what, stab_secname, stabstr_secname)
-
- SKIP_WHITESPACE ();
- if (*input_line_pointer == ',')
- - {
- - input_line_pointer++;
- - what = 'n';
- - }
- + {
- + input_line_pointer++;
- + what = 'n';
- + }
- else
- - input_line_pointer = save_location;
- + input_line_pointer = save_location;
- }
- #endif /* OBJ_ELF */
- #endif /* TC_PPC */
- @@ -265,15 +265,15 @@ s_stab_generic (what, stab_secname, stabstr_secname)
- if (listing)
- {
- switch (type)
- - {
- - case N_SLINE:
- - listing_source_line ((unsigned int) desc);
- - break;
- - case N_SO:
- - case N_SOL:
- - listing_source_file (string);
- - break;
- - }
- + {
- + case N_SLINE:
- + listing_source_line ((unsigned int) desc);
- + break;
- + case N_SO:
- + case N_SOL:
- + listing_source_file (string);
- + break;
- + }
- }
- #endif /* ! NO_LISTING */
-
- @@ -303,40 +303,40 @@ s_stab_generic (what, stab_secname, stabstr_secname)
- #endif
-
- if (cached_secname && !strcmp (cached_secname, stab_secname))
- - {
- - seg = cached_sec;
- - subseg_set (seg, 0);
- - }
- + {
- + seg = cached_sec;
- + subseg_set (seg, 0);
- + }
- else
- - {
- - seg = subseg_new (stab_secname, 0);
- - if (cached_secname)
- - free (cached_secname);
- - cached_secname = xstrdup (stab_secname);
- - cached_sec = seg;
- - }
- + {
- + seg = subseg_new (stab_secname, 0);
- + if (cached_secname)
- + free (cached_secname);
- + cached_secname = xstrdup (stab_secname);
- + cached_sec = seg;
- + }
-
- if (! seg_info (seg)->hadone)
- - {
- + {
- #ifdef BFD_ASSEMBLER
- - bfd_set_section_flags (stdoutput, seg,
- - SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
- + bfd_set_section_flags (stdoutput, seg,
- + SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
- #endif
- #ifdef INIT_STAB_SECTION
- - INIT_STAB_SECTION (seg);
- + INIT_STAB_SECTION (seg);
- #endif
- - seg_info (seg)->hadone = 1;
- - }
- + seg_info (seg)->hadone = 1;
- + }
-
- stroff = get_stab_string_offset (string, stabstr_secname);
- if (what == 's')
- - {
- - /* release the string */
- - obstack_free (¬es, string);
- - }
- + {
- + /* release the string */
- + obstack_free (¬es, string);
- + }
-
- /* At least for now, stabs in a special stab section are always
- - output as 12 byte blocks of information. */
- + output as 12 byte blocks of information. */
- p = frag_more (8);
- md_number_to_chars (p, (valueT) stroff, 4);
- md_number_to_chars (p + 4, (valueT) type, 1);
- @@ -344,27 +344,27 @@ s_stab_generic (what, stab_secname, stabstr_secname)
- md_number_to_chars (p + 6, (valueT) desc, 2);
-
- if (what == 's' || what == 'n')
- - {
- - /* Pick up the value from the input line. */
- - cons (4);
- - input_line_pointer--;
- - }
- + {
- + /* Pick up the value from the input line. */
- + cons (4);
- + input_line_pointer--;
- + }
- else
- - {
- - const char *fake;
- - symbolS *symbol;
- - expressionS exp;
- + {
- + const char *fake;
- + symbolS *symbol;
- + expressionS exp;
-
- - /* Arrange for a value representing the current location. */
- - fake = FAKE_LABEL_NAME;
- - symbol = symbol_new (fake, saved_seg, dot, saved_frag);
- + /* Arrange for a value representing the current location. */
- + fake = FAKE_LABEL_NAME;
- + symbol = symbol_new (fake, saved_seg, dot, saved_frag);
-
- - exp.X_op = O_symbol;
- - exp.X_add_symbol = symbol;
- - exp.X_add_number = 0;
- + exp.X_op = O_symbol;
- + exp.X_add_symbol = symbol;
- + exp.X_add_number = 0;
-
- - emit_expr (&exp, 4);
- - }
- + emit_expr (&exp, 4);
- + }
-
- #ifdef OBJ_PROCESS_STAB
- OBJ_PROCESS_STAB (seg, what, string, type, other, desc);
- @@ -425,10 +425,10 @@ s_xstab (what)
- strcpy (stabstr_secname, stab_secname);
- strcat (stabstr_secname, "str");
- if (saved_secname)
- - {
- - free (saved_secname);
- - free (saved_strsecname);
- - }
- + {
- + free (saved_secname);
- + free (saved_strsecname);
- + }
- saved_secname = stab_secname;
- saved_strsecname = stabstr_secname;
- }
- @@ -471,12 +471,17 @@ s_desc (ignore)
- S_SET_DESC (symbolP, temp);
- }
- demand_empty_rest_of_line ();
- -} /* s_desc() */
- +} /* s_desc() */
-
- #endif /* defined (S_SET_DESC) */
-
- /* Generate stabs debugging information to denote the main source file. */
-
- +/* add T.Tazaki 2002.02.26 >>> */
- +extern char *c33_stabs_input_file;
- +extern enum debug_info_type debug_type;
- +/* add T.Tazaki 2002.02.26 <<< */
- +
- void
- stabs_generate_asm_file ()
- {
- @@ -484,6 +489,10 @@ stabs_generate_asm_file ()
- unsigned int lineno;
-
- as_where (&file, &lineno);
- +
- + if( *c33_stabs_input_file != NULL ) /* add T.Tazaki 2002.02.26 */
- + file = c33_stabs_input_file; /* add T.Tazaki 2002.02.26 */
- +
- generate_asm_file (N_SO, file);
- }
-
- @@ -498,8 +507,11 @@ generate_asm_file (type, file)
- static char *last_file;
- static int label_count;
- char *hold;
- - char *buf = xmalloc (2 * strlen (file) + 10);
- - char sym[30];
- +// char *buf = xmalloc (2 * strlen (file) + 10);/* buf fix 2003/06/17 */
- +// char *buf = xmalloc (2 * strlen (file) + 12); /* buf fix 2003/06/17 */
- + char *buf = xmalloc (2 * strlen (file) + 30); /* buf fix 2004/01/05 */
- +// char sym[30];/* buf fix 2004/01/05 */
- + char sym[60];/* buf fix 2004/01/05 */
-
- /* Rather than try to do this in some efficient fashion, we just
- generate a string and then parse it again. That lets us use the
- @@ -538,7 +550,7 @@ generate_asm_file (type, file)
- colon (sym);
-
- if (last_file != NULL)
- - free (last_file);
- + free (last_file);
- last_file = xstrdup (file);
- }
-
- @@ -568,6 +580,9 @@ stabs_generate_asm_lineno ()
-
- as_where (&file, &lineno);
-
- + if( *c33_stabs_input_file != NULL ) /* add T.Tazaki 2002.02.26 */
- + file = c33_stabs_input_file; /* add T.Tazaki 2002.02.26 */
- +
- generate_asm_file (N_SOL, file);
-
- sprintf (sym, "%sL%d", FAKE_LABEL_NAME, label_count);
- @@ -577,7 +592,7 @@ stabs_generate_asm_lineno ()
- {
- buf = (char *) alloca (100 + strlen (current_function_label));
- sprintf (buf, "%d,0,%d,%s-%s\n", N_SLINE, lineno,
- - sym, current_function_label);
- + sym, current_function_label);
- }
- else
- {
- @@ -614,7 +629,7 @@ stabs_generate_asm_func (funcname, startlabname)
-
- as_where (&file, &lineno);
- asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
- - funcname, N_FUN, lineno + 1, startlabname);
- + funcname, N_FUN, lineno + 1, startlabname);
- input_line_pointer = buf;
- s_stab ('s');
- free (buf);
- diff --git a/gas/write.c b/gas/write.c
- index e386ece..8386c4f 100644
- --- a/gas/write.c
- +++ b/gas/write.c
- @@ -48,7 +48,7 @@
- #define TC_FORCE_RELOCATION_SECTION(FIXP,SEG) TC_FORCE_RELOCATION(FIXP)
- #endif
-
- -#ifndef MD_PCREL_FROM_SECTION
- +#ifndef MD_PCREL_FROM_SECTION
- #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from(FIXP)
- #endif
-
- @@ -77,9 +77,9 @@ struct frag *text_frag_root;
- struct frag *data_frag_root;
- struct frag *bss_frag_root;
-
- -struct frag *text_last_frag; /* Last frag in segment. */
- -struct frag *data_last_frag; /* Last frag in segment. */
- -static struct frag *bss_last_frag; /* Last frag in segment. */
- +struct frag *text_last_frag; /* Last frag in segment. */
- +struct frag *data_last_frag; /* Last frag in segment. */
- +static struct frag *bss_last_frag; /* Last frag in segment. */
- #endif
-
- #ifndef BFD
- @@ -87,7 +87,7 @@ static object_headers headers;
- #endif
-
- long string_byte_count;
- -char *next_object_file_charP; /* Tracks object file bytes. */
- +char *next_object_file_charP; /* Tracks object file bytes. */
-
- #ifndef OBJ_VMS
- int magic_number_for_object_file = DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE;
- @@ -99,14 +99,14 @@ static int n_fixups;
-
- #ifdef BFD_ASSEMBLER
- static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
- - symbolS *add, symbolS *sub,
- - offsetT offset, int pcrel,
- - bfd_reloc_code_real_type r_type));
- + symbolS *add, symbolS *sub,
- + offsetT offset, int pcrel,
- + bfd_reloc_code_real_type r_type));
- #else
- static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
- - symbolS *add, symbolS *sub,
- - offsetT offset, int pcrel,
- - int r_type));
- + symbolS *add, symbolS *sub,
- + offsetT offset, int pcrel,
- + int r_type));
- #endif
- #if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
- static long fixup_segment PARAMS ((fixS * fixP, segT this_segment_type));
- @@ -134,24 +134,24 @@ static void relax_and_size_all_segments PARAMS ((void));
- #endif
-
- /*
- - * fix_new()
- + * fix_new()
- *
- * Create a fixS in obstack 'notes'.
- */
- static fixS *
- fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
- - r_type)
- - fragS *frag; /* Which frag? */
- - int where; /* Where in that frag? */
- - int size; /* 1, 2, or 4 usually. */
- - symbolS *add_symbol; /* X_add_symbol. */
- - symbolS *sub_symbol; /* X_op_symbol. */
- - offsetT offset; /* X_add_number. */
- - int pcrel; /* TRUE if PC-relative relocation. */
- + r_type)
- + fragS *frag; /* Which frag? */
- + int where; /* Where in that frag? */
- + int size; /* 1, 2, or 4 usually. */
- + symbolS *add_symbol; /* X_add_symbol. */
- + symbolS *sub_symbol; /* X_op_symbol. */
- + offsetT offset; /* X_add_number. */
- + int pcrel; /* TRUE if PC-relative relocation. */
- #ifdef BFD_ASSEMBLER
- bfd_reloc_code_real_type r_type; /* Relocation type */
- #else
- - int r_type; /* Relocation type */
- + int r_type; /* Relocation type */
- #endif
- {
- fixS *fixP;
- @@ -206,11 +206,11 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
-
- #ifdef BFD_ASSEMBLER
- fixS **seg_fix_rootP = (frags_chained
- - ? &seg_info (now_seg)->fix_root
- - : &frchain_now->fix_root);
- + ? &seg_info (now_seg)->fix_root
- + : &frchain_now->fix_root);
- fixS **seg_fix_tailP = (frags_chained
- - ? &seg_info (now_seg)->fix_tail
- - : &frchain_now->fix_tail);
- + ? &seg_info (now_seg)->fix_tail
- + : &frchain_now->fix_tail);
- #endif
-
- #ifdef REVERSE_SORT_RELOCS
- @@ -239,20 +239,20 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
-
- fixS *
- fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
- - fragS *frag; /* Which frag? */
- - int where; /* Where in that frag? */
- - int size; /* 1, 2, or 4 usually. */
- - symbolS *add_symbol; /* X_add_symbol. */
- - offsetT offset; /* X_add_number. */
- - int pcrel; /* TRUE if PC-relative relocation. */
- + fragS *frag; /* Which frag? */
- + int where; /* Where in that frag? */
- + int size; /* 1, 2, or 4 usually. */
- + symbolS *add_symbol; /* X_add_symbol. */
- + offsetT offset; /* X_add_number. */
- + int pcrel; /* TRUE if PC-relative relocation. */
- #ifdef BFD_ASSEMBLER
- bfd_reloc_code_real_type r_type; /* Relocation type */
- #else
- - int r_type; /* Relocation type */
- + int r_type; /* Relocation type */
- #endif
- {
- return fix_new_internal (frag, where, size, add_symbol,
- - (symbolS *) NULL, offset, pcrel, r_type);
- + (symbolS *) NULL, offset, pcrel, r_type);
- }
-
- /* Create a fixup for an expression. Currently we only support fixups
- @@ -261,15 +261,15 @@ fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
-
- fixS *
- fix_new_exp (frag, where, size, exp, pcrel, r_type)
- - fragS *frag; /* Which frag? */
- - int where; /* Where in that frag? */
- - int size; /* 1, 2, or 4 usually. */
- - expressionS *exp; /* Expression. */
- - int pcrel; /* TRUE if PC-relative relocation. */
- + fragS *frag; /* Which frag? */
- + int where; /* Where in that frag? */
- + int size; /* 1, 2, or 4 usually. */
- + expressionS *exp; /* Expression. */
- + int pcrel; /* TRUE if PC-relative relocation. */
- #ifdef BFD_ASSEMBLER
- bfd_reloc_code_real_type r_type; /* Relocation type */
- #else
- - int r_type; /* Relocation type */
- + int r_type; /* Relocation type */
- #endif
- {
- symbolS *add = NULL;
- @@ -283,14 +283,14 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
-
- case O_add:
- /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if
- - the difference expression cannot immediately be reduced. */
- + the difference expression cannot immediately be reduced. */
- {
- - symbolS *stmp = make_expr_symbol (exp);
- - exp->X_op = O_symbol;
- - exp->X_op_symbol = 0;
- - exp->X_add_symbol = stmp;
- - exp->X_add_number = 0;
- - return fix_new_exp (frag, where, size, exp, pcrel, r_type);
- + symbolS *stmp = make_expr_symbol (exp);
- + exp->X_op = O_symbol;
- + exp->X_op_symbol = 0;
- + exp->X_add_symbol = stmp;
- + exp->X_add_number = 0;
- + return fix_new_exp (frag, where, size, exp, pcrel, r_type);
- }
-
- case O_symbol_rva:
- @@ -329,7 +329,7 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
- }
-
- return fix_new_internal (frag, where, size, add, sub, off,
- - pcrel, r_type);
- + pcrel, r_type);
- }
-
- /* Append a string onto another string, bumping the pointer along. */
- @@ -362,7 +362,7 @@ record_alignment (seg, align)
- /* Segment to which alignment pertains */
- segT seg;
- /* Alignment, as a power of 2 (e.g., 1 => 2-byte boundary, 2 => 4-byte
- - boundary, etc.) */
- + boundary, etc.) */
- int align;
- {
- if (seg == absolute_section)
- @@ -413,13 +413,13 @@ chain_frchains_together_1 (section, frchp)
- assert (prev_frag->fr_type != 0);
- #ifdef BFD_ASSEMBLER
- if (frchp->fix_root != (fixS *) NULL)
- - {
- - if (seg_info (section)->fix_root == (fixS *) NULL)
- - seg_info (section)->fix_root = frchp->fix_root;
- - prev_fix->fx_next = frchp->fix_root;
- - seg_info (section)->fix_tail = frchp->fix_tail;
- - prev_fix = frchp->fix_tail;
- - }
- + {
- + if (seg_info (section)->fix_root == (fixS *) NULL)
- + seg_info (section)->fix_root = frchp->fix_root;
- + prev_fix->fx_next = frchp->fix_root;
- + seg_info (section)->fix_tail = frchp->fix_tail;
- + prev_fix = frchp->fix_tail;
- + }
- #endif
- }
- assert (prev_frag->fr_type != 0);
- @@ -494,14 +494,14 @@ cvt_frag_to_fill (headersP, sec, fragP)
- #endif
- know (fragP->fr_next != NULL);
- fragP->fr_offset = (fragP->fr_next->fr_address
- - - fragP->fr_address
- - - fragP->fr_fix) / fragP->fr_var;
- + - fragP->fr_address
- + - fragP->fr_fix) / fragP->fr_var;
- if (fragP->fr_offset < 0)
- - {
- - as_bad_where (fragP->fr_file, fragP->fr_line,
- - _("attempt to .org/.space backwards? (%ld)"),
- - (long) fragP->fr_offset);
- - }
- + {
- + as_bad_where (fragP->fr_file, fragP->fr_line,
- + _("attempt to .org/.space backwards? (%ld)"),
- + (long) fragP->fr_offset);
- + }
- fragP->fr_type = rs_fill;
- break;
-
- @@ -510,17 +510,17 @@ cvt_frag_to_fill (headersP, sec, fragP)
-
- case rs_leb128:
- {
- - valueT value = S_GET_VALUE (fragP->fr_symbol);
- - int size;
- + valueT value = S_GET_VALUE (fragP->fr_symbol);
- + int size;
-
- - size = output_leb128 (fragP->fr_literal + fragP->fr_fix, value,
- - fragP->fr_subtype);
- + size = output_leb128 (fragP->fr_literal + fragP->fr_fix, value,
- + fragP->fr_subtype);
-
- - fragP->fr_fix += size;
- - fragP->fr_type = rs_fill;
- - fragP->fr_var = 0;
- - fragP->fr_offset = 0;
- - fragP->fr_symbol = NULL;
- + fragP->fr_fix += size;
- + fragP->fr_type = rs_fill;
- + fragP->fr_var = 0;
- + fragP->fr_offset = 0;
- + fragP->fr_symbol = NULL;
- }
- break;
-
- @@ -536,8 +536,8 @@ cvt_frag_to_fill (headersP, sec, fragP)
- #endif
-
- assert (fragP->fr_next == NULL
- - || ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
- - == fragP->fr_fix));
- + || ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
- + == fragP->fr_fix));
-
- /*
- * After md_convert_frag, we make the frag into a ".space 0".
- @@ -550,18 +550,18 @@ cvt_frag_to_fill (headersP, sec, fragP)
- #ifndef WORKING_DOT_WORD
- case rs_broken_word:
- {
- - struct broken_word *lie;
- -
- - if (fragP->fr_subtype)
- - {
- - fragP->fr_fix += md_short_jump_size;
- - for (lie = (struct broken_word *) (fragP->fr_symbol);
- - lie && lie->dispfrag == fragP;
- - lie = lie->next_broken_word)
- - if (lie->added == 1)
- - fragP->fr_fix += md_long_jump_size;
- - }
- - frag_wane (fragP);
- + struct broken_word *lie;
- +
- + if (fragP->fr_subtype)
- + {
- + fragP->fr_fix += md_short_jump_size;
- + for (lie = (struct broken_word *) (fragP->fr_symbol);
- + lie && lie->dispfrag == fragP;
- + lie = lie->next_broken_word)
- + if (lie->added == 1)
- + fragP->fr_fix += md_long_jump_size;
- + }
- + frag_wane (fragP);
- }
- break;
- #endif
- @@ -596,11 +596,11 @@ relax_and_size_seg (abfd, sec, xxx)
- {
- relax_segment (seginfo->frchainP->frch_root, sec);
- for (fragp = seginfo->frchainP->frch_root; fragp; fragp = fragp->fr_next)
- - cvt_frag_to_fill (sec, fragp);
- + cvt_frag_to_fill (sec, fragp);
- for (fragp = seginfo->frchainP->frch_root;
- - fragp->fr_next;
- - fragp = fragp->fr_next)
- - /* walk to last elt */;
- + fragp->fr_next;
- + fragp = fragp->fr_next)
- + /* walk to last elt */;
- size = fragp->fr_address + fragp->fr_fix;
- }
- else
- @@ -629,7 +629,7 @@ relax_and_size_seg (abfd, sec, xxx)
- fragS *last = seginfo->frchainP->frch_last;
- fragp = seginfo->frchainP->frch_root;
- while (fragp->fr_next != last)
- - fragp = fragp->fr_next;
- + fragp = fragp->fr_next;
- last->fr_address = size;
- fragp->fr_offset += newsize - size;
- }
- @@ -662,19 +662,19 @@ dump_section_relocs (abfd, sec, stream_)
- symbolS *s = fixp->fx_addsy;
-
- fprintf (stream, " %08lx: type %d ", (unsigned long) fixp,
- - (int) fixp->fx_r_type);
- + (int) fixp->fx_r_type);
- if (s == NULL)
- - fprintf (stream, "no sym\n");
- + fprintf (stream, "no sym\n");
- else
- - {
- - print_symbol_value_1 (stream, s);
- - fprintf (stream, "\n");
- - }
- + {
- + print_symbol_value_1 (stream, s);
- + fprintf (stream, "\n");
- + }
- fixp = fixp->fx_next;
- }
- }
- #else
- -#define dump_section_relocs(ABFD,SEC,STREAM) ((void) 0)
- +#define dump_section_relocs(ABFD,SEC,STREAM) ((void) 0)
- #endif
-
- #ifndef EMIT_SECTION_SYMBOLS
- @@ -700,184 +700,184 @@ adjust_reloc_syms (abfd, sec, xxx)
- /* ignore it */;
- else if (fixp->fx_addsy)
- {
- - symbolS *sym;
- - asection *symsec;
- + symbolS *sym;
- + asection *symsec;
-
- #ifdef DEBUG5
- - fprintf (stderr, "\n\nadjusting fixup:\n");
- - print_fixup (fixp);
- + fprintf (stderr, "\n\nadjusting fixup:\n");
- + print_fixup (fixp);
- #endif
-
- - sym = fixp->fx_addsy;
- + sym = fixp->fx_addsy;
-
- - /* All symbols should have already been resolved at this
- - point. It is possible to see unresolved expression
- - symbols, though, since they are not in the regular symbol
- - table. */
- - if (sym != NULL)
- - resolve_symbol_value (sym, 1);
- -
- - if (fixp->fx_subsy != NULL)
- - resolve_symbol_value (fixp->fx_subsy, 1);
- + /* All symbols should have already been resolved at this
- + point. It is possible to see unresolved expression
- + symbols, though, since they are not in the regular symbol
- + table. */
- + if (sym != NULL)
- + resolve_symbol_value (sym, 1);
- +
- + if (fixp->fx_subsy != NULL)
- + resolve_symbol_value (fixp->fx_subsy, 1);
-
- - /* If this symbol is equated to an undefined symbol, convert
- + /* If this symbol is equated to an undefined symbol, convert
- the fixup to being against that symbol. */
- - if (sym != NULL && symbol_equated_p (sym)
- - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- - {
- - fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
- - sym = symbol_get_value_expression (sym)->X_add_symbol;
- - fixp->fx_addsy = sym;
- - }
- -
- - if (sym != NULL && symbol_mri_common_p (sym))
- - {
- - /* These symbols are handled specially in fixup_segment. */
- - goto done;
- - }
- -
- - symsec = S_GET_SEGMENT (sym);
- -
- - if (symsec == NULL)
- - abort ();
- -
- - if (bfd_is_abs_section (symsec))
- - {
- - /* The fixup_segment routine will not use this symbol in a
- + if (sym != NULL && symbol_equated_p (sym)
- + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- + {
- + fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
- + sym = symbol_get_value_expression (sym)->X_add_symbol;
- + fixp->fx_addsy = sym;
- + }
- +
- + if (sym != NULL && symbol_mri_common_p (sym))
- + {
- + /* These symbols are handled specially in fixup_segment. */
- + goto done;
- + }
- +
- + symsec = S_GET_SEGMENT (sym);
- +
- + if (symsec == NULL)
- + abort ();
- +
- + if (bfd_is_abs_section (symsec))
- + {
- + /* The fixup_segment routine will not use this symbol in a
- relocation unless TC_FORCE_RELOCATION returns 1. */
- - if (TC_FORCE_RELOCATION (fixp))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- + if (TC_FORCE_RELOCATION (fixp))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- #ifdef UNDEFINED_DIFFERENCE_OK
- - if (fixp->fx_subsy != NULL)
- - symbol_mark_used_in_reloc (fixp->fx_subsy);
- -#endif
- - }
- - goto done;
- - }
- -
- - /* If it's one of these sections, assume the symbol is
- - definitely going to be output. The code in
- - md_estimate_size_before_relax in tc-mips.c uses this test
- - as well, so if you change this code you should look at that
- - code. */
- - if (bfd_is_und_section (symsec)
- - || bfd_is_com_section (symsec))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- + if (fixp->fx_subsy != NULL)
- + symbol_mark_used_in_reloc (fixp->fx_subsy);
- +#endif
- + }
- + goto done;
- + }
- +
- + /* If it's one of these sections, assume the symbol is
- + definitely going to be output. The code in
- + md_estimate_size_before_relax in tc-mips.c uses this test
- + as well, so if you change this code you should look at that
- + code. */
- + if (bfd_is_und_section (symsec)
- + || bfd_is_com_section (symsec))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- #ifdef UNDEFINED_DIFFERENCE_OK
- - /* We have the difference of an undefined symbol and some
- - other symbol. Make sure to mark the other symbol as used
- - in a relocation so that it will always be output. */
- - if (fixp->fx_subsy)
- - symbol_mark_used_in_reloc (fixp->fx_subsy);
- + /* We have the difference of an undefined symbol and some
- + other symbol. Make sure to mark the other symbol as used
- + in a relocation so that it will always be output. */
- + if (fixp->fx_subsy)
- + symbol_mark_used_in_reloc (fixp->fx_subsy);
- #endif
- - goto done;
- - }
- + goto done;
- + }
-
- - /* Don't try to reduce relocs which refer to non-local symbols
- + /* Don't try to reduce relocs which refer to non-local symbols
- in .linkonce sections. It can lead to confusion when a
- debugging section refers to a .linkonce section. I hope
- this will always be correct. */
- - if (symsec != sec && ! S_IS_LOCAL (sym))
- - {
- - boolean linkonce;
- + if (symsec != sec && ! S_IS_LOCAL (sym))
- + {
- + boolean linkonce;
-
- - linkonce = false;
- + linkonce = false;
- #ifdef BFD_ASSEMBLER
- - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE)
- - != 0)
- - linkonce = true;
- + if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE)
- + != 0)
- + linkonce = true;
- #endif
- #ifdef OBJ_ELF
- - /* The GNU toolchain uses an extension for ELF: a section
- + /* The GNU toolchain uses an extension for ELF: a section
- beginning with the magic string .gnu.linkonce is a
- linkonce section. */
- - if (strncmp (segment_name (symsec), ".gnu.linkonce",
- - sizeof ".gnu.linkonce" - 1) == 0)
- - linkonce = true;
- + if (strncmp (segment_name (symsec), ".gnu.linkonce",
- + sizeof ".gnu.linkonce" - 1) == 0)
- + linkonce = true;
- #endif
-
- - if (linkonce)
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- + if (linkonce)
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- #ifdef UNDEFINED_DIFFERENCE_OK
- - if (fixp->fx_subsy != NULL)
- - symbol_mark_used_in_reloc (fixp->fx_subsy);
- + if (fixp->fx_subsy != NULL)
- + symbol_mark_used_in_reloc (fixp->fx_subsy);
- #endif
- - goto done;
- - }
- - }
- + goto done;
- + }
- + }
-
- - /* Since we're reducing to section symbols, don't attempt to reduce
- - anything that's already using one. */
- - if (symbol_section_p (sym))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- - goto done;
- - }
- + /* Since we're reducing to section symbols, don't attempt to reduce
- + anything that's already using one. */
- + if (symbol_section_p (sym))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- + goto done;
- + }
-
- #ifdef BFD_ASSEMBLER
- - /* We can never adjust a reloc against a weak symbol. If we
- + /* We can never adjust a reloc against a weak symbol. If we
- did, and the weak symbol was overridden by a real symbol
- somewhere else, then our relocation would be pointing at
- the wrong area of memory. */
- - if (S_IS_WEAK (sym))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- - goto done;
- - }
- + if (S_IS_WEAK (sym))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- + goto done;
- + }
- #endif
-
- - /* Is there some other reason we can't adjust this one? (E.g.,
- - call/bal links in i960-bout symbols.) */
- + /* Is there some other reason we can't adjust this one? (E.g.,
- + call/bal links in i960-bout symbols.) */
- #ifdef obj_fix_adjustable
- - if (! obj_fix_adjustable (fixp))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- - goto done;
- - }
- + if (! obj_fix_adjustable (fixp))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- + goto done;
- + }
- #endif
-
- - /* Is there some other (target cpu dependent) reason we can't adjust
- - this one? (E.g. relocations involving function addresses on
- - the PA. */
- + /* Is there some other (target cpu dependent) reason we can't adjust
- + this one? (E.g. relocations involving function addresses on
- + the PA. */
- #ifdef tc_fix_adjustable
- - if (! tc_fix_adjustable (fixp))
- - {
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- - goto done;
- - }
- -#endif
- -
- - /* If the section symbol isn't going to be output, the relocs
- - at least should still work. If not, figure out what to do
- - when we run into that case.
- -
- - We refetch the segment when calling section_symbol, rather
- - than using symsec, because S_GET_VALUE may wind up changing
- - the section when it calls resolve_symbol_value. */
- - fixp->fx_offset += S_GET_VALUE (sym);
- - fixp->fx_addsy = section_symbol (S_GET_SEGMENT (sym));
- - symbol_mark_used_in_reloc (fixp->fx_addsy);
- + if (! tc_fix_adjustable (fixp))
- + {
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- + goto done;
- + }
- +#endif
- +
- + /* If the section symbol isn't going to be output, the relocs
- + at least should still work. If not, figure out what to do
- + when we run into that case.
- +
- + We refetch the segment when calling section_symbol, rather
- + than using symsec, because S_GET_VALUE may wind up changing
- + the section when it calls resolve_symbol_value. */
- + fixp->fx_offset += S_GET_VALUE (sym);
- + fixp->fx_addsy = section_symbol (S_GET_SEGMENT (sym));
- + symbol_mark_used_in_reloc (fixp->fx_addsy);
- #ifdef DEBUG5
- - fprintf (stderr, "\nadjusted fixup:\n");
- - print_fixup (fixp);
- + fprintf (stderr, "\nadjusted fixup:\n");
- + print_fixup (fixp);
- #endif
-
- done:
- - ;
- + ;
- }
- #if 1/*def RELOC_REQUIRES_SYMBOL*/
- else
- {
- - /* There was no symbol required by this relocation. However,
- - BFD doesn't really handle relocations without symbols well.
- - (At least, the COFF support doesn't.) So for now we fake up
- - a local symbol in the absolute section. */
- + /* There was no symbol required by this relocation. However,
- + BFD doesn't really handle relocations without symbols well.
- + (At least, the COFF support doesn't.) So for now we fake up
- + a local symbol in the absolute section. */
-
- - fixp->fx_addsy = section_symbol (absolute_section);
- -/* fixp->fx_addsy->sy_used_in_reloc = 1; */
- + fixp->fx_addsy = section_symbol (absolute_section);
- +/* fixp->fx_addsy->sy_used_in_reloc = 1; */
- }
- #endif
-
- @@ -921,62 +921,62 @@ write_relocs (abfd, sec, xxx)
- symbolS *sym;
-
- if (fixp->fx_done)
- - {
- - n--;
- - continue;
- - }
- + {
- + n--;
- + continue;
- + }
-
- /* If this is an undefined symbol which was equated to another
- symbol, then use generate the reloc against the latter symbol
- rather than the former. */
- sym = fixp->fx_addsy;
- while (symbol_equated_p (sym)
- - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- - {
- - symbolS *n;
- -
- - /* We must avoid looping, as that can occur with a badly
- - written program. */
- - n = symbol_get_value_expression (sym)->X_add_symbol;
- - if (n == sym)
- - break;
- - fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
- - sym = n;
- - }
- + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- + {
- + symbolS *n;
- +
- + /* We must avoid looping, as that can occur with a badly
- + written program. */
- + n = symbol_get_value_expression (sym)->X_add_symbol;
- + if (n == sym)
- + break;
- + fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
- + sym = n;
- + }
- fixp->fx_addsy = sym;
-
- reloc = tc_gen_reloc (sec, fixp);
- if (!reloc)
- - {
- - n--;
- - continue;
- - }
- + {
- + n--;
- + continue;
- + }
-
- #if 0
- /* This test is triggered inappropriately for the SH. */
- if (fixp->fx_where + fixp->fx_size
- - > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
- - abort ();
- + > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
- + abort ();
- #endif
-
- s = bfd_install_relocation (stdoutput, reloc,
- - fixp->fx_frag->fr_literal,
- - fixp->fx_frag->fr_address,
- - sec, &err);
- + fixp->fx_frag->fr_literal,
- + fixp->fx_frag->fr_address,
- + sec, &err);
- switch (s)
- - {
- - case bfd_reloc_ok:
- - break;
- - case bfd_reloc_overflow:
- - as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation overflow"));
- - break;
- - case bfd_reloc_outofrange:
- - as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation out of range"));
- - break;
- - default:
- - as_fatal (_("%s:%u: bad return from bfd_install_relocation: %x"),
- - fixp->fx_file, fixp->fx_line, s);
- - }
- + {
- + case bfd_reloc_ok:
- + break;
- + case bfd_reloc_overflow:
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation overflow"));
- + break;
- + case bfd_reloc_outofrange:
- + as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation out of range"));
- + break;
- + default:
- + as_fatal (_("%s:%u: bad return from bfd_install_relocation: %x"),
- + fixp->fx_file, fixp->fx_line, s);
- + }
- relocs[i++] = reloc;
- }
- #else
- @@ -994,50 +994,50 @@ write_relocs (abfd, sec, xxx)
- int j;
-
- if (fixp->fx_done)
- - {
- - n--;
- - continue;
- - }
- + {
- + n--;
- + continue;
- + }
-
- /* If this is an undefined symbol which was equated to another
- symbol, then use generate the reloc against the latter symbol
- rather than the former. */
- sym = fixp->fx_addsy;
- while (symbol_equated_p (sym)
- - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- - sym = symbol_get_value_expression (sym)->X_add_symbol;
- + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
- + sym = symbol_get_value_expression (sym)->X_add_symbol;
- fixp->fx_addsy = sym;
-
- reloc = tc_gen_reloc (sec, fixp);
-
- for (j = 0; reloc[j]; j++)
- - {
- + {
- relocs[i++] = reloc[j];
- assert(i <= n);
- - }
- + }
- data = fixp->fx_frag->fr_literal + fixp->fx_where;
- if (fixp->fx_where + fixp->fx_size
- - > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
- - as_bad_where (fixp->fx_file, fixp->fx_line,
- - _("internal error: fixup not contained within frag"));
- + > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + _("internal error: fixup not contained within frag"));
- for (j = 0; reloc[j]; j++)
- {
- - s = bfd_install_relocation (stdoutput, reloc[j],
- - fixp->fx_frag->fr_literal,
- - fixp->fx_frag->fr_address,
- - sec, &err);
- + s = bfd_install_relocation (stdoutput, reloc[j],
- + fixp->fx_frag->fr_literal,
- + fixp->fx_frag->fr_address,
- + sec, &err);
- switch (s)
- - {
- - case bfd_reloc_ok:
- - break;
- - case bfd_reloc_overflow:
- - as_bad_where (fixp->fx_file, fixp->fx_line,
- - _("relocation overflow"));
- - break;
- - default:
- - as_fatal (_("%s:%u: bad return from bfd_install_relocation"),
- - fixp->fx_file, fixp->fx_line);
- - }
- + {
- + case bfd_reloc_ok:
- + break;
- + case bfd_reloc_overflow:
- + as_bad_where (fixp->fx_file, fixp->fx_line,
- + _("relocation overflow"));
- + break;
- + default:
- + as_fatal (_("%s:%u: bad return from bfd_install_relocation"),
- + fixp->fx_file, fixp->fx_line);
- + }
- }
- }
- n = i;
- @@ -1051,13 +1051,13 @@ write_relocs (abfd, sec, xxx)
- nsyms = bfd_get_symcount (stdoutput);
- for (i = 0; i < n; i++)
- if (((*relocs[i]->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
- - {
- - for (j = 0; j < nsyms; j++)
- - if (sympp[j] == *relocs[i]->sym_ptr_ptr)
- - break;
- - if (j == nsyms)
- - abort ();
- - }
- + {
- + for (j = 0; j < nsyms; j++)
- + if (sympp[j] == *relocs[i]->sym_ptr_ptr)
- + break;
- + if (j == nsyms)
- + abort ();
- + }
- }
- #endif
-
- @@ -1065,8 +1065,8 @@ write_relocs (abfd, sec, xxx)
- bfd_set_reloc (stdoutput, sec, relocs, n);
- else
- bfd_set_section_flags (abfd, sec,
- - (bfd_get_section_flags (abfd, sec)
- - & (flagword) ~SEC_RELOC));
- + (bfd_get_section_flags (abfd, sec)
- + & (flagword) ~SEC_RELOC));
-
- #ifdef SET_SECTION_RELOCS
- SET_SECTION_RELOCS (sec, relocs, n);
- @@ -1080,10 +1080,10 @@ write_relocs (abfd, sec, xxx)
- fprintf (stderr, "relocs for sec %s\n", sec->name);
- for (i = 0; i < n; i++)
- {
- - r = relocs[i];
- - s = *r->sym_ptr_ptr;
- - fprintf (stderr, " reloc %2d @%08x off %4x : sym %-10s addend %x\n",
- - i, r, r->address, s->name, r->addend);
- + r = relocs[i];
- + s = *r->sym_ptr_ptr;
- + fprintf (stderr, " reloc %2d @%08x off %4x : sym %-10s addend %x\n",
- + i, r, r->address, s->name, r->addend);
- }
- }
- #endif
- @@ -1115,73 +1115,73 @@ write_contents (abfd, sec, xxx)
-
- assert (f->fr_type == rs_fill);
- if (f->fr_fix)
- - {
- - x = bfd_set_section_contents (stdoutput, sec,
- - f->fr_literal, (file_ptr) offset,
- - (bfd_size_type) f->fr_fix);
- - if (x == false)
- - {
- - bfd_perror (stdoutput->filename);
- - as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
- - exit (EXIT_FAILURE);
- - }
- - offset += f->fr_fix;
- - }
- + {
- + x = bfd_set_section_contents (stdoutput, sec,
- + f->fr_literal, (file_ptr) offset,
- + (bfd_size_type) f->fr_fix);
- + if (x == false)
- + {
- + bfd_perror (stdoutput->filename);
- + as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
- + exit (EXIT_FAILURE);
- + }
- + offset += f->fr_fix;
- + }
- fill_literal = f->fr_literal + f->fr_fix;
- fill_size = f->fr_var;
- count = f->fr_offset;
- assert (count >= 0);
- if (fill_size && count)
- - {
- - char buf[256];
- - if (fill_size > sizeof(buf))
- - {
- - /* Do it the old way. Can this ever happen? */
- - while (count--)
- - {
- - x = bfd_set_section_contents (stdoutput, sec,
- - fill_literal,
- - (file_ptr) offset,
- - (bfd_size_type) fill_size);
- - if (x == false)
- - {
- - bfd_perror (stdoutput->filename);
- - as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
- - exit (EXIT_FAILURE);
- - }
- - offset += fill_size;
- - }
- - }
- - else
- - {
- - /* Build a buffer full of fill objects and output it as
- - often as necessary. This saves on the overhead of
- - potentially lots of bfd_set_section_contents calls. */
- - int n_per_buf, i;
- - if (fill_size == 1)
- - {
- - n_per_buf = sizeof (buf);
- - memset (buf, *fill_literal, n_per_buf);
- - }
- - else
- - {
- - char *bufp;
- - n_per_buf = sizeof(buf)/fill_size;
- - for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size)
- - memcpy(bufp, fill_literal, fill_size);
- - }
- - for (; count > 0; count -= n_per_buf)
- - {
- - n_per_buf = n_per_buf > count ? count : n_per_buf;
- - x = bfd_set_section_contents (stdoutput, sec,
- - buf, (file_ptr) offset,
- - (bfd_size_type) n_per_buf * fill_size);
- - if (x != true)
- - as_fatal (_("Cannot write to output file."));
- - offset += n_per_buf * fill_size;
- - }
- - }
- - }
- + {
- + char buf[256];
- + if (fill_size > sizeof(buf))
- + {
- + /* Do it the old way. Can this ever happen? */
- + while (count--)
- + {
- + x = bfd_set_section_contents (stdoutput, sec,
- + fill_literal,
- + (file_ptr) offset,
- + (bfd_size_type) fill_size);
- + if (x == false)
- + {
- + bfd_perror (stdoutput->filename);
- + as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
- + exit (EXIT_FAILURE);
- + }
- + offset += fill_size;
- + }
- + }
- + else
- + {
- + /* Build a buffer full of fill objects and output it as
- + often as necessary. This saves on the overhead of
- + potentially lots of bfd_set_section_contents calls. */
- + int n_per_buf, i;
- + if (fill_size == 1)
- + {
- + n_per_buf = sizeof (buf);
- + memset (buf, *fill_literal, n_per_buf);
- + }
- + else
- + {
- + char *bufp;
- + n_per_buf = sizeof(buf)/fill_size;
- + for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size)
- + memcpy(bufp, fill_literal, fill_size);
- + }
- + for (; count > 0; count -= n_per_buf)
- + {
- + n_per_buf = n_per_buf > count ? count : n_per_buf;
- + x = bfd_set_section_contents (stdoutput, sec,
- + buf, (file_ptr) offset,
- + (bfd_size_type) n_per_buf * fill_size);
- + if (x != true)
- + as_fatal (_("Cannot write to output file."));
- + offset += n_per_buf * fill_size;
- + }
- + }
- + }
- }
- }
- #endif
- @@ -1248,21 +1248,21 @@ relax_and_size_all_segments ()
-
- H_SET_DATA_SIZE (&headers, data_last_frag->fr_address);
- data_last_frag->fr_address = H_GET_DATA_SIZE (&headers);
- - slide = H_GET_TEXT_SIZE (&headers); /* & in file of the data segment. */
- + slide = H_GET_TEXT_SIZE (&headers); /* & in file of the data segment. */
- #ifdef OBJ_BOUT
- #define RoundUp(N,S) (((N)+(S)-1)&-(S))
- /* For b.out: If the data section has a strict alignment
- - requirement, its load address in the .o file will be
- - rounded up from the size of the text section. These
- - two values are *not* the same! Similarly for the bss
- - section.... */
- + requirement, its load address in the .o file will be
- + rounded up from the size of the text section. These
- + two values are *not* the same! Similarly for the bss
- + section.... */
- slide = RoundUp (slide, 1 << section_alignment[SEG_DATA]);
- #endif
-
- for (fragP = data_frag_root; fragP; fragP = fragP->fr_next)
- - {
- - fragP->fr_address += slide;
- - } /* for each data frag */
- + {
- + fragP->fr_address += slide;
- + } /* for each data frag */
-
- know (text_last_frag != 0);
- text_last_frag->fr_next = data_frag_root;
- @@ -1285,7 +1285,7 @@ relax_and_size_all_segments ()
- }
- #else /* ! OBJ_BOUT */
- bss_address_frag.fr_address = (H_GET_TEXT_SIZE (&headers) +
- - H_GET_DATA_SIZE (&headers));
- + H_GET_DATA_SIZE (&headers));
-
- #endif /* ! OBJ_BOUT */
-
- @@ -1295,14 +1295,14 @@ relax_and_size_all_segments ()
- relax_addressT slide = bss_address_frag.fr_address;
-
- for (fragP = bss_frag_root; fragP; fragP = fragP->fr_next)
- - {
- - fragP->fr_address += slide;
- - } /* for each bss frag */
- + {
- + fragP->fr_address += slide;
- + } /* for each bss frag */
- }
-
- if (bss_last_frag)
- H_SET_BSS_SIZE (&headers,
- - bss_last_frag->fr_address - bss_frag_root->fr_address);
- + bss_last_frag->fr_address - bss_frag_root->fr_address);
- else
- H_SET_BSS_SIZE (&headers, 0);
- }
- @@ -1332,13 +1332,13 @@ set_symtab ()
- int i;
-
- asympp = (asymbol **) bfd_alloc (stdoutput,
- - nsyms * sizeof (asymbol *));
- + nsyms * sizeof (asymbol *));
- symp = symbol_rootP;
- for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
- - {
- - asympp[i] = symbol_get_bfdsym (symp);
- - symbol_mark_written (symp);
- - }
- + {
- + asympp[i] = symbol_get_bfdsym (symp);
- + symbol_mark_written (symp);
- + }
- }
- else
- asympp = 0;
- @@ -1375,14 +1375,14 @@ subsegs_finish ()
- any alignment is meaningless, and, moreover, will look weird
- if we are generating a listing. */
- frag_align (had_errors () ? 0 : SUB_SEGMENT_ALIGN (now_seg),
- - subseg_text_p (now_seg) ? NOP_OPCODE : 0,
- - 0);
- + subseg_text_p (now_seg) ? NOP_OPCODE : 0,
- + 0);
-
- /* frag_align will have left a new frag.
- - Use this last frag for an empty ".fill".
- + Use this last frag for an empty ".fill".
-
- - For this segment ...
- - Create a last frag. Do not leave a "being filled in frag". */
- + For this segment ...
- + Create a last frag. Do not leave a "being filled in frag". */
-
- frag_wane (frag_now);
- frag_now->fr_fix = 0;
- @@ -1396,7 +1396,7 @@ void
- write_object_file ()
- {
- #if ! defined (BFD_ASSEMBLER) || ! defined (WORKING_DOT_WORD)
- - fragS *fragP; /* Track along all frags. */
- + fragS *fragP; /* Track along all frags. */
- #endif
-
- /* Do we really want to write it? */
- @@ -1408,21 +1408,21 @@ write_object_file ()
- regardless of warnings and errors. */
- if (flag_always_generate_output)
- {
- - if (n_warns || n_errs)
- - as_warn (_("%d error%s, %d warning%s, generating bad object file.\n"),
- - n_errs, n_errs == 1 ? "" : "s",
- - n_warns, n_warns == 1 ? "" : "s");
- + if (n_warns || n_errs)
- + as_warn (_("%d error%s, %d warning%s, generating bad object file.\n"),
- + n_errs, n_errs == 1 ? "" : "s",
- + n_warns, n_warns == 1 ? "" : "s");
- }
- else
- {
- - if (n_errs)
- - as_fatal (_("%d error%s, %d warning%s, no object file generated.\n"),
- - n_errs, n_errs == 1 ? "" : "s",
- - n_warns, n_warns == 1 ? "" : "s");
- + if (n_errs)
- + as_fatal (_("%d error%s, %d warning%s, no object file generated.\n"),
- + n_errs, n_errs == 1 ? "" : "s",
- + n_warns, n_warns == 1 ? "" : "s");
- }
- }
-
- -#ifdef OBJ_VMS
- +#ifdef OBJ_VMS
- /* Under VMS we try to be compatible with VAX-11 "C". Thus, we call
- a routine to check for the definition of the procedure "_main",
- and if so -- fix it up so that it can be program entry point. */
- @@ -1441,17 +1441,17 @@ write_object_file ()
- seclist = &stdoutput->sections;
- while (seclist && *seclist)
- {
- - sec = *seclist;
- - while (sec == reg_section || sec == expr_section)
- - {
- - sec = sec->next;
- - *seclist = sec;
- - stdoutput->section_count--;
- - if (!sec)
- - break;
- - }
- - if (*seclist)
- - seclist = &(*seclist)->next;
- + sec = *seclist;
- + while (sec == reg_section || sec == expr_section)
- + {
- + sec = sec->next;
- + *seclist = sec;
- + stdoutput->section_count--;
- + if (!sec)
- + break;
- + }
- + if (*seclist)
- + seclist = &(*seclist)->next;
- }
- i = 0;
- bfd_map_over_sections (stdoutput, renumber_sections, &i);
- @@ -1527,7 +1527,7 @@ write_object_file ()
- which may call fix_new. We need to ensure that fix_new adds
- the fixup to the right section. */
- if (fragP == data_frag_root)
- - subseg_change (SEG_DATA, 0);
- + subseg_change (SEG_DATA, 0);
-
- cvt_frag_to_fill (&headers, SEG_TEXT, fragP);
-
- @@ -1535,11 +1535,11 @@ write_object_file ()
- #ifndef NDEBUG
- if (!(fragP->fr_next == NULL
- #ifdef OBJ_BOUT
- - || fragP->fr_next == data_frag_root
- + || fragP->fr_next == data_frag_root
- #endif
- - || ((fragP->fr_next->fr_address - fragP->fr_address)
- - == (fragP->fr_fix + fragP->fr_offset * fragP->fr_var))))
- - abort ();
- + || ((fragP->fr_next->fr_address - fragP->fr_address)
- + == (fragP->fr_fix + fragP->fr_offset * fragP->fr_var))))
- + abort ();
- #endif
- }
- #endif /* ! BFD_ASSEMBLER */
- @@ -1552,108 +1552,108 @@ write_object_file ()
- prevP = &broken_words;
- for (lie = broken_words; lie; lie = lie->next_broken_word)
- if (!lie->added)
- - {
- - expressionS exp;
- -
- - subseg_change (lie->seg, lie->subseg);
- - exp.X_op = O_subtract;
- - exp.X_add_symbol = lie->add;
- - exp.X_op_symbol = lie->sub;
- - exp.X_add_number = lie->addnum;
- + {
- + expressionS exp;
- +
- + subseg_change (lie->seg, lie->subseg);
- + exp.X_op = O_subtract;
- + exp.X_add_symbol = lie->add;
- + exp.X_op_symbol = lie->sub;
- + exp.X_add_number = lie->addnum;
- #ifdef BFD_ASSEMBLER
- #ifdef TC_CONS_FIX_NEW
- - TC_CONS_FIX_NEW (lie->frag,
- - lie->word_goes_here - lie->frag->fr_literal,
- - 2, &exp);
- + TC_CONS_FIX_NEW (lie->frag,
- + lie->word_goes_here - lie->frag->fr_literal,
- + 2, &exp);
- #else
- - fix_new_exp (lie->frag,
- - lie->word_goes_here - lie->frag->fr_literal,
- - 2, &exp, 0, BFD_RELOC_16);
- + fix_new_exp (lie->frag,
- + lie->word_goes_here - lie->frag->fr_literal,
- + 2, &exp, 0, BFD_RELOC_16);
- #endif
- #else
- #if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
- - fix_new_exp (lie->frag,
- - lie->word_goes_here - lie->frag->fr_literal,
- - 2, &exp, 0, NO_RELOC);
- + fix_new_exp (lie->frag,
- + lie->word_goes_here - lie->frag->fr_literal,
- + 2, &exp, 0, NO_RELOC);
- #else
- #ifdef TC_NS32K
- - fix_new_ns32k_exp (lie->frag,
- - lie->word_goes_here - lie->frag->fr_literal,
- - 2, &exp, 0, 0, 2, 0, 0);
- + fix_new_ns32k_exp (lie->frag,
- + lie->word_goes_here - lie->frag->fr_literal,
- + 2, &exp, 0, 0, 2, 0, 0);
- #else
- - fix_new_exp (lie->frag,
- - lie->word_goes_here - lie->frag->fr_literal,
- - 2, &exp, 0, 0);
- + fix_new_exp (lie->frag,
- + lie->word_goes_here - lie->frag->fr_literal,
- + 2, &exp, 0, 0);
- #endif /* TC_NS32K */
- #endif /* TC_SPARC|TC_A29K|NEED_FX_R_TYPE */
- #endif /* BFD_ASSEMBLER */
- - *prevP = lie->next_broken_word;
- - }
- + *prevP = lie->next_broken_word;
- + }
- else
- - prevP = &(lie->next_broken_word);
- + prevP = &(lie->next_broken_word);
-
- for (lie = broken_words; lie;)
- {
- - struct broken_word *untruth;
- - char *table_ptr;
- - addressT table_addr;
- - addressT from_addr, to_addr;
- - int n, m;
- -
- - subseg_change (lie->seg, lie->subseg);
- - fragP = lie->dispfrag;
- -
- - /* Find out how many broken_words go here. */
- - n = 0;
- - for (untruth = lie; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
- - if (untruth->added == 1)
- - n++;
- -
- - table_ptr = lie->dispfrag->fr_opcode;
- - table_addr = lie->dispfrag->fr_address + (table_ptr - lie->dispfrag->fr_literal);
- - /* Create the jump around the long jumps. This is a short
- - jump from table_ptr+0 to table_ptr+n*long_jump_size. */
- - from_addr = table_addr;
- - to_addr = table_addr + md_short_jump_size + n * md_long_jump_size;
- - md_create_short_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
- - table_ptr += md_short_jump_size;
- - table_addr += md_short_jump_size;
- -
- - for (m = 0; lie && lie->dispfrag == fragP; m++, lie = lie->next_broken_word)
- - {
- - if (lie->added == 2)
- - continue;
- - /* Patch the jump table */
- - /* This is the offset from ??? to table_ptr+0 */
- - to_addr = table_addr - S_GET_VALUE (lie->sub);
- + struct broken_word *untruth;
- + char *table_ptr;
- + addressT table_addr;
- + addressT from_addr, to_addr;
- + int n, m;
- +
- + subseg_change (lie->seg, lie->subseg);
- + fragP = lie->dispfrag;
- +
- + /* Find out how many broken_words go here. */
- + n = 0;
- + for (untruth = lie; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
- + if (untruth->added == 1)
- + n++;
- +
- + table_ptr = lie->dispfrag->fr_opcode;
- + table_addr = lie->dispfrag->fr_address + (table_ptr - lie->dispfrag->fr_literal);
- + /* Create the jump around the long jumps. This is a short
- + jump from table_ptr+0 to table_ptr+n*long_jump_size. */
- + from_addr = table_addr;
- + to_addr = table_addr + md_short_jump_size + n * md_long_jump_size;
- + md_create_short_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
- + table_ptr += md_short_jump_size;
- + table_addr += md_short_jump_size;
- +
- + for (m = 0; lie && lie->dispfrag == fragP; m++, lie = lie->next_broken_word)
- + {
- + if (lie->added == 2)
- + continue;
- + /* Patch the jump table */
- + /* This is the offset from ??? to table_ptr+0 */
- + to_addr = table_addr - S_GET_VALUE (lie->sub);
- #ifdef BFD_ASSEMBLER
- - to_addr -= symbol_get_frag (lie->sub)->fr_address;
- -#endif
- - md_number_to_chars (lie->word_goes_here, to_addr, 2);
- - for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
- - {
- - if (untruth->use_jump == lie)
- - md_number_to_chars (untruth->word_goes_here, to_addr, 2);
- - }
- -
- - /* Install the long jump */
- - /* this is a long jump from table_ptr+0 to the final target */
- - from_addr = table_addr;
- - to_addr = S_GET_VALUE (lie->add) + lie->addnum;
- + to_addr -= symbol_get_frag (lie->sub)->fr_address;
- +#endif
- + md_number_to_chars (lie->word_goes_here, to_addr, 2);
- + for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
- + {
- + if (untruth->use_jump == lie)
- + md_number_to_chars (untruth->word_goes_here, to_addr, 2);
- + }
- +
- + /* Install the long jump */
- + /* this is a long jump from table_ptr+0 to the final target */
- + from_addr = table_addr;
- + to_addr = S_GET_VALUE (lie->add) + lie->addnum;
- #ifdef BFD_ASSEMBLER
- - to_addr += symbol_get_frag (lie->add)->fr_address;
- + to_addr += symbol_get_frag (lie->add)->fr_address;
- #endif
- - md_create_long_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
- - table_ptr += md_long_jump_size;
- - table_addr += md_long_jump_size;
- - }
- + md_create_long_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
- + table_ptr += md_long_jump_size;
- + table_addr += md_long_jump_size;
- + }
- }
- }
- #endif /* not WORKING_DOT_WORD */
-
- #ifndef BFD_ASSEMBLER
- -#ifndef OBJ_VMS
- - { /* not vms */
- +#ifndef OBJ_VMS
- + { /* not vms */
- char *the_object_file;
- long object_file_size;
- /*
- @@ -1672,7 +1672,7 @@ write_object_file ()
- H_SET_MAGIC_NUMBER (&headers, magic_number_for_object_file);
- H_SET_ENTRY_POINT (&headers, 0);
-
- - obj_pre_write_hook (&headers); /* extra coff stuff */
- + obj_pre_write_hook (&headers); /* extra coff stuff */
-
- object_file_size = H_GET_FILE_SIZE (&headers);
- next_object_file_charP = the_object_file = xmalloc (object_file_size);
- @@ -1688,23 +1688,23 @@ write_object_file ()
- */
- for (fragP = text_frag_root; fragP; fragP = fragP->fr_next)
- {
- - register long count;
- - register char *fill_literal;
- - register long fill_size;
- + register long count;
- + register char *fill_literal;
- + register long fill_size;
-
- - PROGRESS (1);
- - know (fragP->fr_type == rs_fill);
- - append (&next_object_file_charP, fragP->fr_literal, (unsigned long) fragP->fr_fix);
- - fill_literal = fragP->fr_literal + fragP->fr_fix;
- - fill_size = fragP->fr_var;
- - know (fragP->fr_offset >= 0);
- + PROGRESS (1);
- + know (fragP->fr_type == rs_fill);
- + append (&next_object_file_charP, fragP->fr_literal, (unsigned long) fragP->fr_fix);
- + fill_literal = fragP->fr_literal + fragP->fr_fix;
- + fill_size = fragP->fr_var;
- + know (fragP->fr_offset >= 0);
-
- - for (count = fragP->fr_offset; count; count--)
- - {
- - append (&next_object_file_charP, fill_literal, (unsigned long) fill_size);
- - } /* for each */
- + for (count = fragP->fr_offset; count; count--)
- + {
- + append (&next_object_file_charP, fill_literal, (unsigned long) fill_size);
- + } /* for each */
-
- - } /* for each code frag. */
- + } /* for each code frag. */
-
- know ((next_object_file_charP - the_object_file) == (H_GET_HEADER_SIZE (&headers) + H_GET_TEXT_SIZE (&headers) + H_GET_DATA_SIZE (&headers)));
-
- @@ -1743,8 +1743,8 @@ write_object_file ()
-
- if (string_byte_count > 0)
- {
- - obj_emit_strings (&next_object_file_charP);
- - } /* only if we have a string table */
- + obj_emit_strings (&next_object_file_charP);
- + } /* only if we have a string table */
-
- #ifdef BFD_HEADERS
- bfd_seek (stdoutput, 0, 0);
- @@ -1755,15 +1755,15 @@ write_object_file ()
- output_file_append (the_object_file, object_file_size, out_file_name);
- free (the_object_file);
- #endif
- - } /* non vms output */
- + } /* non vms output */
- #else /* OBJ_VMS */
- /*
- - * Now do the VMS-dependent part of writing the object file
- + * Now do the VMS-dependent part of writing the object file
- */
- vms_write_object_file (H_GET_TEXT_SIZE (&headers),
- - H_GET_DATA_SIZE (&headers),
- - H_GET_BSS_SIZE (&headers),
- - text_frag_root, data_frag_root);
- + H_GET_DATA_SIZE (&headers),
- + H_GET_BSS_SIZE (&headers),
- + text_frag_root, data_frag_root);
- #endif /* OBJ_VMS */
- #else /* BFD_ASSEMBLER */
-
- @@ -1774,7 +1774,7 @@ write_object_file ()
- symbolS *symp;
-
- for (symp = symbol_rootP; symp; symp = symbol_next (symp))
- - resolve_symbol_value (symp, 1);
- + resolve_symbol_value (symp, 1);
- }
- resolve_local_symbol_values ();
-
- @@ -1795,98 +1795,107 @@ write_object_file ()
- symbolS *symp;
-
- for (symp = symbol_rootP; symp; symp = symbol_next (symp))
- - {
- - int punt = 0;
- - const char *name;
- -
- - if (symbol_mri_common_p (symp))
- - {
- - if (S_IS_EXTERNAL (symp))
- - as_bad (_("%s: global symbols not supported in common sections"),
- - S_GET_NAME (symp));
- - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- - continue;
- - }
- -
- - name = S_GET_NAME (symp);
- - if (name)
- - {
- - const char *name2 = decode_local_label_name ((char *)S_GET_NAME (symp));
- - /* They only differ if `name' is a fb or dollar local
- - label name. */
- - if (name2 != name && ! S_IS_DEFINED (symp))
- - as_bad (_("local label %s is not defined"), name2);
- - }
- -
- - /* Do it again, because adjust_reloc_syms might introduce
- - more symbols. They'll probably only be section symbols,
- - but they'll still need to have the values computed. */
- - resolve_symbol_value (symp, 1);
- -
- - /* Skip symbols which were equated to undefined or common
- + {
- + int punt = 0;
- + const char *name;
- +
- + if (symbol_mri_common_p (symp))
- + {
- + if (S_IS_EXTERNAL (symp))
- + as_bad (_("%s: global symbols not supported in common sections"),
- + S_GET_NAME (symp));
- + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- + continue;
- + }
- +
- + name = S_GET_NAME (symp);
- + if (name)
- + {
- + const char *name2 = decode_local_label_name ((char *)S_GET_NAME (symp));
- + /* They only differ if `name' is a fb or dollar local
- + label name. */
- + if (name2 != name && ! S_IS_DEFINED (symp)){
- + /* add T.Tazaki 2003/01/14 short source name length ==> error : bug fix */
- + /* del T.Tazaki 2003/06/17 >>> */
- +// if( !strncmp( name2,"\"0\" (",5 ) )
- +// {
- +// continue; /* skip */
- +// }
- + /* del T.Tazaki 2003/06/17 <<< */
- + /* add T.Tazaki 2003/01/14 short source name length ==> error : bug fix */
- + as_bad (_("local label %s is not defined"), name2);
- + }
- + }
- +
- + /* Do it again, because adjust_reloc_syms might introduce
- + more symbols. They'll probably only be section symbols,
- + but they'll still need to have the values computed. */
- + resolve_symbol_value (symp, 1);
- +
- + /* Skip symbols which were equated to undefined or common
- symbols. */
- - if (symbol_equated_p (symp)
- - && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
- - {
- - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- - continue;
- - }
- -
- - /* So far, common symbols have been treated like undefined symbols.
- - Put them in the common section now. */
- - if (S_IS_DEFINED (symp) == 0
- - && S_GET_VALUE (symp) != 0)
- - S_SET_SEGMENT (symp, bfd_com_section_ptr);
- + if (symbol_equated_p (symp)
- + && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
- + {
- + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- + continue;
- + }
- +
- + /* So far, common symbols have been treated like undefined symbols.
- + Put them in the common section now. */
- + if (S_IS_DEFINED (symp) == 0
- + && S_GET_VALUE (symp) != 0)
- + S_SET_SEGMENT (symp, bfd_com_section_ptr);
- #if 0
- - printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
- - S_GET_NAME (symp), symp,
- - S_GET_VALUE (symp),
- - symbol_get_bfdsym (symp)->flags,
- - segment_name (S_GET_SEGMENT (symp)));
- + printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
- + S_GET_NAME (symp), symp,
- + S_GET_VALUE (symp),
- + symbol_get_bfdsym (symp)->flags,
- + segment_name (S_GET_SEGMENT (symp)));
- #endif
-
- #ifdef obj_frob_symbol
- - obj_frob_symbol (symp, punt);
- + obj_frob_symbol (symp, punt);
- #endif
- #ifdef tc_frob_symbol
- - if (! punt || symbol_used_in_reloc_p (symp))
- - tc_frob_symbol (symp, punt);
- -#endif
- -
- - /* If we don't want to keep this symbol, splice it out of
- - the chain now. If EMIT_SECTION_SYMBOLS is 0, we never
- - want section symbols. Otherwise, we skip local symbols
- - and symbols that the frob_symbol macros told us to punt,
- - but we keep such symbols if they are used in relocs. */
- - if ((! EMIT_SECTION_SYMBOLS
- - && symbol_section_p (symp))
- - /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
- - opposites. Sometimes the former checks flags and the
- - latter examines the name... */
- - || (!S_IS_EXTERN (symp)
- - && (S_IS_LOCAL (symp) || punt)
- - && ! symbol_used_in_reloc_p (symp)))
- - {
- - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- - /* After symbol_remove, symbol_next(symp) still returns
- - the one that came after it in the chain. So we don't
- - need to do any extra cleanup work here. */
- -
- - continue;
- - }
- -
- - /* Make sure we really got a value for the symbol. */
- - if (! symbol_resolved_p (symp))
- - {
- - as_bad (_("can't resolve value for symbol \"%s\""),
- - S_GET_NAME (symp));
- - symbol_mark_resolved (symp);
- - }
- -
- - /* Set the value into the BFD symbol. Up til now the value
- - has only been kept in the gas symbolS struct. */
- - symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
- - }
- + if (! punt || symbol_used_in_reloc_p (symp))
- + tc_frob_symbol (symp, punt);
- +#endif
- +
- + /* If we don't want to keep this symbol, splice it out of
- + the chain now. If EMIT_SECTION_SYMBOLS is 0, we never
- + want section symbols. Otherwise, we skip local symbols
- + and symbols that the frob_symbol macros told us to punt,
- + but we keep such symbols if they are used in relocs. */
- + if ((! EMIT_SECTION_SYMBOLS
- + && symbol_section_p (symp))
- + /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
- + opposites. Sometimes the former checks flags and the
- + latter examines the name... */
- + || (!S_IS_EXTERN (symp)
- + && (S_IS_LOCAL (symp) || punt)
- + && ! symbol_used_in_reloc_p (symp)))
- + {
- + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
- + /* After symbol_remove, symbol_next(symp) still returns
- + the one that came after it in the chain. So we don't
- + need to do any extra cleanup work here. */
- +
- + continue;
- + }
- +
- + /* Make sure we really got a value for the symbol. */
- + if (! symbol_resolved_p (symp))
- + {
- + as_bad (_("can't resolve value for symbol \"%s\""),
- + S_GET_NAME (symp));
- + symbol_mark_resolved (symp);
- + }
- +
- + /* Set the value into the BFD symbol. Up til now the value
- + has only been kept in the gas symbolS struct. */
- + symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
- + }
- }
-
- PROGRESS (1);
- @@ -1930,7 +1939,7 @@ write_object_file ()
- #endif /* ! BFD */
-
- /*
- - * relax_segment()
- + * relax_segment()
- *
- * Now we have a segment, not a crowd of sub-segments, we can make fr_address
- * values.
- @@ -1986,30 +1995,30 @@ relax_frag (fragP, stretch)
- #ifndef DIFF_EXPR_OK
- #if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
- know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
- - || (S_GET_SEGMENT (symbolP) == SEG_DATA)
- - || (S_GET_SEGMENT (symbolP) == SEG_BSS)
- - || (S_GET_SEGMENT (symbolP) == SEG_TEXT));
- + || (S_GET_SEGMENT (symbolP) == SEG_DATA)
- + || (S_GET_SEGMENT (symbolP) == SEG_BSS)
- + || (S_GET_SEGMENT (symbolP) == SEG_TEXT));
- #endif
- know (symbolP->sy_frag);
- #endif
- know (!(S_GET_SEGMENT (symbolP) == absolute_section)
- - || symbolP->sy_frag == &zero_address_frag);
- - target += S_GET_VALUE (symbolP) + symbol_get_frag (symbolP)->fr_address;
- + || symbolP->sy_frag == &zero_address_frag);
- + target += S_GET_VALUE (symbolP) + symbol_get_frag (symbolP)->fr_address;
-
- /* If frag has yet to be reached on this pass,
- - assume it will move by STRETCH just as we did.
- - If this is not so, it will be because some frag
- - between grows, and that will force another pass.
- + assume it will move by STRETCH just as we did.
- + If this is not so, it will be because some frag
- + between grows, and that will force another pass.
-
- - Beware zero-length frags.
- + Beware zero-length frags.
-
- - There should be a faster way to do this. */
- + There should be a faster way to do this. */
-
- if (symbol_get_frag (symbolP)->fr_address >= was_address
- - && is_dnrange (fragP, symbol_get_frag (symbolP)))
- - {
- - target += stretch;
- - }
- + && is_dnrange (fragP, symbol_get_frag (symbolP)))
- + {
- + target += stretch;
- + }
- }
-
- aim = target - address - fragP->fr_fix;
- @@ -2029,29 +2038,29 @@ relax_frag (fragP, stretch)
- {
- /* Look backwards. */
- for (next_state = this_type->rlx_more; next_state;)
- - if (aim >= this_type->rlx_backward)
- - next_state = 0;
- - else
- - {
- - /* Grow to next state. */
- - this_state = next_state;
- - this_type = table + this_state;
- - next_state = this_type->rlx_more;
- - }
- + if (aim >= this_type->rlx_backward)
- + next_state = 0;
- + else
- + {
- + /* Grow to next state. */
- + this_state = next_state;
- + this_type = table + this_state;
- + next_state = this_type->rlx_more;
- + }
- }
- else
- {
- /* Look forwards. */
- for (next_state = this_type->rlx_more; next_state;)
- - if (aim <= this_type->rlx_forward)
- - next_state = 0;
- - else
- - {
- - /* Grow to next state. */
- - this_state = next_state;
- - this_type = table + this_state;
- - next_state = this_type->rlx_more;
- - }
- + if (aim <= this_type->rlx_forward)
- + next_state = 0;
- + else
- + {
- + /* Grow to next state. */
- + this_state = next_state;
- + this_type = table + this_state;
- + next_state = this_type->rlx_more;
- + }
- }
-
- growth = this_type->rlx_length - start_type->rlx_length;
- @@ -2066,8 +2075,8 @@ relax_frag (fragP, stretch)
- lowest order bits all 0s, return size of adjustment made. */
- static relax_addressT
- relax_align (address, alignment)
- - register relax_addressT address; /* Address now. */
- - register int alignment; /* Alignment (binary). */
- + register relax_addressT address; /* Address now. */
- + register int alignment; /* Alignment (binary). */
- {
- relax_addressT mask;
- relax_addressT new_address;
- @@ -2105,283 +2114,283 @@ relax_segment (segment_frag_root, segment)
- address += fragP->fr_fix;
-
- switch (fragP->fr_type)
- - {
- - case rs_fill:
- - address += fragP->fr_offset * fragP->fr_var;
- - break;
- -
- - case rs_align:
- - case rs_align_code:
- - {
- - addressT offset = relax_align (address, (int) fragP->fr_offset);
- -
- - if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype)
- - offset = 0;
- -
- - if (offset % fragP->fr_var != 0)
- - {
- - as_bad (_("alignment padding (%lu bytes) not a multiple of %ld"),
- - (unsigned long) offset, (long) fragP->fr_var);
- - offset -= (offset % fragP->fr_var);
- - }
- -
- - address += offset;
- - }
- - break;
- -
- - case rs_org:
- - case rs_space:
- - /* Assume .org is nugatory. It will grow with 1st relax. */
- - break;
- -
- - case rs_machine_dependent:
- - address += md_estimate_size_before_relax (fragP, segment);
- - break;
- + {
- + case rs_fill:
- + address += fragP->fr_offset * fragP->fr_var;
- + break;
- +
- + case rs_align:
- + case rs_align_code:
- + {
- + addressT offset = relax_align (address, (int) fragP->fr_offset);
- +
- + if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype)
- + offset = 0;
- +
- + if (offset % fragP->fr_var != 0)
- + {
- + as_bad (_("alignment padding (%lu bytes) not a multiple of %ld"),
- + (unsigned long) offset, (long) fragP->fr_var);
- + offset -= (offset % fragP->fr_var);
- + }
- +
- + address += offset;
- + }
- + break;
- +
- + case rs_org:
- + case rs_space:
- + /* Assume .org is nugatory. It will grow with 1st relax. */
- + break;
- +
- + case rs_machine_dependent:
- + address += md_estimate_size_before_relax (fragP, segment);
- + break;
-
- #ifndef WORKING_DOT_WORD
- - /* Broken words don't concern us yet */
- - case rs_broken_word:
- - break;
- + /* Broken words don't concern us yet */
- + case rs_broken_word:
- + break;
- #endif
-
- - case rs_leb128:
- - /* Initial guess is always 1; doing otherwise can result in
- - stable solutions that are larger than the minimum. */
- - address += fragP->fr_offset = 1;
- - break;
- + case rs_leb128:
- + /* Initial guess is always 1; doing otherwise can result in
- + stable solutions that are larger than the minimum. */
- + address += fragP->fr_offset = 1;
- + break;
-
- - case rs_cfa:
- - address += eh_frame_estimate_size_before_relax (fragP);
- - break;
- + case rs_cfa:
- + address += eh_frame_estimate_size_before_relax (fragP);
- + break;
-
- - default:
- - BAD_CASE (fragP->fr_type);
- - break;
- - } /* switch(fr_type) */
- - } /* for each frag in the segment */
- + default:
- + BAD_CASE (fragP->fr_type);
- + break;
- + } /* switch(fr_type) */
- + } /* for each frag in the segment */
-
- /* Do relax(). */
- {
- - long stretch; /* May be any size, 0 or negative. */
- + long stretch; /* May be any size, 0 or negative. */
- /* Cumulative number of addresses we have */
- /* relaxed this pass. */
- /* We may have relaxed more than one address. */
- - long stretched; /* Have we stretched on this pass? */
- + long stretched; /* Have we stretched on this pass? */
- /* This is 'cuz stretch may be zero, when, in fact some piece of code
- grew, and another shrank. If a branch instruction doesn't fit anymore,
- we could be scrod. */
-
- do
- {
- - stretch = stretched = 0;
- - for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
- - {
- - long growth = 0;
- - addressT was_address;
- - offsetT offset;
- - symbolS *symbolP;
- -
- - was_address = fragP->fr_address;
- - address = fragP->fr_address += stretch;
- - symbolP = fragP->fr_symbol;
- - offset = fragP->fr_offset;
- -
- - switch (fragP->fr_type)
- - {
- - case rs_fill: /* .fill never relaxes. */
- - growth = 0;
- - break;
- + stretch = stretched = 0;
- + for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
- + {
- + long growth = 0;
- + addressT was_address;
- + offsetT offset;
- + symbolS *symbolP;
- +
- + was_address = fragP->fr_address;
- + address = fragP->fr_address += stretch;
- + symbolP = fragP->fr_symbol;
- + offset = fragP->fr_offset;
- +
- + switch (fragP->fr_type)
- + {
- + case rs_fill: /* .fill never relaxes. */
- + growth = 0;
- + break;
-
- #ifndef WORKING_DOT_WORD
- - /* JF: This is RMS's idea. I do *NOT* want to be blamed
- - for it I do not want to write it. I do not want to have
- - anything to do with it. This is not the proper way to
- - implement this misfeature. */
- - case rs_broken_word:
- - {
- - struct broken_word *lie;
- - struct broken_word *untruth;
- -
- - /* Yes this is ugly (storing the broken_word pointer
- - in the symbol slot). Still, this whole chunk of
- - code is ugly, and I don't feel like doing anything
- - about it. Think of it as stubbornness in action. */
- - growth = 0;
- - for (lie = (struct broken_word *) (fragP->fr_symbol);
- - lie && lie->dispfrag == fragP;
- - lie = lie->next_broken_word)
- - {
- -
- - if (lie->added)
- - continue;
- -
- - offset = (symbol_get_frag (lie->add)->fr_address
- - + S_GET_VALUE (lie->add)
- - + lie->addnum
- - - (symbol_get_frag (lie->sub)->fr_address
- - + S_GET_VALUE (lie->sub)));
- - if (offset <= -32768 || offset >= 32767)
- - {
- - if (flag_warn_displacement)
- - {
- - char buf[50];
- - sprint_value (buf, (addressT) lie->addnum);
- - as_warn (_(".word %s-%s+%s didn't fit"),
- - S_GET_NAME (lie->add),
- - S_GET_NAME (lie->sub),
- - buf);
- - }
- - lie->added = 1;
- - if (fragP->fr_subtype == 0)
- - {
- - fragP->fr_subtype++;
- - growth += md_short_jump_size;
- - }
- - for (untruth = lie->next_broken_word;
- - untruth && untruth->dispfrag == lie->dispfrag;
- - untruth = untruth->next_broken_word)
- - if ((symbol_get_frag (untruth->add)
- - == symbol_get_frag (lie->add))
- - && (S_GET_VALUE (untruth->add)
- - == S_GET_VALUE (lie->add)))
- - {
- - untruth->added = 2;
- - untruth->use_jump = lie;
- - }
- - growth += md_long_jump_size;
- - }
- - }
- -
- - break;
- - } /* case rs_broken_word */
- -#endif
- - case rs_align:
- - case rs_align_code:
- - {
- - addressT oldoff, newoff;
- -
- - oldoff = relax_align (was_address + fragP->fr_fix,
- - (int) offset);
- - newoff = relax_align (address + fragP->fr_fix,
- - (int) offset);
- -
- - if (fragP->fr_subtype != 0)
- - {
- - if (oldoff > fragP->fr_subtype)
- - oldoff = 0;
- - if (newoff > fragP->fr_subtype)
- - newoff = 0;
- - }
- -
- - growth = newoff - oldoff;
- - }
- - break;
- -
- - case rs_org:
- - {
- - long target = offset;
- - long after;
- -
- - if (symbolP)
- - {
- + /* JF: This is RMS's idea. I do *NOT* want to be blamed
- + for it I do not want to write it. I do not want to have
- + anything to do with it. This is not the proper way to
- + implement this misfeature. */
- + case rs_broken_word:
- + {
- + struct broken_word *lie;
- + struct broken_word *untruth;
- +
- + /* Yes this is ugly (storing the broken_word pointer
- + in the symbol slot). Still, this whole chunk of
- + code is ugly, and I don't feel like doing anything
- + about it. Think of it as stubbornness in action. */
- + growth = 0;
- + for (lie = (struct broken_word *) (fragP->fr_symbol);
- + lie && lie->dispfrag == fragP;
- + lie = lie->next_broken_word)
- + {
- +
- + if (lie->added)
- + continue;
- +
- + offset = (symbol_get_frag (lie->add)->fr_address
- + + S_GET_VALUE (lie->add)
- + + lie->addnum
- + - (symbol_get_frag (lie->sub)->fr_address
- + + S_GET_VALUE (lie->sub)));
- + if (offset <= -32768 || offset >= 32767)
- + {
- + if (flag_warn_displacement)
- + {
- + char buf[50];
- + sprint_value (buf, (addressT) lie->addnum);
- + as_warn (_(".word %s-%s+%s didn't fit"),
- + S_GET_NAME (lie->add),
- + S_GET_NAME (lie->sub),
- + buf);
- + }
- + lie->added = 1;
- + if (fragP->fr_subtype == 0)
- + {
- + fragP->fr_subtype++;
- + growth += md_short_jump_size;
- + }
- + for (untruth = lie->next_broken_word;
- + untruth && untruth->dispfrag == lie->dispfrag;
- + untruth = untruth->next_broken_word)
- + if ((symbol_get_frag (untruth->add)
- + == symbol_get_frag (lie->add))
- + && (S_GET_VALUE (untruth->add)
- + == S_GET_VALUE (lie->add)))
- + {
- + untruth->added = 2;
- + untruth->use_jump = lie;
- + }
- + growth += md_long_jump_size;
- + }
- + }
- +
- + break;
- + } /* case rs_broken_word */
- +#endif
- + case rs_align:
- + case rs_align_code:
- + {
- + addressT oldoff, newoff;
- +
- + oldoff = relax_align (was_address + fragP->fr_fix,
- + (int) offset);
- + newoff = relax_align (address + fragP->fr_fix,
- + (int) offset);
- +
- + if (fragP->fr_subtype != 0)
- + {
- + if (oldoff > fragP->fr_subtype)
- + oldoff = 0;
- + if (newoff > fragP->fr_subtype)
- + newoff = 0;
- + }
- +
- + growth = newoff - oldoff;
- + }
- + break;
- +
- + case rs_org:
- + {
- + long target = offset;
- + long after;
- +
- + if (symbolP)
- + {
- #if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
- - know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
- - || (S_GET_SEGMENT (symbolP) == SEG_DATA)
- - || (S_GET_SEGMENT (symbolP) == SEG_TEXT)
- - || S_GET_SEGMENT (symbolP) == SEG_BSS);
- - know (symbolP->sy_frag);
- - know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
- - || (symbolP->sy_frag == &zero_address_frag));
- -#endif
- - target += (S_GET_VALUE (symbolP)
- - + symbol_get_frag (symbolP)->fr_address);
- - } /* if we have a symbol */
- -
- - know (fragP->fr_next);
- - after = fragP->fr_next->fr_address;
- - growth = target - after;
- - if (growth < 0)
- - {
- - /* Growth may be negative, but variable part of frag
- - cannot have fewer than 0 chars. That is, we can't
- - .org backwards. */
- - as_bad_where (fragP->fr_file, fragP->fr_line,
- - _("attempt to .org backwards ignored"));
- -
- - /* We've issued an error message. Change the
- + know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
- + || (S_GET_SEGMENT (symbolP) == SEG_DATA)
- + || (S_GET_SEGMENT (symbolP) == SEG_TEXT)
- + || S_GET_SEGMENT (symbolP) == SEG_BSS);
- + know (symbolP->sy_frag);
- + know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
- + || (symbolP->sy_frag == &zero_address_frag));
- +#endif
- + target += (S_GET_VALUE (symbolP)
- + + symbol_get_frag (symbolP)->fr_address);
- + } /* if we have a symbol */
- +
- + know (fragP->fr_next);
- + after = fragP->fr_next->fr_address;
- + growth = target - after;
- + if (growth < 0)
- + {
- + /* Growth may be negative, but variable part of frag
- + cannot have fewer than 0 chars. That is, we can't
- + .org backwards. */
- + as_bad_where (fragP->fr_file, fragP->fr_line,
- + _("attempt to .org backwards ignored"));
- +
- + /* We've issued an error message. Change the
- frag to avoid cascading errors. */
- - fragP->fr_type = rs_align;
- - fragP->fr_subtype = 0;
- - fragP->fr_offset = 0;
- - fragP->fr_fix = after - address;
- - growth = stretch;
- - }
- -
- - growth -= stretch; /* This is an absolute growth factor */
- - break;
- - }
- -
- - case rs_space:
- - if (symbolP)
- - {
- - growth = S_GET_VALUE (symbolP);
- - if (symbol_get_frag (symbolP) != &zero_address_frag
- - || S_IS_COMMON (symbolP)
- - || ! S_IS_DEFINED (symbolP))
- - as_bad_where (fragP->fr_file, fragP->fr_line,
- - _(".space specifies non-absolute value"));
- - fragP->fr_symbol = 0;
- - if (growth < 0)
- - {
- - as_warn (_(".space or .fill with negative value, ignored"));
- - growth = 0;
- - }
- - }
- - else
- - growth = 0;
- - break;
- -
- - case rs_machine_dependent:
- + fragP->fr_type = rs_align;
- + fragP->fr_subtype = 0;
- + fragP->fr_offset = 0;
- + fragP->fr_fix = after - address;
- + growth = stretch;
- + }
- +
- + growth -= stretch; /* This is an absolute growth factor */
- + break;
- + }
- +
- + case rs_space:
- + if (symbolP)
- + {
- + growth = S_GET_VALUE (symbolP);
- + if (symbol_get_frag (symbolP) != &zero_address_frag
- + || S_IS_COMMON (symbolP)
- + || ! S_IS_DEFINED (symbolP))
- + as_bad_where (fragP->fr_file, fragP->fr_line,
- + _(".space specifies non-absolute value"));
- + fragP->fr_symbol = 0;
- + if (growth < 0)
- + {
- + as_warn (_(".space or .fill with negative value, ignored"));
- + growth = 0;
- + }
- + }
- + else
- + growth = 0;
- + break;
- +
- + case rs_machine_dependent:
- #ifdef md_relax_frag
- - growth = md_relax_frag (fragP, stretch);
- + growth = md_relax_frag (fragP, stretch);
- #else
- #ifdef TC_GENERIC_RELAX_TABLE
- - /* The default way to relax a frag is to look through
- - TC_GENERIC_RELAX_TABLE. */
- - growth = relax_frag (fragP, stretch);
- + /* The default way to relax a frag is to look through
- + TC_GENERIC_RELAX_TABLE. */
- + growth = relax_frag (fragP, stretch);
- #endif /* TC_GENERIC_RELAX_TABLE */
- #endif
- - break;
- -
- - case rs_leb128:
- - {
- - valueT value;
- - int size;
- -
- - value = resolve_symbol_value (fragP->fr_symbol, 0);
- - size = sizeof_leb128 (value, fragP->fr_subtype);
- - growth = size - fragP->fr_offset;
- - fragP->fr_offset = size;
- - }
- - break;
- -
- - case rs_cfa:
- - growth = eh_frame_relax_frag (fragP);
- - break;
- -
- - default:
- - BAD_CASE (fragP->fr_type);
- - break;
- - }
- - if (growth)
- - {
- - stretch += growth;
- - stretched++;
- - }
- - } /* For each frag in the segment. */
- + break;
- +
- + case rs_leb128:
- + {
- + valueT value;
- + int size;
- +
- + value = resolve_symbol_value (fragP->fr_symbol, 0);
- + size = sizeof_leb128 (value, fragP->fr_subtype);
- + growth = size - fragP->fr_offset;
- + fragP->fr_offset = size;
- + }
- + break;
- +
- + case rs_cfa:
- + growth = eh_frame_relax_frag (fragP);
- + break;
- +
- + default:
- + BAD_CASE (fragP->fr_type);
- + break;
- + }
- + if (growth)
- + {
- + stretch += growth;
- + stretched++;
- + }
- + } /* For each frag in the segment. */
- }
- - while (stretched); /* Until nothing further to relax. */
- - } /* do_relax */
- + while (stretched); /* Until nothing further to relax. */
- + } /* do_relax */
-
- /*
- * We now have valid fr_address'es for each frag.
- @@ -2391,7 +2400,7 @@ relax_segment (segment_frag_root, segment)
- * All fr_address's are correct, relative to their own segment.
- * We have made all the fixS we will ever make.
- */
- -} /* relax_segment() */
- +} /* relax_segment() */
-
- #if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
-
- @@ -2413,7 +2422,7 @@ relax_segment (segment_frag_root, segment)
- static long
- fixup_segment (fixP, this_segment_type)
- register fixS *fixP;
- - segT this_segment_type; /* N_TYPE bits for segment. */
- + segT this_segment_type; /* N_TYPE bits for segment. */
- {
- long seg_reloc_count = 0;
- symbolS *add_symbolP;
- @@ -2436,7 +2445,7 @@ fixup_segment (fixP, this_segment_type)
- if (linkrelax)
- {
- for (; fixP; fixP = fixP->fx_next)
- - seg_reloc_count++;
- + seg_reloc_count++;
- TC_ADJUST_RELOC_COUNT (fixP, seg_reloc_count);
- return seg_reloc_count;
- }
- @@ -2465,307 +2474,307 @@ fixup_segment (fixP, this_segment_type)
- plt = fixP->fx_plt;
-
- if (add_symbolP != NULL
- - && symbol_mri_common_p (add_symbolP))
- - {
- - know (add_symbolP->sy_value.X_op == O_symbol);
- - add_number += S_GET_VALUE (add_symbolP);
- - fixP->fx_offset = add_number;
- - add_symbolP = fixP->fx_addsy =
- - symbol_get_value_expression (add_symbolP)->X_add_symbol;
- - }
- + && symbol_mri_common_p (add_symbolP))
- + {
- + know (add_symbolP->sy_value.X_op == O_symbol);
- + add_number += S_GET_VALUE (add_symbolP);
- + fixP->fx_offset = add_number;
- + add_symbolP = fixP->fx_addsy =
- + symbol_get_value_expression (add_symbolP)->X_add_symbol;
- + }
-
- if (add_symbolP)
- - add_symbol_segment = S_GET_SEGMENT (add_symbolP);
- + add_symbol_segment = S_GET_SEGMENT (add_symbolP);
-
- if (sub_symbolP)
- - {
- - resolve_symbol_value (sub_symbolP, 1);
- - if (add_symbolP == NULL || add_symbol_segment == absolute_section)
- - {
- - if (add_symbolP != NULL)
- - {
- - add_number += S_GET_VALUE (add_symbolP);
- - add_symbolP = NULL;
- - fixP->fx_addsy = NULL;
- - }
- -
- - /* It's just -sym */
- - if (S_GET_SEGMENT (sub_symbolP) == absolute_section)
- - {
- - add_number -= S_GET_VALUE (sub_symbolP);
- - fixP->fx_subsy = NULL;
- - }
- - else if (pcrel
- - && S_GET_SEGMENT (sub_symbolP) == this_segment_type)
- - {
- - /* Should try converting to a constant. */
- - goto bad_sub_reloc;
- - }
- - else
- - bad_sub_reloc:
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("Negative of non-absolute symbol %s"),
- - S_GET_NAME (sub_symbolP));
- - }
- - else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment
- - && SEG_NORMAL (add_symbol_segment))
- - {
- - /* Difference of 2 symbols from same segment.
- - Can't make difference of 2 undefineds: 'value' means
- - something different for N_UNDF. */
- + {
- + resolve_symbol_value (sub_symbolP, 1);
- + if (add_symbolP == NULL || add_symbol_segment == absolute_section)
- + {
- + if (add_symbolP != NULL)
- + {
- + add_number += S_GET_VALUE (add_symbolP);
- + add_symbolP = NULL;
- + fixP->fx_addsy = NULL;
- + }
- +
- + /* It's just -sym */
- + if (S_GET_SEGMENT (sub_symbolP) == absolute_section)
- + {
- + add_number -= S_GET_VALUE (sub_symbolP);
- + fixP->fx_subsy = NULL;
- + }
- + else if (pcrel
- + && S_GET_SEGMENT (sub_symbolP) == this_segment_type)
- + {
- + /* Should try converting to a constant. */
- + goto bad_sub_reloc;
- + }
- + else
- + bad_sub_reloc:
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("Negative of non-absolute symbol %s"),
- + S_GET_NAME (sub_symbolP));
- + }
- + else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment
- + && SEG_NORMAL (add_symbol_segment))
- + {
- + /* Difference of 2 symbols from same segment.
- + Can't make difference of 2 undefineds: 'value' means
- + something different for N_UNDF. */
- #ifdef TC_I960
- - /* Makes no sense to use the difference of 2 arbitrary symbols
- - as the target of a call instruction. */
- - if (fixP->fx_tcbit)
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("callj to difference of 2 symbols"));
- + /* Makes no sense to use the difference of 2 arbitrary symbols
- + as the target of a call instruction. */
- + if (fixP->fx_tcbit)
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("callj to difference of 2 symbols"));
- #endif /* TC_I960 */
- - add_number += S_GET_VALUE (add_symbolP) -
- - S_GET_VALUE (sub_symbolP);
- -
- - add_symbolP = NULL;
- - pcrel = 0; /* No further pcrel processing. */
- -
- - /* Let the target machine make the final determination
- - as to whether or not a relocation will be needed to
- - handle this fixup. */
- - if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
- - {
- - fixP->fx_pcrel = 0;
- - fixP->fx_addsy = NULL;
- - fixP->fx_subsy = NULL;
- - }
- - }
- - else
- - {
- - /* Different segments in subtraction. */
- - know (!(S_IS_EXTERNAL (sub_symbolP)
- - && (S_GET_SEGMENT (sub_symbolP) == absolute_section)));
- -
- - if ((S_GET_SEGMENT (sub_symbolP) == absolute_section))
- - add_number -= S_GET_VALUE (sub_symbolP);
- + add_number += S_GET_VALUE (add_symbolP) -
- + S_GET_VALUE (sub_symbolP);
- +
- + add_symbolP = NULL;
- + pcrel = 0; /* No further pcrel processing. */
- +
- + /* Let the target machine make the final determination
- + as to whether or not a relocation will be needed to
- + handle this fixup. */
- + if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
- + {
- + fixP->fx_pcrel = 0;
- + fixP->fx_addsy = NULL;
- + fixP->fx_subsy = NULL;
- + }
- + }
- + else
- + {
- + /* Different segments in subtraction. */
- + know (!(S_IS_EXTERNAL (sub_symbolP)
- + && (S_GET_SEGMENT (sub_symbolP) == absolute_section)));
- +
- + if ((S_GET_SEGMENT (sub_symbolP) == absolute_section))
- + add_number -= S_GET_VALUE (sub_symbolP);
-
- #ifdef DIFF_EXPR_OK
- - else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type
- + else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type
- #if 0 /* Do this even if it's already described as pc-relative. For example,
- - on the m68k, an operand of "pc@(foo-.-2)" should address "foo" in a
- - pc-relative mode. */
- - && pcrel
- -#endif
- - )
- - {
- - /* Make it pc-relative. */
- - add_number += (MD_PCREL_FROM_SECTION (fixP, this_segment_type)
- - - S_GET_VALUE (sub_symbolP));
- - pcrel = 1;
- - fixP->fx_pcrel = 1;
- - sub_symbolP = 0;
- - fixP->fx_subsy = 0;
- - }
- + on the m68k, an operand of "pc@(foo-.-2)" should address "foo" in a
- + pc-relative mode. */
- + && pcrel
- +#endif
- + )
- + {
- + /* Make it pc-relative. */
- + add_number += (MD_PCREL_FROM_SECTION (fixP, this_segment_type)
- + - S_GET_VALUE (sub_symbolP));
- + pcrel = 1;
- + fixP->fx_pcrel = 1;
- + sub_symbolP = 0;
- + fixP->fx_subsy = 0;
- + }
- #endif
- #ifdef UNDEFINED_DIFFERENCE_OK
- - /* The PA needs this for PIC code generation. We basically
- - don't want to do anything if we have the difference of two
- - symbols at this point. */
- - else if (1)
- - {
- - /* Leave it alone. */
- - }
- + /* The PA needs this for PIC code generation. We basically
- + don't want to do anything if we have the difference of two
- + symbols at this point. */
- + else if (1)
- + {
- + /* Leave it alone. */
- + }
- #endif
- #ifdef BFD_ASSEMBLER
- - else if (fixP->fx_r_type == BFD_RELOC_GPREL32
- - || fixP->fx_r_type == BFD_RELOC_GPREL16)
- - {
- - /* Leave it alone. */
- - }
- -#endif
- - else
- - {
- - char buf[50];
- - sprint_value (buf, fragP->fr_address + where);
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("Subtraction of two symbols in different sections \"%s\" {%s section} - \"%s\" {%s section} at file address %s."),
- - S_GET_NAME (add_symbolP),
- - segment_name (S_GET_SEGMENT (add_symbolP)),
- - S_GET_NAME (sub_symbolP),
- - segment_name (S_GET_SEGMENT (sub_symbolP)),
- - buf);
- - }
- - }
- - }
- + else if (fixP->fx_r_type == BFD_RELOC_GPREL32
- + || fixP->fx_r_type == BFD_RELOC_GPREL16)
- + {
- + /* Leave it alone. */
- + }
- +#endif
- + else
- + {
- + char buf[50];
- + sprint_value (buf, fragP->fr_address + where);
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("Subtraction of two symbols in different sections \"%s\" {%s section} - \"%s\" {%s section} at file address %s."),
- + S_GET_NAME (add_symbolP),
- + segment_name (S_GET_SEGMENT (add_symbolP)),
- + S_GET_NAME (sub_symbolP),
- + segment_name (S_GET_SEGMENT (sub_symbolP)),
- + buf);
- + }
- + }
- + }
-
- if (add_symbolP)
- - {
- - if (add_symbol_segment == this_segment_type && pcrel && !plt
- - && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
- - {
- - /*
- - * This fixup was made when the symbol's segment was
- - * SEG_UNKNOWN, but it is now in the local segment.
- - * So we know how to do the address without relocation.
- - */
- + {
- + if (add_symbol_segment == this_segment_type && pcrel && !plt
- + && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
- + {
- + /*
- + * This fixup was made when the symbol's segment was
- + * SEG_UNKNOWN, but it is now in the local segment.
- + * So we know how to do the address without relocation.
- + */
- #ifdef TC_I960
- - /* reloc_callj() may replace a 'call' with a 'calls' or a
- - 'bal', in which cases it modifies *fixP as appropriate.
- - In the case of a 'calls', no further work is required,
- - and *fixP has been set up to make the rest of the code
- - below a no-op. */
- - reloc_callj (fixP);
- + /* reloc_callj() may replace a 'call' with a 'calls' or a
- + 'bal', in which cases it modifies *fixP as appropriate.
- + In the case of a 'calls', no further work is required,
- + and *fixP has been set up to make the rest of the code
- + below a no-op. */
- + reloc_callj (fixP);
- #endif /* TC_I960 */
-
- - add_number += S_GET_VALUE (add_symbolP);
- - add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
- - pcrel = 0; /* Lie. Don't want further pcrel processing. */
- -
- - /* Let the target machine make the final determination
- - as to whether or not a relocation will be needed to
- - handle this fixup. */
- - if (!TC_FORCE_RELOCATION (fixP))
- - {
- - fixP->fx_pcrel = 0;
- - fixP->fx_addsy = NULL;
- - }
- - }
- - else
- - {
- - if (add_symbol_segment == absolute_section
- - && ! pcrel)
- - {
- + add_number += S_GET_VALUE (add_symbolP);
- + add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
- + pcrel = 0; /* Lie. Don't want further pcrel processing. */
- +
- + /* Let the target machine make the final determination
- + as to whether or not a relocation will be needed to
- + handle this fixup. */
- + if (!TC_FORCE_RELOCATION (fixP))
- + {
- + fixP->fx_pcrel = 0;
- + fixP->fx_addsy = NULL;
- + }
- + }
- + else
- + {
- + if (add_symbol_segment == absolute_section
- + && ! pcrel)
- + {
- #ifdef TC_I960
- - /* See comment about reloc_callj() above. */
- - reloc_callj (fixP);
- + /* See comment about reloc_callj() above. */
- + reloc_callj (fixP);
- #endif /* TC_I960 */
- - add_number += S_GET_VALUE (add_symbolP);
- -
- - /* Let the target machine make the final determination
- - as to whether or not a relocation will be needed to
- - handle this fixup. */
- -
- - if (!TC_FORCE_RELOCATION (fixP))
- - {
- - fixP->fx_addsy = NULL;
- - add_symbolP = NULL;
- - }
- - }
- - else if (add_symbol_segment == undefined_section
- + add_number += S_GET_VALUE (add_symbolP);
- +
- + /* Let the target machine make the final determination
- + as to whether or not a relocation will be needed to
- + handle this fixup. */
- +
- + if (!TC_FORCE_RELOCATION (fixP))
- + {
- + fixP->fx_addsy = NULL;
- + add_symbolP = NULL;
- + }
- + }
- + else if (add_symbol_segment == undefined_section
- #ifdef BFD_ASSEMBLER
- - || bfd_is_com_section (add_symbol_segment)
- + || bfd_is_com_section (add_symbol_segment)
- #endif
- - )
- - {
- + )
- + {
- #ifdef TC_I960
- - if ((int) fixP->fx_bit_fixP == 13)
- - {
- - /* This is a COBR instruction. They have only a
- - * 13-bit displacement and are only to be used
- - * for local branches: flag as error, don't generate
- - * relocation.
- - */
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("can't use COBR format with external label"));
- - fixP->fx_addsy = NULL;
- - fixP->fx_done = 1;
- - continue;
- - } /* COBR */
- + if ((int) fixP->fx_bit_fixP == 13)
- + {
- + /* This is a COBR instruction. They have only a
- + * 13-bit displacement and are only to be used
- + * for local branches: flag as error, don't generate
- + * relocation.
- + */
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("can't use COBR format with external label"));
- + fixP->fx_addsy = NULL;
- + fixP->fx_done = 1;
- + continue;
- + } /* COBR */
- #endif /* TC_I960 */
-
- #ifdef OBJ_COFF
- #ifdef TE_I386AIX
- - if (S_IS_COMMON (add_symbolP))
- - add_number += S_GET_VALUE (add_symbolP);
- + if (S_IS_COMMON (add_symbolP))
- + add_number += S_GET_VALUE (add_symbolP);
- #endif /* TE_I386AIX */
- #endif /* OBJ_COFF */
- - ++seg_reloc_count;
- - }
- - else
- - {
- - seg_reloc_count++;
- + ++seg_reloc_count;
- + }
- + else
- + {
- + seg_reloc_count++;
- #if !(defined (TC_V850) && defined (OBJ_ELF))
- #if !(defined (TC_M68K) && defined (OBJ_ELF))
- #if !(defined (TC_ARM) && defined (OBJ_ELF))
- #if !(defined (TC_I960) && defined (OBJ_ELF))
- #if !defined (TC_I386) || !(defined (OBJ_ELF) || defined (OBJ_COFF)) || defined (TE_PE)
- - add_number += S_GET_VALUE (add_symbolP);
- + add_number += S_GET_VALUE (add_symbolP);
- #endif
- #endif
- #endif
- #endif
- #endif
- - }
- - }
- - }
- + }
- + }
- + }
-
- if (pcrel)
- - {
- - add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
- - if (add_symbolP == 0)
- - {
- + {
- + add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
- + if (add_symbolP == 0)
- + {
- #ifndef BFD_ASSEMBLER
- - fixP->fx_addsy = &abs_symbol;
- + fixP->fx_addsy = &abs_symbol;
- #else
- - fixP->fx_addsy = section_symbol (absolute_section);
- + fixP->fx_addsy = section_symbol (absolute_section);
- #endif
- - symbol_mark_used_in_reloc (fixP->fx_addsy);
- - ++seg_reloc_count;
- - }
- - }
- + symbol_mark_used_in_reloc (fixP->fx_addsy);
- + ++seg_reloc_count;
- + }
- + }
-
- if (!fixP->fx_done)
- - {
- + {
- #ifdef MD_APPLY_FIX3
- - md_apply_fix3 (fixP, &add_number, this_segment_type);
- + md_apply_fix3 (fixP, &add_number, this_segment_type);
- #else
- #ifdef BFD_ASSEMBLER
- - md_apply_fix (fixP, &add_number);
- + md_apply_fix (fixP, &add_number);
- #else
- - md_apply_fix (fixP, add_number);
- + md_apply_fix (fixP, add_number);
- #endif
- #endif
-
- #ifndef TC_HANDLES_FX_DONE
- - /* If the tc-* files haven't been converted, assume it's handling
- - it the old way, where a null fx_addsy means that the fix has
- - been applied completely, and no further work is needed. */
- - if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
- - fixP->fx_done = 1;
- + /* If the tc-* files haven't been converted, assume it's handling
- + it the old way, where a null fx_addsy means that the fix has
- + been applied completely, and no further work is needed. */
- + if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
- + fixP->fx_done = 1;
- #endif
- - }
- + }
-
- if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
- - {
- - if ((size_t) size < sizeof (valueT))
- - {
- - valueT mask;
- -
- - mask = 0;
- - mask--; /* set all bits to one */
- - mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
- - if ((add_number & mask) != 0 && (add_number & mask) != mask)
- - {
- - char buf[50], buf2[50];
- - sprint_value (buf, fragP->fr_address + where);
- - if (add_number > 1000)
- - sprint_value (buf2, add_number);
- - else
- - sprintf (buf2, "%ld", (long) add_number);
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("Value of %s too large for field of %d bytes at %s"),
- - buf2, size, buf);
- - } /* generic error checking */
- - }
- + {
- + if ((size_t) size < sizeof (valueT))
- + {
- + valueT mask;
- +
- + mask = 0;
- + mask--; /* set all bits to one */
- + mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
- + if ((add_number & mask) != 0 && (add_number & mask) != mask)
- + {
- + char buf[50], buf2[50];
- + sprint_value (buf, fragP->fr_address + where);
- + if (add_number > 1000)
- + sprint_value (buf2, add_number);
- + else
- + sprintf (buf2, "%ld", (long) add_number);
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("Value of %s too large for field of %d bytes at %s"),
- + buf2, size, buf);
- + } /* generic error checking */
- + }
- #ifdef WARN_SIGNED_OVERFLOW_WORD
- - /* Warn if a .word value is too large when treated as a signed
- - number. We already know it is not too negative. This is to
- - catch over-large switches generated by gcc on the 68k. */
- - if (!flag_signed_overflow_ok
- - && size == 2
- - && add_number > 0x7fff)
- - as_bad_where (fixP->fx_file, fixP->fx_line,
- - _("Signed .word overflow; switch may be too large; %ld at 0x%lx"),
- - (long) add_number,
- - (unsigned long) (fragP->fr_address + where));
- -#endif
- - } /* not a bit fix */
- + /* Warn if a .word value is too large when treated as a signed
- + number. We already know it is not too negative. This is to
- + catch over-large switches generated by gcc on the 68k. */
- + if (!flag_signed_overflow_ok
- + && size == 2
- + && add_number > 0x7fff)
- + as_bad_where (fixP->fx_file, fixP->fx_line,
- + _("Signed .word overflow; switch may be too large; %ld at 0x%lx"),
- + (long) add_number,
- + (unsigned long) (fragP->fr_address + where));
- +#endif
- + } /* not a bit fix */
-
- #ifdef TC_VALIDATE_FIX
- skip: ATTRIBUTE_UNUSED_LABEL
- @@ -2775,7 +2784,7 @@ fixup_segment (fixP, this_segment_type)
- fprintf (stderr, "result:\n");
- print_fixup (fixP);
- #endif
- - } /* For each fixS in this segment. */
- + } /* For each fixS in this segment. */
-
- TC_ADJUST_RELOC_COUNT (fixP, seg_reloc_count);
- return seg_reloc_count;
- @@ -2846,11 +2855,11 @@ print_fixup (fixp)
- if (fixp->fx_done)
- fprintf (stderr, " done");
- fprintf (stderr, "\n size=%d frag=%lx where=%ld offset=%lx addnumber=%lx",
- - fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
- - (long) fixp->fx_offset, (long) fixp->fx_addnumber);
- + fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
- + (long) fixp->fx_offset, (long) fixp->fx_addnumber);
- #ifdef BFD_ASSEMBLER
- fprintf (stderr, "\n %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_type),
- - fixp->fx_r_type);
- + fixp->fx_r_type);
- #else
- #ifdef NEED_FX_R_TYPE
- fprintf (stderr, " r_type=%d", fixp->fx_r_type);
- diff --git a/include/dis-asm.h b/include/dis-asm.h
- index 6e6c04b..6ca65a7 100644
- --- a/include/dis-asm.h
- +++ b/include/dis-asm.h
- @@ -196,6 +196,10 @@ extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*));
- extern int print_insn_pj PARAMS ((bfd_vma, disassemble_info*));
- extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*));
-
- +/* 追加 2001.1.15 ide */
- +extern int print_insn_c33 PARAMS ((bfd_vma, disassemble_info*));
- +
- +
- extern void print_arm_disassembler_options PARAMS ((FILE *));
- extern void parse_arm_disassembler_option PARAMS ((char *));
- extern int get_arm_regname_num_options PARAMS ((void));
- diff --git a/include/elf/c33.h b/include/elf/c33.h
- new file mode 100644
- index 0000000..ccb410f
- --- /dev/null
- +++ b/include/elf/c33.h
- @@ -0,0 +1,128 @@
- +/* C33 ELF support for BFD.
- + Copyright (C) 1997,2001 Free Software Foundation, Inc.
- + Created by Michael Meissner, Cygnus Support <meissner@cygnus.com>
- +
- +This file is part of BFD, the Binary File Descriptor library.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +/* This file holds definitions specific to the MIPS ELF ABI. Note
- + that most of this is not actually implemented by BFD. */
- +
- +#ifndef _ELF_C33_H
- +#define _ELF_C33_H
- +
- +/* Processor specific flags for the ELF header e_flags field. */
- +#if 0 /* c33 */
- +/* これらはbinutils\readelf.cで使用している */
- +/* get_machine_flags()でELFヘッダのe_flagsによって、アーキテクチャの文字列を */
- +/* 設定している。c33の場合はどうしたらいいか? */
- +
- +/* Four bit C33 architecture field. */
- +#define EF_V850_ARCH 0xf0000000
- +
- +/* v850 code. */
- +#define E_V850_ARCH 0x00000000
- +
- +/* v850e code. */
- +#define E_V850E_ARCH 0x10000000
- +
- +/* v850ea code. */
- +#define E_V850EA_ARCH 0x20000000
- +#endif /* c33 */
- +
- +
- +/* Flags for the st_other field */
- +#define V850_OTHER_SDA 0x01 /* symbol had SDA relocations */
- +#define V850_OTHER_ZDA 0x02 /* symbol had ZDA relocations */
- +#define V850_OTHER_TDA 0x04 /* symbol had TDA relocations */
- +#define V850_OTHER_TDA_BYTE 0x08 /* symbol had TDA byte relocations */
- +#define V850_OTHER_ERROR 0x80 /* symbol had an error reported */
- +
- +/* C33 relocations */
- +#include "elf/reloc-macros.h"
- +
- +START_RELOC_NUMBERS (c33_reloc_type)
- + RELOC_NUMBER (R_C33_NONE, 0)
- + RELOC_NUMBER (R_C33_32, 1)
- + RELOC_NUMBER (R_C33_16, 2)
- + RELOC_NUMBER (R_C33_8, 3)
- + RELOC_NUMBER (R_C33_AH, 4)
- + RELOC_NUMBER (R_C33_AL, 5)
- + RELOC_NUMBER (R_C33_RH, 6)
- + RELOC_NUMBER (R_C33_RM, 7)
- + RELOC_NUMBER (R_C33_RL, 8)
- + RELOC_NUMBER (R_C33_H, 9)
- + RELOC_NUMBER (R_C33_M, 10)
- + RELOC_NUMBER (R_C33_L, 11)
- + RELOC_NUMBER (R_C33_DH, 12) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_DL, 13) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_GL, 14) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_SH, 15) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_SL, 16) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_TH, 17) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_TL, 18) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_ZH, 19) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_ZL, 20) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_DPH,21) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_DPM,22) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_DPL,23) /* add tazaki 2002.01.11 */
- + RELOC_NUMBER (R_C33_LOOP,24) /* add tazaki 2002.03.05 */
- + RELOC_NUMBER (R_C33_JP, 25) /* add tazaki 2002.04.22 */
- + RELOC_NUMBER (R_C33_S_RH, 26) /* add tazaki 2002.05.02 */
- + RELOC_NUMBER (R_C33_S_RM, 27) /* add tazaki 2002.05.02 */
- + RELOC_NUMBER (R_C33_S_RL, 28) /* add tazaki 2002.05.02 */
- + RELOC_NUMBER (R_C33_PUSHN_R0,29) /* add tazaki 2004/08/19 */
- + RELOC_NUMBER (R_C33_PUSHN_R1,30) /* add tazaki 2004/08/19 */
- + RELOC_NUMBER (R_C33_PUSH_R1,31) /* add tazaki 2004/08/19 */
- +
- + EMPTY_RELOC (R_C33_max)
- +END_RELOC_NUMBERS
- +
- +
- +/* Processor specific section indices. These sections do not actually
- + exist. Symbols with a st_shndx field corresponding to one of these
- + values have a special meaning. */
- +
- +/* Small data area common symbol. */
- +#define SHN_C33_COMM 0xff00
- +#define SHN_C33_GCOMM 0xff01
- +#define SHN_C33_SCOMM 0xff02
- +#define SHN_C33_TCOMM 0xff03
- +#define SHN_C33_ZCOMM 0xff04
- +#define SHN_C33_GBSS 0xff05
- +#define SHN_C33_SBSS 0xff06
- +#define SHN_C33_TBSS 0xff07
- +#define SHN_C33_ZBSS 0xff08
- +
- +
- +/* Processor specific section types. */
- +
- +/* Section contains the .scommon data. */
- +#define SHT_C33_COMM 0x70000000
- +#define SHT_C33_GCOMM 0x70000001
- +#define SHT_C33_SCOMM 0x70000002
- +#define SHT_C33_TCOMM 0x70000003
- +#define SHT_C33_ZCOMM 0x70000004
- +#define SHT_C33_GBSS 0x70000005
- +#define SHT_C33_SBSS 0x70000006
- +#define SHT_C33_TBSS 0x70000007
- +#define SHT_C33_ZBSS 0x70000008
- +
- +
- +
- +#endif /* _ELF_C33_H */
- +
- +
- diff --git a/include/elf/common.h b/include/elf/common.h
- index b290853..5b8c585 100644
- --- a/include/elf/common.h
- +++ b/include/elf/common.h
- @@ -202,6 +202,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- Written in the absense of an ABI. */
- #define EM_AVR 0x1057
-
- +/* C33 magic number */
- +#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor */
- +
- +/* C17 magic number */
- +#define EM_SE_C17 139 /* C17 Family of Seiko Epson processor */
- +
- /* See the above comment before you add a new EM_* value here. */
-
- /* Values for e_version */
- diff --git a/include/opcode/c33.h b/include/opcode/c33.h
- new file mode 100644
- index 0000000..6d48650
- --- /dev/null
- +++ b/include/opcode/c33.h
- @@ -0,0 +1,205 @@
- +/* c33.h -- Header file for EPSON C33 opcode table
- + Copyright 1996 Free Software Foundation, Inc.
- + Written by J.T. Conklin, Cygnus Support
- +
- +This file is part of GDB, GAS, and the GNU binutils.
- +
- +GDB, GAS, and the GNU binutils are free software; you can redistribute
- +them and/or modify them under the terms of the GNU General Public
- +License as published by the Free Software Foundation; either version
- +1, or (at your option) any later version.
- +
- +GDB, GAS, and the GNU binutils are distributed in the hope that they
- +will be useful, but WITHOUT ANY WARRANTY; without even the implied
- +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- +the GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this file; see the file COPYING. If not, write to the Free
- +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +#ifndef V850_H
- +#define V850_H
- +
- +/* The opcode table is an array of struct c33_opcode. */
- +
- +struct c33_opcode
- +{
- + /* The opcode name. */
- + const char *name;
- +
- + /* The opcode itself. Those bits which will be filled in with
- + operands are zeroes. */
- + unsigned long opcode;
- +
- + /* The opcode mask. This is used by the disassembler. This is a
- + mask containing ones indicating those bits which must match the
- + opcode field, and zeroes indicating those bits which need not
- + match (and are presumably filled in by operands). */
- + unsigned long mask;
- +
- + /* An array of operand codes. Each code is an index into the
- + operand table. They appear in the order which the operands must
- + appear in assembly code, and are terminated by a zero. */
- + unsigned char operands[8];
- +
- + /* Which (if any) operand is a memory operand. */
- + unsigned int memop;
- +
- + /* special flag */
- + /* 0: special process none */
- + /* 1: [sp+imm32] byte (1byte) */
- + /* 2: [sp+imm32] half word (2byte) */
- + /* 4: [sp+imm32] word(4byte) */
- + /* 5:shift/lotate */
- + unsigned int specialFlag;
- +};
- +
- +#if 0 /* c33 */
- +/* Values for the processors field in the c33_opcode structure. */
- +#define PROCESSOR_V850 (1 << 0) /* Just the V850. */
- +#define PROCESSOR_ALL -1 /* Any processor. */
- +#define PROCESSOR_V850E (1 << 1) /* Just the V850E. */
- +#define PROCESSOR_NOT_V850 (~ PROCESSOR_V850) /* Any processor except the V850. */
- +#define PROCESSOR_V850EA (1 << 2) /* Just the V850EA. */
- +#endif /* c33 */
- +
- +/* The table itself is sorted by major opcode number, and is otherwise
- + in the order in which the disassembler should consider
- + instructions. */
- +extern const struct c33_opcode c33_opcodes[];
- +
- +/* add tazaki 2001.11.07 */
- +extern int g_iAdvance;
- +extern const struct c33_opcode c33_advance_opcodes[];
- +/* add tazaki 2001.09.19 */
- +extern const struct c33_opcode c33_ext_opcodes[];
- +/* add tazaki 2001.09.19 */
- +extern const int c33_num_opcodes;
- +
- +/* add T.Tazaki 2003/11/18 >>> */
- +extern int g_iPE;
- +extern const struct c33_opcode c33_pe_opcodes[];
- +/* add T.Tazaki 2003/11/18 <<< */
- +
- +/* add T.Tazaki 2004/07/30 >>> */
- +extern int g_iMedda32;
- +extern const struct c33_opcode c33_opcodes32[];
- +extern const struct c33_opcode c33_advance_opcodes32[];
- +extern const struct c33_opcode c33_pe_opcodes32[];
- +/* add T.Tazaki 2004/07/30 <<< */
- +
- +
- +
- +/* The operands table is an array of struct c33_operand. */
- +
- +struct c33_operand
- +{
- + /* The number of bits in the operand. */
- + /* If this value is -1 then the operand's bits are in a discontinous distribution in the instruction. */
- + int bits;
- +
- + /* (bits >= 0): How far the operand is left shifted in the instruction. */
- + /* (bits == -1): Bit mask of the bits in the operand. */
- + int shift;
- +
- + /* Insertion function. This is used by the assembler. To insert an
- + operand value into an instruction, check this field.
- +
- + If it is NULL, execute
- + i |= (op & ((1 << o->bits) - 1)) << o->shift;
- + (i is the instruction which we are filling in, o is a pointer to
- + this structure, and op is the opcode value; this assumes twos
- + complement arithmetic).
- +
- + If this field is not NULL, then simply call it with the
- + instruction and the operand value. It will return the new value
- + of the instruction. If the ERRMSG argument is not NULL, then if
- + the operand value is illegal, *ERRMSG will be set to a warning
- + string (the operand will be inserted in any case). If the
- + operand value is legal, *ERRMSG will be unchanged (most operands
- + can accept any value). */
- + unsigned long (* insert) PARAMS ((unsigned long instruction, long op,
- + const char ** errmsg));
- +
- + /* Extraction function. This is used by the disassembler. To
- + extract this operand type from an instruction, check this field.
- +
- + If it is NULL, compute
- + op = o->bits == -1 ? ((i) & o->shift) : ((i) >> o->shift) & ((1 << o->bits) - 1);
- + if (o->flags & V850_OPERAND_SIGNED)
- + op = (op << (32 - o->bits)) >> (32 - o->bits);
- + (i is the instruction, o is a pointer to this structure, and op
- + is the result; this assumes twos complement arithmetic).
- +
- + If this field is not NULL, then simply call it with the
- + instruction value. It will return the value of the operand. If
- + the INVALID argument is not NULL, *INVALID will be set to
- + non-zero if this operand type can not actually be extracted from
- + this operand (i.e., the instruction does not match). If the
- + operand is valid, *INVALID will not be changed. */
- + unsigned long (* extract) PARAMS ((unsigned long instruction, int * invalid));
- +
- + /* One bit syntax flags. */
- + int flags;
- +
- + /* 有効範囲 imm6/sign8/imm13/imm26など
- + 例えば、xld.w [symbol+imm26]の有効範囲は26bit
- + sld.w [symbol+imm13]の有効範囲は13bitとなる
- + */
- + int range;
- +};
- +
- +/* Elements in the table are retrieved by indexing with values from
- + the operands field of the c33_opcodes table. */
- +
- +extern const struct c33_operand c33_operands[];
- +
- +/* Values defined for the flags field of a struct c33_operand. */
- +
- +/* This operand names a general purpose register */
- +#define C33_OPERAND_REG 0x01
- +#define C33_OPERAND_SREG 0x02 /* special registers */
- +#define C33_OPERAND_IMM 0x04
- +#define C33_OPERAND_SIGNED 0x08
- +#define C33_OPERAND_MEM 0x10 /* [symbol+imm32] */
- +#define C33_OPERAND_SPMEM 0x20 /* [%sp+imm6] */
- +#define C33_OPERAND_REGINC 0x40 /* [%rb]+ */
- +#define C33_OPERAND_SP 0x80
- +#define C33_OPERAND_LABEL 0x100 /* label+imm32 */
- +#define C33_OPERAND_RB 0x200 /* [%rb] , [%rb+imm]*/
- +#define C33_OPERAND_SYMBOL 0x400 /* symbol+imm32 */
- +#define C33_OPERAND_PC 0x800 /* jp sign8(8:1) sign(0) = 0 */
- +/* >>> add tazaki 2002.06.19 */
- +#define C33_OPERAND_OFFSET_SYMBOL 0x1000 /* ext doff_hi(symbol),doff_li(symbol), etc... */
- +#define C33_OPERAND_01 0x2000 /* Advanced Inst : class0 bit5,4 = ( 0,1 ) */
- +#define C33_OPERAND_OP3_01 0x4000 /* Advanced Inst : class5 bit7,6 = ( 0,1 ) */
- +#define C33_OPERAND_OP3_10 0x8000 /* Advanced Inst : class5 bit7,6 = ( 1,0 ) */
- +#define C33_OPERAND_DPMEM 0x0003 /* Advanced Inst : [%dp+imm6] */
- +#define C33_OPERAND_DP 0x0070 /* Advanced Inst : %dp */
- +#define C33_OPERAND_DP_SYMBOL 0xc000 /* Advanced Inst : [symbol+imm] */
- +#define C33_OPERAND_DPSYMBOL6 0x3000 /* Advanced Inst : [%dp+dpoff_l(symbol)] */
- +#define C33_OPERAND_DPSYMBOL6_2 0x1800 /* Advanced Inst : [%dp+dpoff_l(symbol)] */
- +#define C33_OPERAND_COND 0x1400 /* Advanced Inst : ext cond */
- +#define C33_OPERAND_OP_SHIFT 0x1200 /* Advanced Inst : ext OP,imm2 | ext %rb,OP,imm2 */
- +#define C33_OPERAND_LD_SREG 0x10000 /* Advanced Inst : ld.w %sd,%rs */
- +#define C33_OPERAND_PUSHS_SREG 0x20000 /* special registers : pushs , pops */
- +/* <<< add tazaki 2002.06.19 */
- +
- +/* add T.Tazaki 2004/07/23 >>> */
- +#define C33_XLDB_RD 0x40000 /* xld.b %rd,[symbol+imm] */
- +#define C33_XLDB_WR 0x80000 /* xld.b [symbol+imm],%rs */
- +#define C33_XLDH_RD 0x100000 /* xld.h %rd,[symbol+imm] */
- +#define C33_XLDH_WR 0x200000 /* xld.h [symbol+imm],%rs */
- +#define C33_XLDW_RD 0x400000 /* xld.w %rd,[symbol+imm] */
- +#define C33_XLDW_WR 0x800000 /* xld.w [symbol+imm],%rs */
- +#define C33_XLDUB_RD 0x1000000 /* xld.ub %rd,[symbol+imm] */
- +#define C33_XLDUH_RD 0x2000000 /* xld.uh %rd, [symbol+imm] */
- +#define C33_XBTST 0x4000000 /* xbtst [symbol+imm],imm3 */
- +#define C33_XBCLR 0x8000000 /* xbclr [symbol+imm],imm3 */
- +#define C33_XBSET 0x10000000 /* xbset [symbol+imm],imm3 */
- +#define C33_XBNOT 0x20000000 /* xbnot [symbol+imm],imm3 */
- +#define C33_OPERAND_26 0x40000000 /* [%rb+imm26] */
- +/* add T.Tazaki 2004/07/23 <<< */
- +
- +#endif /* C33 */
- diff --git a/ld/Makefile.am b/ld/Makefile.am
- index 0abc9b5..be1fd41 100644
- --- a/ld/Makefile.am
- +++ b/ld/Makefile.am
- @@ -678,6 +678,9 @@ evsta.c: $(srcdir)/emulparams/vsta.sh \
- ev850.c: $(srcdir)/emulparams/v850.sh \
- $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS}
- ${GENSCRIPTS} v850 "$(tdir_v850)"
- +ec33.c: $(srcdir)/emulparams/c33.sh \
- + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/c33.sc ${GEN_DEPENDS}
- + ${GENSCRIPTS} c33 "$(tdir_c33)"
- ew65.c: $(srcdir)/emulparams/w65.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
- ${GENSCRIPTS} w65 "$(tdir_w65)"
- diff --git a/ld/Makefile.in b/ld/Makefile.in
- index 0fa39ae..5651574 100644
- --- a/ld/Makefile.in
- +++ b/ld/Makefile.in
- @@ -1377,6 +1377,9 @@ evsta.c: $(srcdir)/emulparams/vsta.sh \
- ev850.c: $(srcdir)/emulparams/v850.sh \
- $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS}
- ${GENSCRIPTS} v850 "$(tdir_v850)"
- +ec33.c: $(srcdir)/emulparams/c33.sh \
- + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/c33.sc ${GEN_DEPENDS}
- + ${GENSCRIPTS} c33 "$(tdir_c33)"
- ew65.c: $(srcdir)/emulparams/w65.sh \
- $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
- ${GENSCRIPTS} w65 "$(tdir_w65)"
- diff --git a/ld/configure.tgt b/ld/configure.tgt
- index c22eee7..89eee7d 100644
- --- a/ld/configure.tgt
- +++ b/ld/configure.tgt
- @@ -287,6 +287,7 @@ rs6000-*-aix*) targ_emul=aixrs6 ;;
- tic30-*-*aout*) targ_emul=tic30aout ;;
- tic30-*-*coff*) targ_emul=tic30coff ;;
- tic80-*-*) targ_emul=tic80coff ;;
- +c33-*-*) targ_emul=c33 ;;
- v850-*-*) targ_emul=v850 ;;
- v850e-*-*) targ_emul=v850 ;;
- v850ea-*-*) targ_emul=v850 ;;
- diff --git a/ld/emulparams/c33.sh b/ld/emulparams/c33.sh
- new file mode 100644
- index 0000000..fe0146e
- --- /dev/null
- +++ b/ld/emulparams/c33.sh
- @@ -0,0 +1,10 @@
- +MACHINE=
- +SCRIPT_NAME=c33
- +OUTPUT_FORMAT="elf32-c33"
- +TEXT_START_ADDR=0xc00000
- +SDATA_START_ADDR="ALIGN (4)"
- +ARCH=c33
- +MAXPAGESIZE=256
- +ENTRY=_start
- +EMBEDDED=yes
- +TEMPLATE_NAME=c33
- diff --git a/ld/emultempl/c33.em b/ld/emultempl/c33.em
- new file mode 100644
- index 0000000..6635e09
- --- /dev/null
- +++ b/ld/emultempl/c33.em
- @@ -0,0 +1,128 @@
- +# This shell script emits a C file. -*- C -*-
- +# It does some substitutions.
- +cat >e${EMULATION_NAME}.c <<EOF
- +/* This file is is generated by a shell script. DO NOT EDIT! */
- +
- +/* emulate the original gld for the given ${EMULATION_NAME}
- + Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
- + Written by Steve Chamberlain steve@cygnus.com
- +
- +This file is part of GLD, the Gnu Linker.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +#define TARGET_IS_${EMULATION_NAME}
- +
- +#include "bfd.h"
- +#include "sysdep.h"
- +#include "bfdlink.h"
- +
- +#include "ld.h"
- +#include "ldmain.h"
- +#include "ldemul.h"
- +#include "ldfile.h"
- +#include "ldmisc.h"
- +
- +static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
- +static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
- +
- +static void
- +gld${EMULATION_NAME}_before_parse()
- +{
- +#ifndef TARGET_ /* I.e., if not generic. */
- + ldfile_set_output_arch ("`echo ${ARCH}`");
- +#endif /* not TARGET_ */
- +}
- +
- +static char *
- +gld${EMULATION_NAME}_get_script(isfile)
- + int *isfile;
- +EOF
- +
- +if test -n "$COMPILE_IN"
- +then
- +# Scripts compiled in.
- +
- +# sed commands to quote an ld script as a C string.
- +sc="-f stringify.sed"
- +
- +cat >>e${EMULATION_NAME}.c <<EOF
- +{
- + *isfile = 0;
- +
- + if (link_info.relocateable == true && config.build_constructors == true)
- + return
- +EOF
- +sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
- +echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
- +sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
- +echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
- +sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
- +echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
- +sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
- +echo ' ; else return' >> e${EMULATION_NAME}.c
- +sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
- +echo '; }' >> e${EMULATION_NAME}.c
- +
- +else
- +# Scripts read from the filesystem.
- +
- +cat >>e${EMULATION_NAME}.c <<EOF
- +{
- + *isfile = 1;
- +
- + if (link_info.relocateable == true && config.build_constructors == true)
- + return "ldscripts/${EMULATION_NAME}.xu";
- + else if (link_info.relocateable == true)
- + return "ldscripts/${EMULATION_NAME}.xr";
- + else if (!config.text_read_only)
- + return "ldscripts/${EMULATION_NAME}.xbn";
- + else if (!config.magic_demand_paged)
- + return "ldscripts/${EMULATION_NAME}.xn";
- + else
- + return "ldscripts/${EMULATION_NAME}.x";
- +}
- +EOF
- +
- +fi
- +
- +cat >>e${EMULATION_NAME}.c <<EOF
- +
- +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
- +{
- + gld${EMULATION_NAME}_before_parse,
- + syslib_default,
- + hll_default,
- + after_parse_default,
- + after_open_default,
- + after_allocation_default,
- + set_output_arch_default,
- + ldemul_default_target,
- + before_allocation_default,
- + gld${EMULATION_NAME}_get_script,
- + "${EMULATION_NAME}",
- + "${OUTPUT_FORMAT}",
- + NULL, /* finish */
- + NULL, /* create output section statements */
- + NULL, /* open dynamic archive */
- + NULL, /* place orphan */
- + NULL, /* set symbols */
- + NULL, /* parse args */
- + NULL, /* unrecognized file */
- + NULL, /* list options */
- + NULL, /* recognized file */
- + NULL /* find_potential_libraries */
- +};
- +EOF
- diff --git a/ld/ldlang.c b/ld/ldlang.c
- index 8f0c607..79ca963 100644
- --- a/ld/ldlang.c
- +++ b/ld/ldlang.c
- @@ -42,8 +42,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-
- /* FORWARDS */
- static lang_statement_union_type *new_statement PARAMS ((enum statement_enum,
- - size_t,
- - lang_statement_list_type*));
- + size_t,
- + lang_statement_list_type*));
-
-
- /* LOCALS */
- @@ -65,29 +65,29 @@ static struct lang_phdr *lang_phdr_list;
-
- static void lang_for_each_statement_worker
- PARAMS ((void (*func) (lang_statement_union_type *),
- - lang_statement_union_type *s));
- + lang_statement_union_type *s));
- static lang_input_statement_type *new_afile
- PARAMS ((const char *name, lang_input_file_enum_type file_type,
- - const char *target, boolean add_to_list));
- + const char *target, boolean add_to_list));
- static void init_os PARAMS ((lang_output_section_statement_type *s));
- static void exp_init_os PARAMS ((etree_type *));
- static void section_already_linked PARAMS ((bfd *, asection *, PTR));
- static struct bfd_hash_entry *already_linked_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
- - const char *string));
- + const char *string));
- static void already_linked_table_init PARAMS ((void));
- static void already_linked_table_free PARAMS ((void));
- static boolean wildcardp PARAMS ((const char *));
- static lang_statement_union_type *wild_sort
- PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
- - asection *));
- + asection *));
- static lang_input_statement_type *lookup_name PARAMS ((const char *name));
- static void load_symbols PARAMS ((lang_input_statement_type *entry,
- - lang_statement_list_type *));
- + lang_statement_list_type *));
- static void wild PARAMS ((lang_wild_statement_type *s,
- - const char *section, const char *file,
- - const char *target,
- - lang_output_section_statement_type *output));
- + const char *section, const char *file,
- + const char *target,
- + lang_output_section_statement_type *output));
- static bfd *open_output PARAMS ((const char *name));
- static void ldlang_open_output PARAMS ((lang_statement_union_type *statement));
- static void open_input_bfds
- @@ -96,15 +96,17 @@ static void lang_reasonable_defaults PARAMS ((void));
- static void lang_place_undefineds PARAMS ((void));
- static void map_input_to_output_sections
- PARAMS ((lang_statement_union_type *s,
- - const char *target,
- - lang_output_section_statement_type *output_section_statement));
- + const char *target,
- + lang_output_section_statement_type *output_section_statement));
- static void print_output_section_statement
- PARAMS ((lang_output_section_statement_type *output_section_statement));
- static void print_assignment
- PARAMS ((lang_assignment_statement_type *assignment,
- - lang_output_section_statement_type *output_section));
- + lang_output_section_statement_type *output_section));
- static void print_input_statement PARAMS ((lang_input_statement_type *statm));
- static boolean print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR));
- +static boolean c33_print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR));
- +static void c33_bfd_hash_traverse PARAMS ((struct bfd_hash_table *, boolean (*) (struct bfd_hash_entry *, PTR), PTR));
- static void print_input_section PARAMS ((lang_input_section_type *in));
- static void print_fill_statement PARAMS ((lang_fill_statement_type *fill));
- static void print_data_statement PARAMS ((lang_data_statement_type *data));
- @@ -113,22 +115,22 @@ static void print_reloc_statement PARAMS ((lang_reloc_statement_type *reloc));
- static void print_padding_statement PARAMS ((lang_padding_statement_type *s));
- static void print_wild_statement
- PARAMS ((lang_wild_statement_type *w,
- - lang_output_section_statement_type *os));
- + lang_output_section_statement_type *os));
- static void print_group
- PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *));
- static void print_statement PARAMS ((lang_statement_union_type *s,
- - lang_output_section_statement_type *os));
- + lang_output_section_statement_type *os));
- static void print_statement_list PARAMS ((lang_statement_union_type *s,
- - lang_output_section_statement_type *os));
- + lang_output_section_statement_type *os));
- static void print_statements PARAMS ((void));
- static bfd_vma insert_pad PARAMS ((lang_statement_union_type **this_ptr,
- - fill_type fill, unsigned int power,
- - asection *output_section_statement,
- - bfd_vma dot));
- + fill_type fill, unsigned int power,
- + asection *output_section_statement,
- + bfd_vma dot));
- static bfd_vma size_input_section
- PARAMS ((lang_statement_union_type **this_ptr,
- - lang_output_section_statement_type *output_section_statement,
- - fill_type fill, bfd_vma dot, boolean relax));
- + lang_output_section_statement_type *output_section_statement,
- + fill_type fill, bfd_vma dot, boolean relax));
- static void lang_finish PARAMS ((void));
- static void ignore_bfd_errors PARAMS ((const char *, ...));
- static void lang_check PARAMS ((void));
- @@ -147,14 +149,14 @@ static void lang_do_version_exports_section PARAMS ((void));
- static void lang_check_section_addresses PARAMS ((void));
-
- typedef void (*callback_t) PARAMS ((lang_wild_statement_type *,
- - asection *, lang_input_statement_type *,
- - void *));
- + asection *, lang_input_statement_type *,
- + void *));
- static void walk_wild_section
- PARAMS ((lang_wild_statement_type *, const char *,
- - lang_input_statement_type *, callback_t, void *));
- + lang_input_statement_type *, callback_t, void *));
- static void walk_wild_file
- PARAMS ((lang_wild_statement_type *, const char *,
- - lang_input_statement_type *, callback_t, void *));
- + lang_input_statement_type *, callback_t, void *));
-
- static int get_target PARAMS ((const bfd_target *, void *));
- static void stricpy PARAMS ((char *, char *));
- @@ -162,7 +164,7 @@ static void strcut PARAMS ((char *, char *));
- static int name_compare PARAMS ((char *, char *));
- static int closest_target_match PARAMS ((const bfd_target *, void *));
- static char * get_first_input_target PARAMS ((void));
- -
- +
- /* EXPORTS */
- lang_output_section_statement_type *abs_output_section;
- lang_statement_list_type lang_output_section_statement;
- @@ -218,16 +220,16 @@ walk_wild_section (ptr, section, file, callback, data)
- struct name_list *list_tmp;
- for (list_tmp = ptr->exclude_filename_list; list_tmp; list_tmp = list_tmp->next)
- {
- - boolean match;
- + boolean match;
-
- - if (wildcardp (list_tmp->name))
- - match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
- - else
- - match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
- + if (wildcardp (list_tmp->name))
- + match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
- + else
- + match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
-
- - if (match)
- - return;
- - }
- + if (match)
- + return;
- + }
- }
-
- if (file->just_syms_flag == false)
- @@ -236,30 +238,30 @@ walk_wild_section (ptr, section, file, callback, data)
- boolean wildcard;
-
- if (section == NULL)
- - wildcard = false;
- + wildcard = false;
- else
- - wildcard = wildcardp (section);
- + wildcard = wildcardp (section);
-
- for (s = file->the_bfd->sections; s != NULL; s = s->next)
- - {
- - boolean match;
- + {
- + boolean match;
-
- - if (section == NULL)
- - match = true;
- - else
- - {
- - const char *name;
- + if (section == NULL)
- + match = true;
- + else
- + {
- + const char *name;
-
- - name = bfd_get_section_name (file->the_bfd, s);
- - if (wildcard)
- - match = fnmatch (section, name, 0) == 0 ? true : false;
- - else
- - match = strcmp (section, name) == 0 ? true : false;
- - }
- + name = bfd_get_section_name (file->the_bfd, s);
- + if (wildcard)
- + match = fnmatch (section, name, 0) == 0 ? true : false;
- + else
- + match = strcmp (section, name) == 0 ? true : false;
- + }
-
- - if (match)
- - (*callback) (ptr, s, file, data);
- - }
- + if (match)
- + (*callback) (ptr, s, file, data);
- + }
- }
- }
-
- @@ -281,24 +283,24 @@ walk_wild_file (s, section, f, callback, data)
- bfd *member;
-
- /* This is an archive file. We must map each member of the
- - archive separately. */
- + archive separately. */
- member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
- while (member != NULL)
- - {
- - /* When lookup_name is called, it will call the add_symbols
- - entry point for the archive. For each element of the
- - archive which is included, BFD will call ldlang_add_file,
- - which will set the usrdata field of the member to the
- - lang_input_statement. */
- - if (member->usrdata != NULL)
- - {
- - walk_wild_section (s, section,
- - (lang_input_statement_type *) member->usrdata,
- - callback, data);
- - }
- + {
- + /* When lookup_name is called, it will call the add_symbols
- + entry point for the archive. For each element of the
- + archive which is included, BFD will call ldlang_add_file,
- + which will set the usrdata field of the member to the
- + lang_input_statement. */
- + if (member->usrdata != NULL)
- + {
- + walk_wild_section (s, section,
- + (lang_input_statement_type *) member->usrdata,
- + callback, data);
- + }
-
- - member = bfd_openr_next_archived_file (f->the_bfd, member);
- - }
- + member = bfd_openr_next_archived_file (f->the_bfd, member);
- + }
- }
- }
-
- @@ -314,17 +316,17 @@ walk_wild (s, section, file, callback, data)
- {
- /* Perform the iteration over all files in the list. */
- LANG_FOR_EACH_INPUT_STATEMENT (f)
- - {
- - walk_wild_file (s, section, f, callback, data);
- - }
- + {
- + walk_wild_file (s, section, f, callback, data);
- + }
- }
- else if (wildcardp (file))
- {
- LANG_FOR_EACH_INPUT_STATEMENT (f)
- - {
- - if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
- - walk_wild_file (s, section, f, callback, data);
- - }
- + {
- + if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
- + walk_wild_file (s, section, f, callback, data);
- + }
- }
- else
- {
- @@ -351,40 +353,40 @@ lang_for_each_statement_worker (func, s)
- func (s);
-
- switch (s->header.type)
- - {
- - case lang_constructors_statement_enum:
- - lang_for_each_statement_worker (func, constructor_list.head);
- - break;
- - case lang_output_section_statement_enum:
- - lang_for_each_statement_worker
- - (func,
- - s->output_section_statement.children.head);
- - break;
- - case lang_wild_statement_enum:
- - lang_for_each_statement_worker
- - (func,
- - s->wild_statement.children.head);
- - break;
- - case lang_group_statement_enum:
- - lang_for_each_statement_worker (func,
- - s->group_statement.children.head);
- - break;
- - case lang_data_statement_enum:
- - case lang_reloc_statement_enum:
- - case lang_object_symbols_statement_enum:
- - case lang_output_statement_enum:
- - case lang_target_statement_enum:
- - case lang_input_section_enum:
- - case lang_input_statement_enum:
- - case lang_assignment_statement_enum:
- - case lang_padding_statement_enum:
- - case lang_address_statement_enum:
- - case lang_fill_statement_enum:
- - break;
- - default:
- - FAIL ();
- - break;
- - }
- + {
- + case lang_constructors_statement_enum:
- + lang_for_each_statement_worker (func, constructor_list.head);
- + break;
- + case lang_output_section_statement_enum:
- + lang_for_each_statement_worker
- + (func,
- + s->output_section_statement.children.head);
- + break;
- + case lang_wild_statement_enum:
- + lang_for_each_statement_worker
- + (func,
- + s->wild_statement.children.head);
- + break;
- + case lang_group_statement_enum:
- + lang_for_each_statement_worker (func,
- + s->group_statement.children.head);
- + break;
- + case lang_data_statement_enum:
- + case lang_reloc_statement_enum:
- + case lang_object_symbols_statement_enum:
- + case lang_output_statement_enum:
- + case lang_target_statement_enum:
- + case lang_input_section_enum:
- + case lang_input_statement_enum:
- + case lang_assignment_statement_enum:
- + case lang_padding_statement_enum:
- + case lang_address_statement_enum:
- + case lang_fill_statement_enum:
- + break;
- + default:
- + FAIL ();
- + break;
- + }
- }
- }
-
- @@ -393,7 +395,7 @@ lang_for_each_statement (func)
- void (*func) PARAMS ((lang_statement_union_type *));
- {
- lang_for_each_statement_worker (func,
- - statement_list.head);
- + statement_list.head);
- }
-
- /*----------------------------------------------------------------------*/
- @@ -452,7 +454,7 @@ new_afile (name, file_type, target, add_to_list)
- else
- {
- p = ((lang_input_statement_type *)
- - stat_alloc (sizeof (lang_input_statement_type)));
- + stat_alloc (sizeof (lang_input_statement_type)));
- p->header.next = NULL;
- }
-
- @@ -520,8 +522,8 @@ new_afile (name, file_type, target, add_to_list)
- p->whole_archive = whole_archive;
- p->loaded = false;
- lang_statement_append (&input_file_chain,
- - (lang_statement_union_type *) p,
- - &p->next_real_file);
- + (lang_statement_union_type *) p,
- + &p->next_real_file);
- return p;
- }
-
- @@ -549,8 +551,8 @@ lang_init ()
- lang_list_init (&lang_output_section_statement);
- lang_list_init (&file_chain);
- first_file = lang_add_input_file ((char *) NULL,
- - lang_input_file_is_marker_enum,
- - (char *) NULL);
- + lang_input_file_is_marker_enum,
- + (char *) NULL);
- abs_output_section = lang_output_section_statement_lookup (BFD_ABS_SECTION_NAME);
-
- abs_output_section->bfd_section = bfd_abs_section_ptr;
- @@ -582,9 +584,9 @@ lang_memory_region_lookup (name)
- p = p->next)
- {
- if (strcmp (p->name, name) == 0)
- - {
- - return p;
- - }
- + {
- + return p;
- + }
- }
-
- #if 0
- @@ -597,9 +599,9 @@ lang_memory_region_lookup (name)
- if (strcmp (name, "*default*") == 0)
- {
- if (lang_memory_region_list != (lang_memory_region_type *) NULL)
- - {
- - return lang_memory_region_list;
- - }
- + {
- + return lang_memory_region_list;
- + }
- }
- #endif
-
- @@ -641,10 +643,10 @@ lang_memory_default (section)
- p = p->next)
- {
- if ((p->flags & sec_flags) != 0
- - && (p->not_flags & sec_flags) == 0)
- - {
- - return p;
- - }
- + && (p->not_flags & sec_flags) == 0)
- + {
- + return p;
- + }
- }
- return lang_memory_region_lookup ("*default*");
- }
- @@ -662,9 +664,9 @@ lang_output_section_find (name)
- {
- lookup = &u->output_section_statement;
- if (strcmp (name, lookup->name) == 0)
- - {
- - return lookup;
- - }
- + {
- + return lookup;
- + }
- }
- return (lang_output_section_statement_type *) NULL;
- }
- @@ -680,7 +682,7 @@ lang_output_section_statement_lookup (name)
- {
-
- lookup = (lang_output_section_statement_type *)
- - new_stat (lang_output_section_statement, stat_ptr);
- + new_stat (lang_output_section_statement, stat_ptr);
- lookup->region = (lang_memory_region_type *) NULL;
- lookup->lma_region = (lang_memory_region_type *) NULL;
- lookup->fill = 0;
- @@ -702,8 +704,8 @@ lang_output_section_statement_lookup (name)
- lookup->phdrs = NULL;
-
- lang_statement_append (&lang_output_section_statement,
- - (lang_statement_union_type *) lookup,
- - &lookup->next);
- + (lang_statement_union_type *) lookup,
- + &lookup->next);
- }
- return lookup;
- }
- @@ -728,6 +730,7 @@ lang_map_flags (flag)
- minfo ("l");
- }
-
- +
- void
- lang_map ()
- {
- @@ -735,7 +738,7 @@ lang_map ()
-
- minfo (_("\nMemory Configuration\n\n"));
- fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
- - _("Name"), _("Origin"), _("Length"), _("Attributes"));
- + _("Name"), _("Origin"), _("Length"), _("Attributes"));
-
- for (m = lang_memory_region_list;
- m != (lang_memory_region_type *) NULL;
- @@ -750,35 +753,34 @@ lang_map ()
- minfo ("0x%s ", buf);
- len = strlen (buf);
- while (len < 16)
- - {
- - print_space ();
- - ++len;
- - }
- + {
- + print_space ();
- + ++len;
- + }
-
- minfo ("0x%V", m->length);
- if (m->flags || m->not_flags)
- - {
- + {
- #ifndef BFD64
- - minfo (" ");
- + minfo (" ");
- #endif
- - if (m->flags)
- - {
- - print_space ();
- - lang_map_flags (m->flags);
- - }
- + if (m->flags)
- + {
- + print_space ();
- + lang_map_flags (m->flags);
- + }
-
- - if (m->not_flags)
- - {
- - minfo (" !");
- - lang_map_flags (m->not_flags);
- - }
- - }
- + if (m->not_flags)
- + {
- + minfo (" !");
- + lang_map_flags (m->not_flags);
- + }
- + }
-
- print_nl ();
- }
-
- fprintf (config.map_file, _("\nLinker script and memory map\n\n"));
- -
- print_statements ();
- }
-
- @@ -797,7 +799,7 @@ init_os (s)
- einfo (_("%P%F: Illegal use of `%s' section"), DISCARD_SECTION_NAME);
-
- new = ((section_userdata_type *)
- - stat_alloc (sizeof (section_userdata_type)));
- + stat_alloc (sizeof (section_userdata_type)));
-
- s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
- if (s->bfd_section == (asection *) NULL)
- @@ -805,7 +807,7 @@ init_os (s)
- if (s->bfd_section == (asection *) NULL)
- {
- einfo (_("%P%F: output format %s cannot represent section called %s\n"),
- - output_bfd->xvec->name, s->name);
- + output_bfd->xvec->name, s->name);
- }
- s->bfd_section->output_section = s->bfd_section;
-
- @@ -850,18 +852,18 @@ exp_init_os (exp)
-
- case etree_name:
- switch (exp->type.node_code)
- - {
- - case ADDR:
- - case LOADADDR:
- - case SIZEOF:
- - {
- - lang_output_section_statement_type *os;
- -
- - os = lang_output_section_find (exp->name.name);
- - if (os != NULL && os->bfd_section == NULL)
- - init_os (os);
- - }
- - }
- + {
- + case ADDR:
- + case LOADADDR:
- + case SIZEOF:
- + {
- + lang_output_section_statement_type *os;
- +
- + os = lang_output_section_find (exp->name.name);
- + if (os != NULL && os->bfd_section == NULL)
- + init_os (os);
- + }
- + }
- break;
-
- default:
- @@ -952,54 +954,54 @@ section_already_linked (abfd, sec, data)
- for (l = already_linked_list->entry; l != NULL; l = l->next)
- {
- if (sec->comdat == NULL
- - || l->sec->comdat == NULL
- - || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
- - {
- - /* The section has already been linked. See if we should
- + || l->sec->comdat == NULL
- + || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
- + {
- + /* The section has already been linked. See if we should
- issue a warning. */
- - switch (flags & SEC_LINK_DUPLICATES)
- - {
- - default:
- - abort ();
- -
- - case SEC_LINK_DUPLICATES_DISCARD:
- - break;
- -
- - case SEC_LINK_DUPLICATES_ONE_ONLY:
- - if (sec->comdat == NULL)
- - einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
- - abfd, name);
- - else
- - einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
- - abfd, name, sec->comdat->name);
- - break;
- -
- - case SEC_LINK_DUPLICATES_SAME_CONTENTS:
- - /* FIXME: We should really dig out the contents of both
- + switch (flags & SEC_LINK_DUPLICATES)
- + {
- + default:
- + abort ();
- +
- + case SEC_LINK_DUPLICATES_DISCARD:
- + break;
- +
- + case SEC_LINK_DUPLICATES_ONE_ONLY:
- + if (sec->comdat == NULL)
- + einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
- + abfd, name);
- + else
- + einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
- + abfd, name, sec->comdat->name);
- + break;
- +
- + case SEC_LINK_DUPLICATES_SAME_CONTENTS:
- + /* FIXME: We should really dig out the contents of both
- sections and memcmp them. The COFF/PE spec says that
- the Microsoft linker does not implement this
- correctly, so I'm not going to bother doing it
- either. */
- - /* Fall through. */
- - case SEC_LINK_DUPLICATES_SAME_SIZE:
- - if (bfd_section_size (abfd, sec)
- - != bfd_section_size (l->sec->owner, l->sec))
- - einfo (_("%P: %B: warning: duplicate section `%s' has different size\n"),
- - abfd, name);
- - break;
- - }
- + /* Fall through. */
- + case SEC_LINK_DUPLICATES_SAME_SIZE:
- + if (bfd_section_size (abfd, sec)
- + != bfd_section_size (l->sec->owner, l->sec))
- + einfo (_("%P: %B: warning: duplicate section `%s' has different size\n"),
- + abfd, name);
- + break;
- + }
-
- - /* Set the output_section field so that wild_doit does not
- - create a lang_input_section structure for this section.
- - Since there might be a symbol in the section being
- - discarded, we must retain a pointer to the section which
- - we are really going to use. */
- - sec->output_section = bfd_abs_section_ptr;
- - if (sec->comdat != NULL)
- - sec->comdat->sec = l->sec;
- + /* Set the output_section field so that wild_doit does not
- + create a lang_input_section structure for this section.
- + Since there might be a symbol in the section being
- + discarded, we must retain a pointer to the section which
- + we are really going to use. */
- + sec->output_section = bfd_abs_section_ptr;
- + if (sec->comdat != NULL)
- + sec->comdat->sec = l->sec;
-
- - return;
- - }
- + return;
- + }
- }
-
- /* This is the first section with this name. Record it. Allocate
- @@ -1034,8 +1036,8 @@ static void
- already_linked_table_init ()
- {
- if (! bfd_hash_table_init_n (&already_linked_table,
- - already_linked_newfunc,
- - 42))
- + already_linked_newfunc,
- + 42))
- einfo (_("%P%F: Failed to create hash table\n"));
- }
-
- @@ -1065,8 +1067,8 @@ wildcardp (pattern)
-
- for (s = pattern; *s != '\0'; ++s)
- if (*s == '?'
- - || *s == '*'
- - || *s == '[')
- + || *s == '*'
- + || *s == '[')
- return true;
- return false;
- }
- @@ -1109,10 +1111,10 @@ wild_doit (ptr, section, output, file)
- if (discard)
- {
- if (section->output_section == NULL)
- - {
- - /* This prevents future calls from assigning this section. */
- - section->output_section = bfd_abs_section_ptr;
- - }
- + {
- + /* This prevents future calls from assigning this section. */
- + section->output_section = bfd_abs_section_ptr;
- + }
- return;
- }
-
- @@ -1123,12 +1125,12 @@ wild_doit (ptr, section, output, file)
- flagword flags;
-
- if (output->bfd_section == NULL)
- - {
- - init_os (output);
- - first = true;
- - }
- + {
- + init_os (output);
- + first = true;
- + }
- else
- - first = false;
- + first = false;
-
- /* Add a section reference to the list */
- new = new_stat (lang_input_section, ptr);
- @@ -1140,62 +1142,62 @@ wild_doit (ptr, section, output, file)
- flags = section->flags;
-
- /* We don't copy the SEC_NEVER_LOAD flag from an input section
- - to an output section, because we want to be able to include a
- - SEC_NEVER_LOAD section in the middle of an otherwise loaded
- - section (I don't know why we want to do this, but we do).
- - build_link_order in ldwrite.c handles this case by turning
- - the embedded SEC_NEVER_LOAD section into a fill. */
- + to an output section, because we want to be able to include a
- + SEC_NEVER_LOAD section in the middle of an otherwise loaded
- + section (I don't know why we want to do this, but we do).
- + build_link_order in ldwrite.c handles this case by turning
- + the embedded SEC_NEVER_LOAD section into a fill. */
-
- flags &= ~ SEC_NEVER_LOAD;
-
- /* If final link, don't copy the SEC_LINK_ONCE flags, they've
- - already been processed. One reason to do this is that on pe
- - format targets, .text$foo sections go into .text and it's odd
- - to see .text with SEC_LINK_ONCE set. */
- + already been processed. One reason to do this is that on pe
- + format targets, .text$foo sections go into .text and it's odd
- + to see .text with SEC_LINK_ONCE set. */
-
- if (! link_info.relocateable)
- - flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES);
- + flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES);
-
- /* If this is not the first input section, and the SEC_READONLY
- flag is not currently set, then don't set it just because the
- input section has it set. */
-
- if (! first && (section->output_section->flags & SEC_READONLY) == 0)
- - flags &= ~ SEC_READONLY;
- + flags &= ~ SEC_READONLY;
-
- section->output_section->flags |= flags;
-
- /* If SEC_READONLY is not set in the input section, then clear
- it from the output section. */
- if ((section->flags & SEC_READONLY) == 0)
- - section->output_section->flags &= ~SEC_READONLY;
- + section->output_section->flags &= ~SEC_READONLY;
-
- switch (output->sectype)
- - {
- - case normal_section:
- - break;
- - case dsect_section:
- - case copy_section:
- - case info_section:
- - case overlay_section:
- - output->bfd_section->flags &= ~SEC_ALLOC;
- - break;
- - case noload_section:
- - output->bfd_section->flags &= ~SEC_LOAD;
- - output->bfd_section->flags |= SEC_NEVER_LOAD;
- - break;
- - }
- + {
- + case normal_section:
- + break;
- + case dsect_section:
- + case copy_section:
- + case info_section:
- + case overlay_section:
- + output->bfd_section->flags &= ~SEC_ALLOC;
- + break;
- + case noload_section:
- + output->bfd_section->flags &= ~SEC_LOAD;
- + output->bfd_section->flags |= SEC_NEVER_LOAD;
- + break;
- + }
-
- /* Copy over SEC_SMALL_DATA. */
- if (section->flags & SEC_SMALL_DATA)
- - section->output_section->flags |= SEC_SMALL_DATA;
- + section->output_section->flags |= SEC_SMALL_DATA;
-
- if (section->alignment_power > output->bfd_section->alignment_power)
- - output->bfd_section->alignment_power = section->alignment_power;
- + output->bfd_section->alignment_power = section->alignment_power;
-
- /* If supplied an aligment, then force it. */
- if (output->section_alignment != -1)
- - output->bfd_section->alignment_power = output->section_alignment;
- + output->bfd_section->alignment_power = output->section_alignment;
- }
- }
-
- @@ -1222,79 +1224,79 @@ wild_sort (wild, file, section)
- lang_input_section_type *ls;
-
- if (l->header.type != lang_input_section_enum)
- - continue;
- + continue;
- ls = &l->input_section;
-
- /* Sorting by filename takes precedence over sorting by section
- name. */
-
- if (wild->filenames_sorted)
- - {
- - const char *fn, *ln;
- - boolean fa, la;
- - int i;
- + {
- + const char *fn, *ln;
- + boolean fa, la;
- + int i;
-
- - /* The PE support for the .idata section as generated by
- + /* The PE support for the .idata section as generated by
- dlltool assumes that files will be sorted by the name of
- the archive and then the name of the file within the
- archive. */
-
- - if (file->the_bfd != NULL
- - && bfd_my_archive (file->the_bfd) != NULL)
- - {
- - fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
- - fa = true;
- - }
- - else
- - {
- - fn = file->filename;
- - fa = false;
- - }
- + if (file->the_bfd != NULL
- + && bfd_my_archive (file->the_bfd) != NULL)
- + {
- + fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
- + fa = true;
- + }
- + else
- + {
- + fn = file->filename;
- + fa = false;
- + }
-
- - if (ls->ifile->the_bfd != NULL
- - && bfd_my_archive (ls->ifile->the_bfd) != NULL)
- - {
- - ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
- - la = true;
- - }
- - else
- - {
- - ln = ls->ifile->filename;
- - la = false;
- - }
- + if (ls->ifile->the_bfd != NULL
- + && bfd_my_archive (ls->ifile->the_bfd) != NULL)
- + {
- + ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
- + la = true;
- + }
- + else
- + {
- + ln = ls->ifile->filename;
- + la = false;
- + }
-
- - i = strcmp (fn, ln);
- - if (i > 0)
- - continue;
- - else if (i < 0)
- - break;
- + i = strcmp (fn, ln);
- + if (i > 0)
- + continue;
- + else if (i < 0)
- + break;
-
- - if (fa || la)
- - {
- - if (fa)
- - fn = file->filename;
- - if (la)
- - ln = ls->ifile->filename;
- -
- - i = strcmp (fn, ln);
- - if (i > 0)
- - continue;
- - else if (i < 0)
- - break;
- - }
- - }
- + if (fa || la)
- + {
- + if (fa)
- + fn = file->filename;
- + if (la)
- + ln = ls->ifile->filename;
- +
- + i = strcmp (fn, ln);
- + if (i > 0)
- + continue;
- + else if (i < 0)
- + break;
- + }
- + }
-
- /* Here either the files are not sorted by name, or we are
- looking at the sections for this file. */
-
- if (wild->sections_sorted)
- - {
- - if (strcmp (section_name,
- - bfd_get_section_name (ls->ifile->the_bfd,
- - ls->section))
- - < 0)
- - break;
- - }
- + {
- + if (strcmp (section_name,
- + bfd_get_section_name (ls->ifile->the_bfd,
- + ls->section))
- + < 0)
- + break;
- + }
- }
-
- return l;
- @@ -1326,8 +1328,8 @@ output_section_callback (ptr, section, file, output)
-
- if (before == NULL)
- wild_doit (&ptr->children, section,
- - (lang_output_section_statement_type *) output,
- - file);
- + (lang_output_section_statement_type *) output,
- + file);
- else
- {
- lang_statement_list_type list;
- @@ -1335,23 +1337,23 @@ output_section_callback (ptr, section, file, output)
-
- lang_list_init (&list);
- wild_doit (&list, section,
- - (lang_output_section_statement_type *) output,
- - file);
- + (lang_output_section_statement_type *) output,
- + file);
-
- /* If we are discarding the section, LIST.HEAD will
- - be NULL. */
- + be NULL. */
- if (list.head != NULL)
- - {
- - ASSERT (list.head->next == NULL);
- -
- - for (pp = &ptr->children.head;
- - *pp != before;
- - pp = &(*pp)->next)
- - ASSERT (*pp != NULL);
- -
- - list.head->next = *pp;
- - *pp = list.head;
- - }
- + {
- + ASSERT (list.head->next == NULL);
- +
- + for (pp = &ptr->children.head;
- + *pp != before;
- + pp = &(*pp)->next)
- + ASSERT (*pp != NULL);
- +
- + list.head->next = *pp;
- + *pp = list.head;
- + }
- }
- }
-
- @@ -1370,16 +1372,16 @@ lookup_name (name)
- search = (lang_input_statement_type *) search->next_real_file)
- {
- if (search->filename == (char *) NULL && name == (char *) NULL)
- - return search;
- + return search;
- if (search->filename != (char *) NULL
- - && name != (char *) NULL
- - && strcmp (search->filename, name) == 0)
- - break;
- + && name != (char *) NULL
- + && strcmp (search->filename, name) == 0)
- + break;
- }
-
- if (search == (lang_input_statement_type *) NULL)
- search = new_afile (name, lang_input_file_is_file_enum, default_target,
- - false);
- + false);
-
- /* If we have already added this file, or this file is not real
- (FIXME: can that ever actually happen?) or the name is NULL
- @@ -1416,18 +1418,18 @@ load_symbols (entry, place)
-
- err = bfd_get_error ();
- if (err == bfd_error_file_ambiguously_recognized)
- - {
- - char **p;
- -
- - einfo (_("%B: file not recognized: %E\n"), entry->the_bfd);
- - einfo (_("%B: matching formats:"), entry->the_bfd);
- - for (p = matching; *p != NULL; p++)
- - einfo (" %s", *p);
- - einfo ("%F\n");
- - }
- + {
- + char **p;
- +
- + einfo (_("%B: file not recognized: %E\n"), entry->the_bfd);
- + einfo (_("%B: matching formats:"), entry->the_bfd);
- + for (p = matching; *p != NULL; p++)
- + einfo (" %s", *p);
- + einfo ("%F\n");
- + }
- else if (err != bfd_error_file_not_recognized
- - || place == NULL)
- - einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
- + || place == NULL)
- + einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
-
- bfd_close (entry->the_bfd);
- entry->the_bfd = NULL;
- @@ -1435,7 +1437,7 @@ load_symbols (entry, place)
- /* See if the emulation has some special knowledge. */
-
- if (ldemul_unrecognized_file (entry))
- - return;
- + return;
-
- /* Try to interpret the file as a linker script. */
-
- @@ -1469,32 +1471,32 @@ load_symbols (entry, place)
- case bfd_object:
- ldlang_add_file (entry);
- if (trace_files || trace_file_tries)
- - info_msg ("%I\n", entry);
- + info_msg ("%I\n", entry);
- break;
-
- case bfd_archive:
- if (entry->whole_archive)
- - {
- - bfd *member = bfd_openr_next_archived_file (entry->the_bfd,
- - (bfd *) NULL);
- - while (member != NULL)
- - {
- - if (! bfd_check_format (member, bfd_object))
- - einfo (_("%F%B: object %B in archive is not object\n"),
- - entry->the_bfd, member);
- - if (! ((*link_info.callbacks->add_archive_element)
- - (&link_info, member, "--whole-archive")))
- - abort ();
- - if (! bfd_link_add_symbols (member, &link_info))
- - einfo (_("%F%B: could not read symbols: %E\n"), member);
- - member = bfd_openr_next_archived_file (entry->the_bfd,
- - member);
- - }
- + {
- + bfd *member = bfd_openr_next_archived_file (entry->the_bfd,
- + (bfd *) NULL);
- + while (member != NULL)
- + {
- + if (! bfd_check_format (member, bfd_object))
- + einfo (_("%F%B: object %B in archive is not object\n"),
- + entry->the_bfd, member);
- + if (! ((*link_info.callbacks->add_archive_element)
- + (&link_info, member, "--whole-archive")))
- + abort ();
- + if (! bfd_link_add_symbols (member, &link_info))
- + einfo (_("%F%B: could not read symbols: %E\n"), member);
- + member = bfd_openr_next_archived_file (entry->the_bfd,
- + member);
- + }
-
- - entry->loaded = true;
- + entry->loaded = true;
-
- - return;
- - }
- + return;
- + }
- }
-
- if (! bfd_link_add_symbols (entry->the_bfd, &link_info))
- @@ -1552,7 +1554,7 @@ stricpy (dest, src)
- while ((c = * src ++) != 0)
- {
- if (isupper ((unsigned char) c))
- - c = tolower (c);
- + c = tolower (c);
-
- * dest ++ = c;
- }
- @@ -1574,7 +1576,7 @@ strcut (haystack, needle)
- char * src;
-
- for (src = haystack + strlen (needle); * src;)
- - * haystack ++ = * src ++;
- + * haystack ++ = * src ++;
-
- * haystack = 0;
- }
- @@ -1610,8 +1612,8 @@ name_compare (first, second)
- for (result = 0; copy1 [result] == copy2 [result]; result ++)
- if (copy1 [result] == 0)
- {
- - result *= 10;
- - break;
- + result *= 10;
- + break;
- }
-
- free (copy1);
- @@ -1668,19 +1670,19 @@ get_first_input_target ()
- LANG_FOR_EACH_INPUT_STATEMENT (s)
- {
- if (s->header.type == lang_input_statement_enum
- - && s->real)
- - {
- - ldfile_open_file (s);
- -
- - if (s->the_bfd != NULL
- - && bfd_check_format (s->the_bfd, bfd_object))
- - {
- - target = bfd_get_target (s->the_bfd);
- -
- - if (target != NULL)
- - break;
- - }
- - }
- + && s->real)
- + {
- + ldfile_open_file (s);
- +
- + if (s->the_bfd != NULL
- + && bfd_check_format (s->the_bfd, bfd_object))
- + {
- + target = bfd_get_target (s->the_bfd);
- +
- + if (target != NULL)
- + break;
- + }
- + }
- }
-
- return target;
- @@ -1699,17 +1701,17 @@ open_output (name)
- {
- /* No - has the current target been set to something other than the default ? */
- if (current_target != default_target)
- - output_target = current_target;
- + output_target = current_target;
-
- /* No - can we determine the format of the first input file ? */
- else
- - {
- - output_target = get_first_input_target ();
- + {
- + output_target = get_first_input_target ();
-
- - /* Failed - use the default output target. */
- - if (output_target == NULL)
- - output_target = default_target;
- - }
- + /* Failed - use the default output target. */
- + if (output_target == NULL)
- + output_target = default_target;
- + }
- }
-
- /* Has the user requested a particular endianness on the command line ? */
- @@ -1722,33 +1724,33 @@ open_output (name)
- target = bfd_search_for_target (get_target, (void *) output_target);
-
- if (command_line.endian == ENDIAN_BIG)
- - desired_endian = BFD_ENDIAN_BIG;
- + desired_endian = BFD_ENDIAN_BIG;
- else
- - desired_endian = BFD_ENDIAN_LITTLE;
- + desired_endian = BFD_ENDIAN_LITTLE;
-
- /* See if the target has the wrong endianness. This should not happen
- - if the linker script has provided big and little endian alternatives,
- - but some scrips don't do this. */
- + if the linker script has provided big and little endian alternatives,
- + but some scrips don't do this. */
- if (target->byteorder != desired_endian)
- - {
- - /* If it does, then see if the target provides
- - an alternative with the correct endianness. */
- - if (target->alternative_target != NULL
- - && (target->alternative_target->byteorder == desired_endian))
- - output_target = target->alternative_target->name;
- - else
- - {
- - /* Try to find a target as similar as possible to the default
- - target, but which has the desired endian characteristic. */
- - (void) bfd_search_for_target (closest_target_match, (void *) target);
- -
- - /* Oh dear - we could not find any targets that satisfy our requirements. */
- - if (winner == NULL)
- - einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
- - else
- - output_target = winner->name;
- - }
- - }
- + {
- + /* If it does, then see if the target provides
- + an alternative with the correct endianness. */
- + if (target->alternative_target != NULL
- + && (target->alternative_target->byteorder == desired_endian))
- + output_target = target->alternative_target->name;
- + else
- + {
- + /* Try to find a target as similar as possible to the default
- + target, but which has the desired endian characteristic. */
- + (void) bfd_search_for_target (closest_target_match, (void *) target);
- +
- + /* Oh dear - we could not find any targets that satisfy our requirements. */
- + if (winner == NULL)
- + einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
- + else
- + output_target = winner->name;
- + }
- + }
- }
-
- output = bfd_openw (name, output_target);
- @@ -1756,7 +1758,7 @@ open_output (name)
- if (output == (bfd *) NULL)
- {
- if (bfd_get_error () == bfd_error_invalid_target)
- - einfo (_("%P%F: target %s not found\n"), output_target);
- + einfo (_("%P%F: target %s not found\n"), output_target);
-
- einfo (_("%P%F: cannot open output file %s: %E\n"), name);
- }
- @@ -1768,8 +1770,8 @@ open_output (name)
- if (! bfd_set_format (output, bfd_object))
- einfo (_("%P%F:%s: can not make object file: %E\n"), name);
- if (! bfd_set_arch_mach (output,
- - ldfile_output_architecture,
- - ldfile_output_machine))
- + ldfile_output_architecture,
- + ldfile_output_machine))
- einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
-
- link_info.hash = bfd_link_hash_table_create (output);
- @@ -1791,17 +1793,17 @@ ldlang_open_output (statement)
- output_bfd = open_output (statement->output_statement.name);
- ldemul_set_output_arch ();
- if (config.magic_demand_paged && !link_info.relocateable)
- - output_bfd->flags |= D_PAGED;
- + output_bfd->flags |= D_PAGED;
- else
- - output_bfd->flags &= ~D_PAGED;
- + output_bfd->flags &= ~D_PAGED;
- if (config.text_read_only)
- - output_bfd->flags |= WP_TEXT;
- + output_bfd->flags |= WP_TEXT;
- else
- - output_bfd->flags &= ~WP_TEXT;
- + output_bfd->flags &= ~WP_TEXT;
- if (link_info.traditional_format)
- - output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
- + output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
- else
- - output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
- + output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
- break;
-
- case lang_target_statement_enum:
- @@ -1822,69 +1824,69 @@ open_input_bfds (s, force)
- for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
- - {
- - case lang_constructors_statement_enum:
- - open_input_bfds (constructor_list.head, force);
- - break;
- - case lang_output_section_statement_enum:
- - open_input_bfds (s->output_section_statement.children.head, force);
- - break;
- - case lang_wild_statement_enum:
- - /* Maybe we should load the file's symbols */
- - if (s->wild_statement.filename
- - && ! wildcardp (s->wild_statement.filename))
- - (void) lookup_name (s->wild_statement.filename);
- - open_input_bfds (s->wild_statement.children.head, force);
- - break;
- - case lang_group_statement_enum:
- - {
- - struct bfd_link_hash_entry *undefs;
- -
- - /* We must continually search the entries in the group
- + {
- + case lang_constructors_statement_enum:
- + open_input_bfds (constructor_list.head, force);
- + break;
- + case lang_output_section_statement_enum:
- + open_input_bfds (s->output_section_statement.children.head, force);
- + break;
- + case lang_wild_statement_enum:
- + /* Maybe we should load the file's symbols */
- + if (s->wild_statement.filename
- + && ! wildcardp (s->wild_statement.filename))
- + (void) lookup_name (s->wild_statement.filename);
- + open_input_bfds (s->wild_statement.children.head, force);
- + break;
- + case lang_group_statement_enum:
- + {
- + struct bfd_link_hash_entry *undefs;
- +
- + /* We must continually search the entries in the group
- until no new symbols are added to the list of undefined
- symbols. */
-
- - do
- - {
- - undefs = link_info.hash->undefs_tail;
- - open_input_bfds (s->group_statement.children.head, true);
- - }
- - while (undefs != link_info.hash->undefs_tail);
- - }
- - break;
- - case lang_target_statement_enum:
- - current_target = s->target_statement.target;
- - break;
- - case lang_input_statement_enum:
- - if (s->input_statement.real)
- - {
- - lang_statement_list_type add;
- + do
- + {
- + undefs = link_info.hash->undefs_tail;
- + open_input_bfds (s->group_statement.children.head, true);
- + }
- + while (undefs != link_info.hash->undefs_tail);
- + }
- + break;
- + case lang_target_statement_enum:
- + current_target = s->target_statement.target;
- + break;
- + case lang_input_statement_enum:
- + if (s->input_statement.real)
- + {
- + lang_statement_list_type add;
-
- - s->input_statement.target = current_target;
- + s->input_statement.target = current_target;
-
- - /* If we are being called from within a group, and this
- + /* If we are being called from within a group, and this
- is an archive which has already been searched, then
- force it to be researched. */
- - if (force
- - && s->input_statement.loaded
- - && bfd_check_format (s->input_statement.the_bfd,
- - bfd_archive))
- - s->input_statement.loaded = false;
- + if (force
- + && s->input_statement.loaded
- + && bfd_check_format (s->input_statement.the_bfd,
- + bfd_archive))
- + s->input_statement.loaded = false;
-
- - lang_list_init (&add);
- + lang_list_init (&add);
-
- - load_symbols (&s->input_statement, &add);
- + load_symbols (&s->input_statement, &add);
-
- - if (add.head != NULL)
- - {
- - *add.tail = s->next;
- - s->next = add.head;
- - }
- - }
- - break;
- - default:
- - break;
- - }
- + if (add.head != NULL)
- + {
- + *add.tail = s->next;
- + s->next = add.head;
- + }
- + }
- + break;
- + default:
- + break;
- + }
- }
- }
-
- @@ -1905,7 +1907,7 @@ lang_reasonable_defaults ()
- {
- lang_wild_statement_type *new =
- new_stat (lang_wild_statement,
- - &default_common_section->children);
- + &default_common_section->children);
-
- new->section_name = "COMMON";
- new->filename = (char *) NULL;
- @@ -1958,13 +1960,13 @@ lang_place_undefineds ()
-
- h = bfd_link_hash_lookup (link_info.hash, ptr->name, true, false, true);
- if (h == (struct bfd_link_hash_entry *) NULL)
- - einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
- + einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
- if (h->type == bfd_link_hash_new)
- - {
- - h->type = bfd_link_hash_undefined;
- - h->u.undef.abfd = NULL;
- - bfd_link_add_undef (link_info.hash, h);
- - }
- + {
- + h->type = bfd_link_hash_undefined;
- + h->u.undef.abfd = NULL;
- + bfd_link_add_undef (link_info.hash, h);
- + }
- }
- }
-
- @@ -1978,71 +1980,71 @@ map_input_to_output_sections (s, target, output_section_statement)
- for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
- - {
- -
- -
- - case lang_wild_statement_enum:
- - wild (&s->wild_statement, s->wild_statement.section_name,
- - s->wild_statement.filename, target,
- - output_section_statement);
- -
- - break;
- - case lang_constructors_statement_enum:
- - map_input_to_output_sections (constructor_list.head,
- - target,
- - output_section_statement);
- - break;
- - case lang_output_section_statement_enum:
- - map_input_to_output_sections (s->output_section_statement.children.head,
- - target,
- - &s->output_section_statement);
- - break;
- - case lang_output_statement_enum:
- - break;
- - case lang_target_statement_enum:
- - target = s->target_statement.target;
- - break;
- - case lang_group_statement_enum:
- - map_input_to_output_sections (s->group_statement.children.head,
- - target,
- - output_section_statement);
- - break;
- - case lang_fill_statement_enum:
- - case lang_input_section_enum:
- - case lang_object_symbols_statement_enum:
- - case lang_data_statement_enum:
- - case lang_reloc_statement_enum:
- - case lang_padding_statement_enum:
- - case lang_input_statement_enum:
- - if (output_section_statement != NULL
- - && output_section_statement->bfd_section == NULL)
- - init_os (output_section_statement);
- - break;
- - case lang_assignment_statement_enum:
- - if (output_section_statement != NULL
- - && output_section_statement->bfd_section == NULL)
- - init_os (output_section_statement);
- -
- - /* Make sure that any sections mentioned in the assignment
- + {
- +
- +
- + case lang_wild_statement_enum:
- + wild (&s->wild_statement, s->wild_statement.section_name,
- + s->wild_statement.filename, target,
- + output_section_statement);
- +
- + break;
- + case lang_constructors_statement_enum:
- + map_input_to_output_sections (constructor_list.head,
- + target,
- + output_section_statement);
- + break;
- + case lang_output_section_statement_enum:
- + map_input_to_output_sections (s->output_section_statement.children.head,
- + target,
- + &s->output_section_statement);
- + break;
- + case lang_output_statement_enum:
- + break;
- + case lang_target_statement_enum:
- + target = s->target_statement.target;
- + break;
- + case lang_group_statement_enum:
- + map_input_to_output_sections (s->group_statement.children.head,
- + target,
- + output_section_statement);
- + break;
- + case lang_fill_statement_enum:
- + case lang_input_section_enum:
- + case lang_object_symbols_statement_enum:
- + case lang_data_statement_enum:
- + case lang_reloc_statement_enum:
- + case lang_padding_statement_enum:
- + case lang_input_statement_enum:
- + if (output_section_statement != NULL
- + && output_section_statement->bfd_section == NULL)
- + init_os (output_section_statement);
- + break;
- + case lang_assignment_statement_enum:
- + if (output_section_statement != NULL
- + && output_section_statement->bfd_section == NULL)
- + init_os (output_section_statement);
- +
- + /* Make sure that any sections mentioned in the assignment
- are initialized. */
- - exp_init_os (s->assignment_statement.exp);
- - break;
- - case lang_afile_asection_pair_statement_enum:
- - FAIL ();
- - break;
- - case lang_address_statement_enum:
- - /* Mark the specified section with the supplied address */
- - {
- - lang_output_section_statement_type *os =
- - lang_output_section_statement_lookup
- - (s->address_statement.section_name);
- -
- - if (os->bfd_section == NULL)
- - init_os (os);
- - os->addr_tree = s->address_statement.address;
- - }
- - break;
- - }
- + exp_init_os (s->assignment_statement.exp);
- + break;
- + case lang_afile_asection_pair_statement_enum:
- + FAIL ();
- + break;
- + case lang_address_statement_enum:
- + /* Mark the specified section with the supplied address */
- + {
- + lang_output_section_statement_type *os =
- + lang_output_section_statement_lookup
- + (s->address_statement.section_name);
- +
- + if (os->bfd_section == NULL)
- + init_os (os);
- + os->addr_tree = s->address_statement.address;
- + }
- + break;
- + }
- }
- }
-
- @@ -2055,41 +2057,50 @@ print_output_section_statement (output_section_statement)
-
- if (output_section_statement != abs_output_section)
- {
- +
- +/* add D.Fujimoto 2006/06/12 >>> display message for debugging sections */
- + if (strncmp (output_section_statement->name, ".stab", sizeof(".stab") - 1) == 0 ||
- + strncmp (output_section_statement->name, ".comment", sizeof(".comment") - 1) == 0) {
- + minfo("\n*** Section %s will not be loaded to the target ***\n", output_section_statement->name);
- + }
- +/* add D.Fujimoto 2006/06/12 <<< display message for debugging sections */
- +
- minfo ("\n%s", output_section_statement->name);
-
- if (section != NULL)
- - {
- - print_dot = section->vma;
- + {
- + print_dot = section->vma;
-
- - len = strlen (output_section_statement->name);
- - if (len >= SECTION_NAME_MAP_LENGTH - 1)
- - {
- - print_nl ();
- - len = 0;
- - }
- - while (len < SECTION_NAME_MAP_LENGTH)
- - {
- - print_space ();
- - ++len;
- - }
- + len = strlen (output_section_statement->name);
- + if (len >= SECTION_NAME_MAP_LENGTH - 1)
- + {
- + print_nl ();
- + len = 0;
- + }
- + while (len < SECTION_NAME_MAP_LENGTH)
- + {
- + print_space ();
- + ++len;
- + }
-
- - minfo ("0x%V %W", section->vma, section->_raw_size);
- + minfo ("0x%V %W", section->vma, section->_raw_size);
-
- - if (output_section_statement->load_base != NULL)
- - {
- - bfd_vma addr;
-
- - addr = exp_get_abs_int (output_section_statement->load_base, 0,
- - "load base", lang_final_phase_enum);
- - minfo (_(" load address 0x%V"), addr);
- - }
- - }
- + if (output_section_statement->load_base != NULL)
- + {
- + bfd_vma addr;
- +
- + addr = exp_get_abs_int (output_section_statement->load_base, 0,
- + "load base", lang_final_phase_enum);
- + minfo (_(" load address 0x%V"), addr);
- + }
- + }
-
- print_nl ();
- }
-
- print_statement_list (output_section_statement->children.head,
- - output_section_statement);
- + output_section_statement);
- }
-
- static void
- @@ -2104,7 +2115,7 @@ print_assignment (assignment, output_section)
- print_space ();
-
- result = exp_fold_tree (assignment->exp->assign.src, output_section,
- - lang_final_phase_enum, print_dot, &print_dot);
- + lang_final_phase_enum, print_dot, &print_dot);
- if (result.valid_p)
- minfo ("0x%V", result.value + result.section->bfd_section->vma);
- else
- @@ -2149,11 +2160,11 @@ print_one_symbol (hash_entry, ptr)
- int i;
-
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- - print_space ();
- + print_space ();
- minfo ("0x%V ",
- - (hash_entry->u.def.value
- - + hash_entry->u.def.section->output_offset
- - + hash_entry->u.def.section->output_section->vma));
- + (hash_entry->u.def.value
- + + hash_entry->u.def.section->output_offset
- + + hash_entry->u.def.section->output_section->vma));
-
- minfo (" %T\n", hash_entry->root.string);
- }
- @@ -2170,7 +2181,7 @@ print_input_section (in)
- asection *i = in->section;
- bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
- if (size != 0)
- {
- print_space ();
- @@ -2178,49 +2189,162 @@ print_input_section (in)
- minfo ("%s", i->name);
-
- if (i->output_section != NULL)
- - {
- - int len;
- + {
- + int len;
-
- - len = 1 + strlen (i->name);
- - if (len >= SECTION_NAME_MAP_LENGTH - 1)
- - {
- - print_nl ();
- - len = 0;
- - }
- - while (len < SECTION_NAME_MAP_LENGTH)
- - {
- - print_space ();
- - ++len;
- - }
- + len = 1 + strlen (i->name);
- + if (len >= SECTION_NAME_MAP_LENGTH - 1)
- + {
- + print_nl ();
- + len = 0;
- + }
- + while (len < SECTION_NAME_MAP_LENGTH)
- + {
- + print_space ();
- + ++len;
- + }
-
- - minfo ("0x%V %W %B\n",
- - i->output_section->vma + i->output_offset, size / opb,
- - i->owner);
- + minfo ("0x%V %W %B\n",
- + i->output_section->vma + i->output_offset, size / opb,
- + i->owner);
-
- - if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
- - {
- - len = SECTION_NAME_MAP_LENGTH + 3;
- +
- + if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
- + {
- + len = SECTION_NAME_MAP_LENGTH + 3;
- #ifdef BFD64
- - len += 16;
- + len += 16;
- #else
- - len += 8;
- + len += 8;
- #endif
- - while (len > 0)
- + while (len > 0)
- + {
- + print_space ();
- + --len;
- + }
- +
- + minfo (_("%W (size before relaxing)\n"), i->_raw_size);
- + }
- +
- +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 >>> */
- +
- +/* del
- + bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
- +*/
- + c33_bfd_hash_traverse (&link_info.hash->table,
- + ((boolean (*) PARAMS ((struct bfd_hash_entry *, PTR)))
- + c33_print_one_symbol),
- + (PTR) i);
- +
- +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 <<< */
- +
- +
- + print_dot = i->output_section->vma + i->output_offset + size / opb;
- + }
- + }
- +}
- +
- +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 >>> */
- +
- +#define C33_SYMBOL_MAX 3000
- +
- +static int c33_iSymbolIndex = 0;
- +static unsigned long c33_ulSymbolAddr[C33_SYMBOL_MAX + 10];
- +static char c33_szSymbol[C33_SYMBOL_MAX + 10][300];
- +static unsigned long c33_ulSymbolAddr2[C33_SYMBOL_MAX + 10];
- +static char c33_szSymbol2[C33_SYMBOL_MAX + 10][300];
- +
- +static void
- +c33_bfd_hash_traverse (table, func, info)
- + struct bfd_hash_table *table;
- + boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
- + PTR info;
- +{
- + unsigned int i;
- + unsigned int j;
- + unsigned int k;
- + int iMinIndex = 0;
- + unsigned long ulMinAddr = 0;
- +
- + c33_iSymbolIndex = 0; /* initialize output symbol index */
- +
- + for (i = 0; i < table->size; i++)
- + {
- + struct bfd_hash_entry *p;
- +
- + for (p = table->table[i]; p != NULL; p = p->next)
- {
- - print_space ();
- - --len;
- + if (! (*func) (p, info)) /* c33_print_one_symbol() */
- + return;
- }
- + }
-
- - minfo (_("%W (size before relaxing)\n"), i->_raw_size);
- - }
- + /* sort symbol address */
- +
- + for( j = 0; j < c33_iSymbolIndex; ++j )
- + {
- + iMinIndex = 0;
- + ulMinAddr = c33_ulSymbolAddr[ iMinIndex ];
- +
- + for( k = 0; k < c33_iSymbolIndex; ++k )
- + {
- + if( ulMinAddr > c33_ulSymbolAddr[ k ] )
- + {
- + ulMinAddr = c33_ulSymbolAddr[ k ];
- + iMinIndex = k;
- + }
- + }
- + c33_ulSymbolAddr2[ j ] = c33_ulSymbolAddr[ iMinIndex ];
- + strcpy( c33_szSymbol2[ j ], c33_szSymbol[ iMinIndex ] );
- +
- + c33_ulSymbolAddr[ iMinIndex ] = 0xffffffff; /* max set */
- + }
-
- - bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
- + /* symbol output */
- +
- + for( j = 0; j < c33_iSymbolIndex; ++j )
- + {
- + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- + print_space ();
- + minfo ("0x%V ", c33_ulSymbolAddr2[ j ] );
- + minfo (" %T\n", c33_szSymbol2[ j ] );
-
- - print_dot = i->output_section->vma + i->output_offset + size / opb;
- }
- - }
- +
- }
-
- +
- +static boolean
- +c33_print_one_symbol (hash_entry, ptr)
- + struct bfd_link_hash_entry *hash_entry;
- + PTR ptr;
- +{
- + asection *sec = (asection *) ptr;
- +
- + if ((hash_entry->type == bfd_link_hash_defined
- + || hash_entry->type == bfd_link_hash_defweak)
- + && sec == hash_entry->u.def.section)
- + {
- +
- + /* set symbol address and symbol name to dim. */
- + if( c33_iSymbolIndex < C33_SYMBOL_MAX )
- + {
- +
- +
- + c33_ulSymbolAddr[ c33_iSymbolIndex ] = (hash_entry->u.def.value
- + + hash_entry->u.def.section->output_offset
- + + hash_entry->u.def.section->output_section->vma);
- + strcpy( c33_szSymbol[ c33_iSymbolIndex ],hash_entry->root.string );
- +
- + ++c33_iSymbolIndex;
- +
- + }
- + }
- + return true;
- +}
- +
- +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 <<< */
- +
- static void
- print_fill_statement (fill)
- lang_fill_statement_type * fill;
- @@ -2237,7 +2361,7 @@ print_data_statement (data)
- bfd_size_type size;
- const char *name;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
- @@ -2308,7 +2432,7 @@ print_reloc_statement (reloc)
- bfd_vma addr;
- bfd_size_type size;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
- print_space ();
- @@ -2340,7 +2464,7 @@ print_padding_statement (s)
- int len;
- bfd_vma addr;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- minfo (" *fill*");
-
- @@ -2439,6 +2563,8 @@ print_statement (s, os)
- lang_statement_union_type *s;
- lang_output_section_statement_type *os;
- {
- +
- +
- switch (s->header.type)
- {
- default:
- @@ -2447,13 +2573,13 @@ print_statement (s, os)
- break;
- case lang_constructors_statement_enum:
- if (constructor_list.head != NULL)
- - {
- - if (constructors_sorted)
- - minfo (" SORT (CONSTRUCTORS)\n");
- - else
- - minfo (" CONSTRUCTORS\n");
- - print_statement_list (constructor_list.head, os);
- - }
- + {
- + if (constructors_sorted)
- + minfo (" SORT (CONSTRUCTORS)\n");
- + else
- + minfo (" CONSTRUCTORS\n");
- + print_statement_list (constructor_list.head, os);
- + }
- break;
- case lang_wild_statement_enum:
- print_wild_statement (&s->wild_statement, os);
- @@ -2491,7 +2617,7 @@ print_statement (s, os)
- case lang_output_statement_enum:
- minfo ("OUTPUT(%s", s->output_statement.name);
- if (output_target != NULL)
- - minfo (" %s", output_target);
- + minfo (" %s", output_target);
- minfo (")\n");
- break;
- case lang_input_statement_enum:
- @@ -2531,10 +2657,10 @@ dprint_statement (s, n)
- else
- {
- while (s && --n >= 0)
- - {
- - print_statement (s, abs_output_section);
- - s = s->next;
- - }
- + {
- + print_statement (s, abs_output_section);
- + s = s->next;
- + }
- }
-
- config.map_file = map_save;
- @@ -2557,14 +2683,14 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
- */
-
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
- unsigned int alignment_needed = align_power (dot, power) - dot;
-
- if (alignment_needed != 0)
- {
- lang_statement_union_type *new =
- - ((lang_statement_union_type *)
- - stat_alloc (sizeof (lang_padding_statement_type)));
- + ((lang_statement_union_type *)
- + stat_alloc (sizeof (lang_padding_statement_type)));
-
- /* Link into existing chain */
- new->header.next = *this_ptr;
- @@ -2572,7 +2698,7 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
- new->header.type = lang_padding_statement_enum;
- new->padding_statement.output_section = output_section_statement;
- new->padding_statement.output_offset =
- - dot - output_section_statement->vma;
- + dot - output_section_statement->vma;
- new->padding_statement.fill = fill;
- new->padding_statement.size = alignment_needed * opb;
- }
- @@ -2600,27 +2726,27 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
- lang_input_section_type *is = &((*this_ptr)->input_section);
- asection *i = is->section;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- if (is->ifile->just_syms_flag == false)
- {
- if (output_section_statement->subsection_alignment != -1)
- i->alignment_power =
- - output_section_statement->subsection_alignment;
- + output_section_statement->subsection_alignment;
-
- dot = insert_pad (this_ptr, fill, i->alignment_power,
- - output_section_statement->bfd_section, dot);
- + output_section_statement->bfd_section, dot);
-
- /* Remember where in the output section this input section goes */
-
- i->output_offset = dot - output_section_statement->bfd_section->vma;
-
- /* Mark how big the output section must be to contain this now
- - */
- + */
- if (i->_cooked_size != 0)
- - dot += i->_cooked_size / opb;
- + dot += i->_cooked_size / opb;
- else
- - dot += i->_raw_size / opb;
- + dot += i->_raw_size / opb;
- output_section_statement->bfd_section->_raw_size =
- (dot - output_section_statement->bfd_section->vma) * opb;
- }
- @@ -2652,42 +2778,42 @@ lang_check_section_addresses ()
-
- /* Ignore sections which are not loaded or which have no contents. */
- if (IGNORE_SECTION (output_bfd, s))
- - continue;
- + continue;
-
- /* Once we reach section 's' stop our seach. This prevents two
- - warning messages from being produced, one for 'section A overlaps
- - section B' and one for 'section B overlaps section A'. */
- + warning messages from being produced, one for 'section A overlaps
- + section B' and one for 'section B overlaps section A'. */
- for (os = output_bfd->sections; os != s; os = os->next)
- - {
- - bfd_vma s_start;
- - bfd_vma s_end;
- - bfd_vma os_start;
- - bfd_vma os_end;
- -
- - /* Only consider loadable sections with real contents. */
- - if (IGNORE_SECTION (output_bfd, os))
- - continue;
- -
- - /* We must check the sections' LMA addresses not their
- - VMA addresses because overlay sections can have
- - overlapping VMAs but they must have distinct LMAs. */
- - s_start = bfd_section_lma (output_bfd, s);
- - os_start = bfd_section_lma (output_bfd, os);
- - s_end = s_start + bfd_section_size (output_bfd, s) / opb - 1;
- - os_end = os_start + bfd_section_size (output_bfd, os) / opb - 1;
- -
- - /* Look for an overlap. */
- - if ((s_end < os_start) || (s_start > os_end))
- - continue;
- -
- - einfo (
- + {
- + bfd_vma s_start;
- + bfd_vma s_end;
- + bfd_vma os_start;
- + bfd_vma os_end;
- +
- + /* Only consider loadable sections with real contents. */
- + if (IGNORE_SECTION (output_bfd, os))
- + continue;
- +
- + /* We must check the sections' LMA addresses not their
- + VMA addresses because overlay sections can have
- + overlapping VMAs but they must have distinct LMAs. */
- + s_start = bfd_section_lma (output_bfd, s);
- + os_start = bfd_section_lma (output_bfd, os);
- + s_end = s_start + bfd_section_size (output_bfd, s) / opb - 1;
- + os_end = os_start + bfd_section_size (output_bfd, os) / opb - 1;
- +
- + /* Look for an overlap. */
- + if ((s_end < os_start) || (s_start > os_end))
- + continue;
- +
- + einfo (
- _("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
- - s->name, s_start, s_end, os->name, os_start, os_end);
- -
- - /* Once we have found one overlap for this section,
- - stop looking for others. */
- - break;
- - }
- + s->name, s_start, s_end, os->name, os_start, os_end);
- +
- + /* Once we have found one overlap for this section,
- + stop looking for others. */
- + break;
- + }
- }
- }
-
- @@ -2745,153 +2871,153 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
- boolean relax;
- {
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- /* Size up the sections from their constituent parts. */
- for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
- - {
- - case lang_output_section_statement_enum:
- - {
- - bfd_vma after;
- - lang_output_section_statement_type *os = &s->output_section_statement;
- -
- - if (os->bfd_section == NULL)
- - /* This section was never actually created. */
- - break;
- -
- - /* If this is a COFF shared library section, use the size and
- - address from the input section. FIXME: This is COFF
- - specific; it would be cleaner if there were some other way
- - to do this, but nothing simple comes to mind. */
- - if ((os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
- - {
- - asection * input;
- -
- - if (os->children.head == NULL
- - || os->children.head->next != NULL
- - || os->children.head->header.type != lang_input_section_enum)
- - einfo (_("%P%X: Internal error on COFF shared library section %s\n"),
- - os->name);
- -
- - input = os->children.head->input_section.section;
- - bfd_set_section_vma (os->bfd_section->owner,
- - os->bfd_section,
- - bfd_section_vma (input->owner, input));
- - os->bfd_section->_raw_size = input->_raw_size;
- - break;
- - }
- -
- - if (bfd_is_abs_section (os->bfd_section))
- - {
- - /* No matter what happens, an abs section starts at zero. */
- - ASSERT (os->bfd_section->vma == 0);
- - }
- - else
- - {
- - if (os->addr_tree == (etree_type *) NULL)
- - {
- - /* No address specified for this section, get one
- - from the region specification. */
- - if (os->region == (lang_memory_region_type *) NULL
- - || (((bfd_get_section_flags (output_bfd, os->bfd_section)
- - & (SEC_ALLOC | SEC_LOAD)) != 0)
- - && os->region->name[0] == '*'
- - && strcmp (os->region->name, "*default*") == 0))
- - {
- - os->region = lang_memory_default (os->bfd_section);
- - }
- -
- - /* If a loadable section is using the default memory
- - region, and some non default memory regions were
- - defined, issue a warning. */
- - if ((bfd_get_section_flags (output_bfd, os->bfd_section)
- - & (SEC_ALLOC | SEC_LOAD)) != 0
- - && ! link_info.relocateable
- - && strcmp (os->region->name, "*default*") == 0
- - && lang_memory_region_list != NULL
- - && (strcmp (lang_memory_region_list->name, "*default*") != 0
- - || lang_memory_region_list->next != NULL))
- - einfo (_("%P: warning: no memory region specified for section `%s'\n"),
- - bfd_get_section_name (output_bfd, os->bfd_section));
- -
- - dot = os->region->current;
- + {
- + case lang_output_section_statement_enum:
- + {
- + bfd_vma after;
- + lang_output_section_statement_type *os = &s->output_section_statement;
- +
- + if (os->bfd_section == NULL)
- + /* This section was never actually created. */
- + break;
- +
- + /* If this is a COFF shared library section, use the size and
- + address from the input section. FIXME: This is COFF
- + specific; it would be cleaner if there were some other way
- + to do this, but nothing simple comes to mind. */
- + if ((os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
- + {
- + asection * input;
- +
- + if (os->children.head == NULL
- + || os->children.head->next != NULL
- + || os->children.head->header.type != lang_input_section_enum)
- + einfo (_("%P%X: Internal error on COFF shared library section %s\n"),
- + os->name);
- +
- + input = os->children.head->input_section.section;
- + bfd_set_section_vma (os->bfd_section->owner,
- + os->bfd_section,
- + bfd_section_vma (input->owner, input));
- + os->bfd_section->_raw_size = input->_raw_size;
- + break;
- + }
- +
- + if (bfd_is_abs_section (os->bfd_section))
- + {
- + /* No matter what happens, an abs section starts at zero. */
- + ASSERT (os->bfd_section->vma == 0);
- + }
- + else
- + {
- + if (os->addr_tree == (etree_type *) NULL)
- + {
- + /* No address specified for this section, get one
- + from the region specification. */
- + if (os->region == (lang_memory_region_type *) NULL
- + || (((bfd_get_section_flags (output_bfd, os->bfd_section)
- + & (SEC_ALLOC | SEC_LOAD)) != 0)
- + && os->region->name[0] == '*'
- + && strcmp (os->region->name, "*default*") == 0))
- + {
- + os->region = lang_memory_default (os->bfd_section);
- + }
- +
- + /* If a loadable section is using the default memory
- + region, and some non default memory regions were
- + defined, issue a warning. */
- + if ((bfd_get_section_flags (output_bfd, os->bfd_section)
- + & (SEC_ALLOC | SEC_LOAD)) != 0
- + && ! link_info.relocateable
- + && strcmp (os->region->name, "*default*") == 0
- + && lang_memory_region_list != NULL
- + && (strcmp (lang_memory_region_list->name, "*default*") != 0
- + || lang_memory_region_list->next != NULL))
- + einfo (_("%P: warning: no memory region specified for section `%s'\n"),
- + bfd_get_section_name (output_bfd, os->bfd_section));
- +
- + dot = os->region->current;
-
- - if (os->section_alignment == -1)
- - {
- - bfd_vma olddot;
- -
- - olddot = dot;
- - dot = align_power (dot, os->bfd_section->alignment_power);
- -
- - if (dot != olddot && config.warn_section_align)
- - einfo (_("%P: warning: changing start of section %s by %u bytes\n"),
- - os->name, (unsigned int) (dot - olddot));
- - }
- - }
- - else
- - {
- - etree_value_type r;
- -
- - r = exp_fold_tree (os->addr_tree,
- - abs_output_section,
- - lang_allocating_phase_enum,
- - dot, &dot);
- - if (r.valid_p == false)
- - {
- - einfo (_("%F%S: non constant address expression for section %s\n"),
- - os->name);
- - }
- - dot = r.value + r.section->bfd_section->vma;
- - }
- -
- - /* The section starts here.
- - First, align to what the section needs. */
- -
- - if (os->section_alignment != -1)
- - dot = align_power (dot, os->section_alignment);
- -
- - bfd_set_section_vma (0, os->bfd_section, dot);
- -
- - os->bfd_section->output_offset = 0;
- - }
- -
- - (void) lang_size_sections (os->children.head, os, &os->children.head,
- - os->fill, dot, relax);
- -
- + if (os->section_alignment == -1)
- + {
- + bfd_vma olddot;
- +
- + olddot = dot;
- + dot = align_power (dot, os->bfd_section->alignment_power);
- +
- + if (dot != olddot && config.warn_section_align)
- + einfo (_("%P: warning: changing start of section %s by %u bytes\n"),
- + os->name, (unsigned int) (dot - olddot));
- + }
- + }
- + else
- + {
- + etree_value_type r;
- +
- + r = exp_fold_tree (os->addr_tree,
- + abs_output_section,
- + lang_allocating_phase_enum,
- + dot, &dot);
- + if (r.valid_p == false)
- + {
- + einfo (_("%F%S: non constant address expression for section %s\n"),
- + os->name);
- + }
- + dot = r.value + r.section->bfd_section->vma;
- + }
- +
- + /* The section starts here.
- + First, align to what the section needs. */
- +
- + if (os->section_alignment != -1)
- + dot = align_power (dot, os->section_alignment);
- +
- + bfd_set_section_vma (0, os->bfd_section, dot);
- +
- + os->bfd_section->output_offset = 0;
- + }
- +
- + (void) lang_size_sections (os->children.head, os, &os->children.head,
- + os->fill, dot, relax);
- +
- /* put the section within the requested block size, or align at
- the block boundary */
- - after = ALIGN_N (os->bfd_section->vma
- - + os->bfd_section->_raw_size / opb,
- - /* The coercion here is important, see ld.h. */
- - (bfd_vma) os->block_value);
- -
- - if (bfd_is_abs_section (os->bfd_section))
- - ASSERT (after == os->bfd_section->vma);
- - else
- - os->bfd_section->_raw_size =
- + after = ALIGN_N (os->bfd_section->vma
- + + os->bfd_section->_raw_size / opb,
- + /* The coercion here is important, see ld.h. */
- + (bfd_vma) os->block_value);
- +
- + if (bfd_is_abs_section (os->bfd_section))
- + ASSERT (after == os->bfd_section->vma);
- + else
- + os->bfd_section->_raw_size =
- (after - os->bfd_section->vma) * opb;
- - dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
- - os->processed = true;
- -
- - /* Update dot in the region ?
- - We only do this if the section is going to be allocated,
- - since unallocated sections do not contribute to the region's
- - overall size in memory.
- -
- - If the SEC_NEVER_LOAD bit is not set, it will affect the
- - addresses of sections after it. We have to update
- - dot. */
- - if (os->region != (lang_memory_region_type *) NULL
- - && ((bfd_get_section_flags (output_bfd, os->bfd_section)
- - & SEC_NEVER_LOAD) == 0
- - || (bfd_get_section_flags (output_bfd, os->bfd_section)
- - & (SEC_ALLOC | SEC_LOAD))))
- - {
- - os->region->current = dot;
- -
- - /* Make sure the new address is within the region. */
- + dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
- + os->processed = true;
- +
- + /* Update dot in the region ?
- + We only do this if the section is going to be allocated,
- + since unallocated sections do not contribute to the region's
- + overall size in memory.
- +
- + If the SEC_NEVER_LOAD bit is not set, it will affect the
- + addresses of sections after it. We have to update
- + dot. */
- + if (os->region != (lang_memory_region_type *) NULL
- + && ((bfd_get_section_flags (output_bfd, os->bfd_section)
- + & SEC_NEVER_LOAD) == 0
- + || (bfd_get_section_flags (output_bfd, os->bfd_section)
- + & (SEC_ALLOC | SEC_LOAD))))
- + {
- + os->region->current = dot;
- +
- + /* Make sure the new address is within the region. */
- os_region_check (os, os->region, os->addr_tree,
- os->bfd_section->vma);
-
- @@ -2920,193 +3046,193 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
- }
- }
- }
- - }
- - }
- - break;
- -
- - case lang_constructors_statement_enum:
- - dot = lang_size_sections (constructor_list.head,
- - output_section_statement,
- - &s->wild_statement.children.head,
- - fill,
- - dot, relax);
- - break;
- -
- - case lang_data_statement_enum:
- - {
- - unsigned int size = 0;
- -
- - s->data_statement.output_vma = dot - output_section_statement->bfd_section->vma;
- - s->data_statement.output_section =
- - output_section_statement->bfd_section;
- -
- - switch (s->data_statement.type)
- - {
- + }
- + }
- + break;
- +
- + case lang_constructors_statement_enum:
- + dot = lang_size_sections (constructor_list.head,
- + output_section_statement,
- + &s->wild_statement.children.head,
- + fill,
- + dot, relax);
- + break;
- +
- + case lang_data_statement_enum:
- + {
- + unsigned int size = 0;
- +
- + s->data_statement.output_vma = dot - output_section_statement->bfd_section->vma;
- + s->data_statement.output_section =
- + output_section_statement->bfd_section;
- +
- + switch (s->data_statement.type)
- + {
- default:
- abort();
- - case QUAD:
- - case SQUAD:
- - size = QUAD_SIZE;
- - break;
- - case LONG:
- - size = LONG_SIZE;
- - break;
- - case SHORT:
- - size = SHORT_SIZE;
- - break;
- - case BYTE:
- - size = BYTE_SIZE;
- - break;
- - }
- + case QUAD:
- + case SQUAD:
- + size = QUAD_SIZE;
- + break;
- + case LONG:
- + size = LONG_SIZE;
- + break;
- + case SHORT:
- + size = SHORT_SIZE;
- + break;
- + case BYTE:
- + size = BYTE_SIZE;
- + break;
- + }
- if (size < opb)
- size = opb;
- - dot += size / opb;
- - output_section_statement->bfd_section->_raw_size += size;
- - /* The output section gets contents, and then we inspect for
- - any flags set in the input script which override any ALLOC. */
- - output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS;
- - if (!(output_section_statement->flags & SEC_NEVER_LOAD)) {
- - output_section_statement->bfd_section->flags |= SEC_ALLOC | SEC_LOAD;
- - }
- - }
- - break;
- -
- - case lang_reloc_statement_enum:
- - {
- - int size;
- -
- - s->reloc_statement.output_vma =
- - dot - output_section_statement->bfd_section->vma;
- - s->reloc_statement.output_section =
- - output_section_statement->bfd_section;
- - size = bfd_get_reloc_size (s->reloc_statement.howto);
- - dot += size / opb;
- - output_section_statement->bfd_section->_raw_size += size;
- - }
- - break;
- + dot += size / opb;
- + output_section_statement->bfd_section->_raw_size += size;
- + /* The output section gets contents, and then we inspect for
- + any flags set in the input script which override any ALLOC. */
- + output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS;
- + if (!(output_section_statement->flags & SEC_NEVER_LOAD)) {
- + output_section_statement->bfd_section->flags |= SEC_ALLOC | SEC_LOAD;
- + }
- + }
- + break;
- +
- + case lang_reloc_statement_enum:
- + {
- + int size;
- +
- + s->reloc_statement.output_vma =
- + dot - output_section_statement->bfd_section->vma;
- + s->reloc_statement.output_section =
- + output_section_statement->bfd_section;
- + size = bfd_get_reloc_size (s->reloc_statement.howto);
- + dot += size / opb;
- + output_section_statement->bfd_section->_raw_size += size;
- + }
- + break;
-
- - case lang_wild_statement_enum:
- -
- - dot = lang_size_sections (s->wild_statement.children.head,
- - output_section_statement,
- - &s->wild_statement.children.head,
- -
- - fill, dot, relax);
- -
- - break;
- -
- - case lang_object_symbols_statement_enum:
- - link_info.create_object_symbols_section =
- - output_section_statement->bfd_section;
- - break;
- - case lang_output_statement_enum:
- - case lang_target_statement_enum:
- - break;
- - case lang_input_section_enum:
- - {
- - asection *i;
- -
- - i = (*prev)->input_section.section;
- - if (! relax)
- - {
- - if (i->_cooked_size == 0)
- - i->_cooked_size = i->_raw_size;
- - }
- - else
- - {
- - boolean again;
- -
- - if (! bfd_relax_section (i->owner, i, &link_info, &again))
- - einfo (_("%P%F: can't relax section: %E\n"));
- - if (again)
- - relax_again = true;
- - }
- - dot = size_input_section (prev,
- - output_section_statement,
- - output_section_statement->fill,
- - dot, relax);
- - }
- - break;
- - case lang_input_statement_enum:
- - break;
- - case lang_fill_statement_enum:
- - s->fill_statement.output_section = output_section_statement->bfd_section;
- -
- - fill = s->fill_statement.fill;
- - break;
- - case lang_assignment_statement_enum:
- - {
- - bfd_vma newdot = dot;
- -
- - exp_fold_tree (s->assignment_statement.exp,
- - output_section_statement,
- - lang_allocating_phase_enum,
- - dot,
- - &newdot);
- -
- - if (newdot != dot)
- - {
- - /* The assignment changed dot. Insert a pad. */
- - if (output_section_statement == abs_output_section)
- - {
- - /* If we don't have an output section, then just adjust
- - the default memory address. */
- - lang_memory_region_lookup ("*default*")->current = newdot;
- - }
- - else if (!relax)
- - {
- - lang_statement_union_type *new =
- - ((lang_statement_union_type *)
- - stat_alloc (sizeof (lang_padding_statement_type)));
- -
- - /* Link into existing chain. */
- - new->header.next = *prev;
- - *prev = new;
- - new->header.type = lang_padding_statement_enum;
- - new->padding_statement.output_section =
- - output_section_statement->bfd_section;
- - new->padding_statement.output_offset =
- - dot - output_section_statement->bfd_section->vma;
- - new->padding_statement.fill = fill;
- - new->padding_statement.size = (newdot - dot) * opb;
- - output_section_statement->bfd_section->_raw_size +=
- - new->padding_statement.size;
- - }
- -
- - dot = newdot;
- - }
- - }
- - break;
- -
- - case lang_padding_statement_enum:
- - /* If we are relaxing, and this is not the first pass, some
- - padding statements may have been inserted during previous
- - passes. We may have to move the padding statement to a new
- - location if dot has a different value at this point in this
- - pass than it did at this point in the previous pass. */
- - s->padding_statement.output_offset =
- - dot - output_section_statement->bfd_section->vma;
- - dot += s->padding_statement.size / opb;
- - output_section_statement->bfd_section->_raw_size +=
- - s->padding_statement.size;
- - break;
- -
- - case lang_group_statement_enum:
- - dot = lang_size_sections (s->group_statement.children.head,
- - output_section_statement,
- - &s->group_statement.children.head,
- - fill, dot, relax);
- - break;
- -
- - default:
- - FAIL ();
- - break;
- -
- - /* This can only get here when relaxing is turned on. */
- -
- - case lang_address_statement_enum:
- - break;
- - }
- + case lang_wild_statement_enum:
- +
- + dot = lang_size_sections (s->wild_statement.children.head,
- + output_section_statement,
- + &s->wild_statement.children.head,
- +
- + fill, dot, relax);
- +
- + break;
- +
- + case lang_object_symbols_statement_enum:
- + link_info.create_object_symbols_section =
- + output_section_statement->bfd_section;
- + break;
- + case lang_output_statement_enum:
- + case lang_target_statement_enum:
- + break;
- + case lang_input_section_enum:
- + {
- + asection *i;
- +
- + i = (*prev)->input_section.section;
- + if (! relax)
- + {
- + if (i->_cooked_size == 0)
- + i->_cooked_size = i->_raw_size;
- + }
- + else
- + {
- + boolean again;
- +
- + if (! bfd_relax_section (i->owner, i, &link_info, &again))
- + einfo (_("%P%F: can't relax section: %E\n"));
- + if (again)
- + relax_again = true;
- + }
- + dot = size_input_section (prev,
- + output_section_statement,
- + output_section_statement->fill,
- + dot, relax);
- + }
- + break;
- + case lang_input_statement_enum:
- + break;
- + case lang_fill_statement_enum:
- + s->fill_statement.output_section = output_section_statement->bfd_section;
- +
- + fill = s->fill_statement.fill;
- + break;
- + case lang_assignment_statement_enum:
- + {
- + bfd_vma newdot = dot;
- +
- + exp_fold_tree (s->assignment_statement.exp,
- + output_section_statement,
- + lang_allocating_phase_enum,
- + dot,
- + &newdot);
- +
- + if (newdot != dot)
- + {
- + /* The assignment changed dot. Insert a pad. */
- + if (output_section_statement == abs_output_section)
- + {
- + /* If we don't have an output section, then just adjust
- + the default memory address. */
- + lang_memory_region_lookup ("*default*")->current = newdot;
- + }
- + else if (!relax)
- + {
- + lang_statement_union_type *new =
- + ((lang_statement_union_type *)
- + stat_alloc (sizeof (lang_padding_statement_type)));
- +
- + /* Link into existing chain. */
- + new->header.next = *prev;
- + *prev = new;
- + new->header.type = lang_padding_statement_enum;
- + new->padding_statement.output_section =
- + output_section_statement->bfd_section;
- + new->padding_statement.output_offset =
- + dot - output_section_statement->bfd_section->vma;
- + new->padding_statement.fill = fill;
- + new->padding_statement.size = (newdot - dot) * opb;
- + output_section_statement->bfd_section->_raw_size +=
- + new->padding_statement.size;
- + }
- +
- + dot = newdot;
- + }
- + }
- + break;
- +
- + case lang_padding_statement_enum:
- + /* If we are relaxing, and this is not the first pass, some
- + padding statements may have been inserted during previous
- + passes. We may have to move the padding statement to a new
- + location if dot has a different value at this point in this
- + pass than it did at this point in the previous pass. */
- + s->padding_statement.output_offset =
- + dot - output_section_statement->bfd_section->vma;
- + dot += s->padding_statement.size / opb;
- + output_section_statement->bfd_section->_raw_size +=
- + s->padding_statement.size;
- + break;
- +
- + case lang_group_statement_enum:
- + dot = lang_size_sections (s->group_statement.children.head,
- + output_section_statement,
- + &s->group_statement.children.head,
- + fill, dot, relax);
- + break;
- +
- + default:
- + FAIL ();
- + break;
- +
- + /* This can only get here when relaxing is turned on. */
- +
- + case lang_address_statement_enum:
- + break;
- + }
- prev = &s->header.next;
- }
- return dot;
- @@ -3120,70 +3246,70 @@ lang_do_assignments (s, output_section_statement, fill, dot)
- bfd_vma dot;
- {
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
- - {
- - case lang_constructors_statement_enum:
- - dot = lang_do_assignments (constructor_list.head,
- - output_section_statement,
- - fill,
- - dot);
- - break;
- -
- - case lang_output_section_statement_enum:
- - {
- - lang_output_section_statement_type *os =
- - &(s->output_section_statement);
- -
- - if (os->bfd_section != NULL)
- - {
- - dot = os->bfd_section->vma;
- - (void) lang_do_assignments (os->children.head, os,
- - os->fill, dot);
- - dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
- -
- - }
- - if (os->load_base)
- - {
- - /* If nothing has been placed into the output section then
- - it won't have a bfd_section. */
- - if (os->bfd_section)
- - {
- - os->bfd_section->lma
- - = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
- - }
- - }
- - }
- - break;
- - case lang_wild_statement_enum:
- -
- - dot = lang_do_assignments (s->wild_statement.children.head,
- - output_section_statement,
- - fill, dot);
- -
- - break;
- -
- - case lang_object_symbols_statement_enum:
- - case lang_output_statement_enum:
- - case lang_target_statement_enum:
- + {
- + case lang_constructors_statement_enum:
- + dot = lang_do_assignments (constructor_list.head,
- + output_section_statement,
- + fill,
- + dot);
- + break;
- +
- + case lang_output_section_statement_enum:
- + {
- + lang_output_section_statement_type *os =
- + &(s->output_section_statement);
- +
- + if (os->bfd_section != NULL)
- + {
- + dot = os->bfd_section->vma;
- + (void) lang_do_assignments (os->children.head, os,
- + os->fill, dot);
- + dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
- +
- + }
- + if (os->load_base)
- + {
- + /* If nothing has been placed into the output section then
- + it won't have a bfd_section. */
- + if (os->bfd_section)
- + {
- + os->bfd_section->lma
- + = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
- + }
- + }
- + }
- + break;
- + case lang_wild_statement_enum:
- +
- + dot = lang_do_assignments (s->wild_statement.children.head,
- + output_section_statement,
- + fill, dot);
- +
- + break;
- +
- + case lang_object_symbols_statement_enum:
- + case lang_output_statement_enum:
- + case lang_target_statement_enum:
- #if 0
- - case lang_common_statement_enum:
- + case lang_common_statement_enum:
- #endif
- - break;
- - case lang_data_statement_enum:
- - {
- - etree_value_type value;
- -
- - value = exp_fold_tree (s->data_statement.exp,
- - abs_output_section,
- - lang_final_phase_enum, dot, &dot);
- - s->data_statement.value = value.value;
- - if (value.valid_p == false)
- - einfo (_("%F%P: invalid data statement\n"));
- - }
- + break;
- + case lang_data_statement_enum:
- + {
- + etree_value_type value;
- +
- + value = exp_fold_tree (s->data_statement.exp,
- + abs_output_section,
- + lang_final_phase_enum, dot, &dot);
- + s->data_statement.value = value.value;
- + if (value.valid_p == false)
- + einfo (_("%F%P: invalid data statement\n"));
- + }
- {
- unsigned int size;
- switch (s->data_statement.type)
- @@ -3208,65 +3334,65 @@ lang_do_assignments (s, output_section_statement, fill, dot)
- size = opb;
- dot += size / opb;
- }
- - break;
- -
- - case lang_reloc_statement_enum:
- - {
- - etree_value_type value;
- -
- - value = exp_fold_tree (s->reloc_statement.addend_exp,
- - abs_output_section,
- - lang_final_phase_enum, dot, &dot);
- - s->reloc_statement.addend_value = value.value;
- - if (value.valid_p == false)
- - einfo (_("%F%P: invalid reloc statement\n"));
- - }
- - dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
- - break;
- -
- - case lang_input_section_enum:
- - {
- - asection *in = s->input_section.section;
- -
- - if (in->_cooked_size != 0)
- - dot += in->_cooked_size / opb;
- - else
- - dot += in->_raw_size / opb;
- - }
- - break;
- -
- - case lang_input_statement_enum:
- - break;
- - case lang_fill_statement_enum:
- - fill = s->fill_statement.fill;
- - break;
- - case lang_assignment_statement_enum:
- - {
- - exp_fold_tree (s->assignment_statement.exp,
- - output_section_statement,
- - lang_final_phase_enum,
- - dot,
- - &dot);
- - }
- -
- - break;
- - case lang_padding_statement_enum:
- - dot += s->padding_statement.size / opb;
- - break;
- -
- - case lang_group_statement_enum:
- - dot = lang_do_assignments (s->group_statement.children.head,
- - output_section_statement,
- - fill, dot);
- -
- - break;
- -
- - default:
- - FAIL ();
- - break;
- - case lang_address_statement_enum:
- - break;
- - }
- + break;
- +
- + case lang_reloc_statement_enum:
- + {
- + etree_value_type value;
- +
- + value = exp_fold_tree (s->reloc_statement.addend_exp,
- + abs_output_section,
- + lang_final_phase_enum, dot, &dot);
- + s->reloc_statement.addend_value = value.value;
- + if (value.valid_p == false)
- + einfo (_("%F%P: invalid reloc statement\n"));
- + }
- + dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
- + break;
- +
- + case lang_input_section_enum:
- + {
- + asection *in = s->input_section.section;
- +
- + if (in->_cooked_size != 0)
- + dot += in->_cooked_size / opb;
- + else
- + dot += in->_raw_size / opb;
- + }
- + break;
- +
- + case lang_input_statement_enum:
- + break;
- + case lang_fill_statement_enum:
- + fill = s->fill_statement.fill;
- + break;
- + case lang_assignment_statement_enum:
- + {
- + exp_fold_tree (s->assignment_statement.exp,
- + output_section_statement,
- + lang_final_phase_enum,
- + dot,
- + &dot);
- + }
- +
- + break;
- + case lang_padding_statement_enum:
- + dot += s->padding_statement.size / opb;
- + break;
- +
- + case lang_group_statement_enum:
- + dot = lang_do_assignments (s->group_statement.children.head,
- + output_section_statement,
- + fill, dot);
- +
- + break;
- +
- + default:
- + FAIL ();
- + break;
- + case lang_address_statement_enum:
- + break;
- + }
-
- }
- return dot;
- @@ -3299,25 +3425,25 @@ lang_set_startof ()
- sprintf (buf, ".startof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
- if (h != NULL && h->type == bfd_link_hash_undefined)
- - {
- - h->type = bfd_link_hash_defined;
- - h->u.def.value = bfd_get_section_vma (output_bfd, s);
- - h->u.def.section = bfd_abs_section_ptr;
- - }
- + {
- + h->type = bfd_link_hash_defined;
- + h->u.def.value = bfd_get_section_vma (output_bfd, s);
- + h->u.def.section = bfd_abs_section_ptr;
- + }
-
- sprintf (buf, ".sizeof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
- if (h != NULL && h->type == bfd_link_hash_undefined)
- - {
- + {
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- - h->type = bfd_link_hash_defined;
- - if (s->_cooked_size != 0)
- - h->u.def.value = s->_cooked_size / opb;
- - else
- - h->u.def.value = s->_raw_size / opb;
- - h->u.def.section = bfd_abs_section_ptr;
- - }
- + ldfile_output_machine);
- + h->type = bfd_link_hash_defined;
- + if (s->_cooked_size != 0)
- + h->u.def.value = s->_cooked_size / opb;
- + else
- + h->u.def.value = s->_raw_size / opb;
- + h->u.def.section = bfd_abs_section_ptr;
- + }
-
- free (buf);
- }
- @@ -3337,7 +3463,7 @@ lang_finish ()
- if (entry_symbol == (char *) NULL)
- {
- /* No entry has been specified. Look for start, but don't warn
- - if we don't find it. */
- + if we don't find it. */
- entry_symbol = "start";
- warn = false;
- }
- @@ -3345,17 +3471,17 @@ lang_finish ()
- h = bfd_link_hash_lookup (link_info.hash, entry_symbol, false, false, true);
- if (h != (struct bfd_link_hash_entry *) NULL
- && (h->type == bfd_link_hash_defined
- - || h->type == bfd_link_hash_defweak)
- + || h->type == bfd_link_hash_defweak)
- && h->u.def.section->output_section != NULL)
- {
- bfd_vma val;
-
- val = (h->u.def.value
- - + bfd_get_section_vma (output_bfd,
- - h->u.def.section->output_section)
- - + h->u.def.section->output_offset);
- + + bfd_get_section_vma (output_bfd,
- + h->u.def.section->output_section)
- + + h->u.def.section->output_offset);
- if (! bfd_set_start_address (output_bfd, val))
- - einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
- + einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
- }
- else
- {
- @@ -3366,34 +3492,34 @@ lang_finish ()
- number. */
- val = bfd_scan_vma (entry_symbol, &send, 0);
- if (*send == '\0')
- - {
- - if (! bfd_set_start_address (output_bfd, val))
- - einfo (_("%P%F: can't set start address\n"));
- - }
- + {
- + if (! bfd_set_start_address (output_bfd, val))
- + einfo (_("%P%F: can't set start address\n"));
- + }
- else
- - {
- - asection *ts;
- + {
- + asection *ts;
-
- - /* Can't find the entry symbol, and it's not a number. Use
- - the first address in the text section. */
- - ts = bfd_get_section_by_name (output_bfd, ".text");
- - if (ts != (asection *) NULL)
- - {
- - if (warn)
- - einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
- - entry_symbol, bfd_get_section_vma (output_bfd, ts));
- - if (! bfd_set_start_address (output_bfd,
- - bfd_get_section_vma (output_bfd,
- - ts)))
- - einfo (_("%P%F: can't set start address\n"));
- - }
- - else
- - {
- - if (warn)
- - einfo (_("%P: warning: cannot find entry symbol %s; not setting start address\n"),
- - entry_symbol);
- - }
- - }
- + /* Can't find the entry symbol, and it's not a number. Use
- + the first address in the text section. */
- + ts = bfd_get_section_by_name (output_bfd, ".text");
- + if (ts != (asection *) NULL)
- + {
- + if (warn)
- + einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
- + entry_symbol, bfd_get_section_vma (output_bfd, ts));
- + if (! bfd_set_start_address (output_bfd,
- + bfd_get_section_vma (output_bfd,
- + ts)))
- + einfo (_("%P%F: can't set start address\n"));
- + }
- + else
- + {
- + if (warn)
- + einfo (_("%P: warning: cannot find entry symbol %s; not setting start address\n"),
- + entry_symbol);
- + }
- + }
- }
- }
-
- @@ -3428,34 +3554,34 @@ lang_check ()
- {
- input_bfd = file->input_statement.the_bfd;
- compatible = bfd_arch_get_compatible (input_bfd,
- - output_bfd);
- + output_bfd);
- if (compatible == NULL)
- - {
- - if (command_line.warn_mismatch)
- - einfo (_("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n"),
- - bfd_printable_name (input_bfd), input_bfd,
- - bfd_printable_name (output_bfd));
- - }
- + {
- + if (command_line.warn_mismatch)
- + einfo (_("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n"),
- + bfd_printable_name (input_bfd), input_bfd,
- + bfd_printable_name (output_bfd));
- + }
- else
- - {
- - bfd_error_handler_type pfn = NULL;
- + {
- + bfd_error_handler_type pfn = NULL;
-
- - /* If we aren't supposed to warn about mismatched input
- + /* If we aren't supposed to warn about mismatched input
- files, temporarily set the BFD error handler to a
- function which will do nothing. We still want to call
- bfd_merge_private_bfd_data, since it may set up
- information which is needed in the output file. */
- - if (! command_line.warn_mismatch)
- - pfn = bfd_set_error_handler (ignore_bfd_errors);
- - if (! bfd_merge_private_bfd_data (input_bfd, output_bfd))
- - {
- - if (command_line.warn_mismatch)
- - einfo (_("%E%X: failed to merge target specific data of file %B\n"),
- - input_bfd);
- - }
- - if (! command_line.warn_mismatch)
- - bfd_set_error_handler (pfn);
- - }
- + if (! command_line.warn_mismatch)
- + pfn = bfd_set_error_handler (ignore_bfd_errors);
- + if (! bfd_merge_private_bfd_data (input_bfd, output_bfd))
- + {
- + if (command_line.warn_mismatch)
- + einfo (_("%E%X: failed to merge target specific data of file %B\n"),
- + input_bfd);
- + }
- + if (! command_line.warn_mismatch)
- + bfd_set_error_handler (pfn);
- + }
- }
- }
-
- @@ -3477,8 +3603,8 @@ lang_common ()
- int power;
-
- for (power = 4; power >= 0; power--)
- - bfd_link_hash_traverse (link_info.hash, lang_one_common,
- - (PTR) &power);
- + bfd_link_hash_traverse (link_info.hash, lang_one_common,
- + (PTR) &power);
- }
- }
-
- @@ -3493,7 +3619,7 @@ lang_one_common (h, info)
- bfd_vma size;
- asection *section;
- unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
- - ldfile_output_machine);
- + ldfile_output_machine);
-
- if (h->type != bfd_link_hash_common)
- return true;
- @@ -3509,7 +3635,7 @@ lang_one_common (h, info)
-
- /* Increase the size of the section. */
- section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
- - (bfd_size_type) (1 << power_of_two)) * opb;
- + (bfd_size_type) (1 << power_of_two)) * opb;
-
- /* Adjust the alignment if necessary. */
- if (power_of_two > section->alignment_power)
- @@ -3536,11 +3662,11 @@ lang_one_common (h, info)
- char buf[50];
-
- if (! header_printed)
- - {
- - minfo (_("\nAllocating common symbols\n"));
- - minfo (_("Common symbol size file\n\n"));
- - header_printed = true;
- - }
- + {
- + minfo (_("\nAllocating common symbols\n"));
- + minfo (_("Common symbol size file\n\n"));
- + header_printed = true;
- + }
-
- name = demangle (h->root.string);
- minfo ("%s", name);
- @@ -3548,29 +3674,29 @@ lang_one_common (h, info)
- free (name);
-
- if (len >= 19)
- - {
- - print_nl ();
- - len = 0;
- - }
- + {
- + print_nl ();
- + len = 0;
- + }
- while (len < 20)
- - {
- - print_space ();
- - ++len;
- - }
- + {
- + print_space ();
- + ++len;
- + }
-
- minfo ("0x");
- if (size <= 0xffffffff)
- - sprintf (buf, "%lx", (unsigned long) size);
- + sprintf (buf, "%lx", (unsigned long) size);
- else
- - sprintf_vma (buf, size);
- + sprintf_vma (buf, size);
- minfo ("%s", buf);
- len = strlen (buf);
-
- while (len < 16)
- - {
- - print_space ();
- - ++len;
- - }
- + {
- + print_space ();
- + ++len;
- + }
-
- minfo ("%B\n", section->owner);
- }
- @@ -3593,57 +3719,57 @@ lang_place_orphans ()
- asection *s;
-
- for (s = file->the_bfd->sections;
- - s != (asection *) NULL;
- - s = s->next)
- - {
- - if (s->output_section == (asection *) NULL)
- - {
- - /* This section of the file is not attatched, root
- - around for a sensible place for it to go */
- + s != (asection *) NULL;
- + s = s->next)
- + {
- + if (s->output_section == (asection *) NULL)
- + {
- + /* This section of the file is not attatched, root
- + around for a sensible place for it to go */
-
- - if (file->just_syms_flag)
- - {
- - /* We are only retrieving symbol values from this
- + if (file->just_syms_flag)
- + {
- + /* We are only retrieving symbol values from this
- file. We want the symbols to act as though the
- values in the file are absolute. */
- - s->output_section = bfd_abs_section_ptr;
- - s->output_offset = s->vma;
- - }
- - else if (strcmp (s->name, "COMMON") == 0)
- - {
- - /* This is a lonely common section which must have
- - come from an archive. We attach to the section
- - with the wildcard. */
- - if (! link_info.relocateable
- - || command_line.force_common_definition)
- - {
- - if (default_common_section == NULL)
- - {
- + s->output_section = bfd_abs_section_ptr;
- + s->output_offset = s->vma;
- + }
- + else if (strcmp (s->name, "COMMON") == 0)
- + {
- + /* This is a lonely common section which must have
- + come from an archive. We attach to the section
- + with the wildcard. */
- + if (! link_info.relocateable
- + || command_line.force_common_definition)
- + {
- + if (default_common_section == NULL)
- + {
- #if 0
- - /* This message happens when using the
- + /* This message happens when using the
- svr3.ifile linker script, so I have
- disabled it. */
- - info_msg (_("%P: no [COMMON] command, defaulting to .bss\n"));
- + info_msg (_("%P: no [COMMON] command, defaulting to .bss\n"));
- #endif
- - default_common_section =
- - lang_output_section_statement_lookup (".bss");
- + default_common_section =
- + lang_output_section_statement_lookup (".bss");
-
- - }
- - wild_doit (&default_common_section->children, s,
- - default_common_section, file);
- - }
- - }
- - else if (ldemul_place_orphan (file, s))
- - ;
- - else
- - {
- - lang_output_section_statement_type *os =
- - lang_output_section_statement_lookup (s->name);
- + }
- + wild_doit (&default_common_section->children, s,
- + default_common_section, file);
- + }
- + }
- + else if (ldemul_place_orphan (file, s))
- + ;
- + else
- + {
- + lang_output_section_statement_type *os =
- + lang_output_section_statement_lookup (s->name);
-
- - wild_doit (&os->children, s, os, file);
- - }
- - }
- - }
- + wild_doit (&os->children, s, os, file);
- + }
- + }
- + }
- }
- }
-
- @@ -3660,32 +3786,32 @@ lang_set_flags (ptr, flags, invert)
- while (*flags)
- {
- switch (*flags)
- - {
- - case 'A': case 'a':
- - *ptr_flags |= SEC_ALLOC;
- - break;
- -
- - case 'R': case 'r':
- - *ptr_flags |= SEC_READONLY;
- - break;
- -
- - case 'W': case 'w':
- - *ptr_flags |= SEC_DATA;
- - break;
- -
- - case 'X': case 'x':
- - *ptr_flags |= SEC_CODE;
- - break;
- -
- - case 'L': case 'l':
- - case 'I': case 'i':
- - *ptr_flags |= SEC_LOAD;
- - break;
- -
- - default:
- - einfo (_("%P%F: invalid syntax in flags\n"));
- - break;
- - }
- + {
- + case 'A': case 'a':
- + *ptr_flags |= SEC_ALLOC;
- + break;
- +
- + case 'R': case 'r':
- + *ptr_flags |= SEC_READONLY;
- + break;
- +
- + case 'W': case 'w':
- + *ptr_flags |= SEC_DATA;
- + break;
- +
- + case 'X': case 'x':
- + *ptr_flags |= SEC_CODE;
- + break;
- +
- + case 'L': case 'l':
- + case 'I': case 'i':
- + *ptr_flags |= SEC_LOAD;
- + break;
- +
- + default:
- + einfo (_("%P%F: invalid syntax in flags\n"));
- + break;
- + }
- flags++;
- }
- }
- @@ -3732,11 +3858,11 @@ lang_for_each_input_section (func)
- asection * s;
-
- for (s = f->the_bfd->sections;
- - s != (asection *) NULL;
- - s = s->next)
- - {
- - func (f->the_bfd, s);
- - }
- + s != (asection *) NULL;
- + s = s->next)
- + {
- + func (f->the_bfd, s);
- + }
- }
- }
-
- @@ -3749,8 +3875,8 @@ ldlang_add_file (entry)
- bfd **pp;
-
- lang_statement_append (&file_chain,
- - (lang_statement_union_type *) entry,
- - &entry->next);
- + (lang_statement_union_type *) entry,
- + &entry->next);
-
- /* The BFD linker needs to have a list of all input BFDs involved in
- a link. */
- @@ -3806,7 +3932,7 @@ topower (x)
- for (l = 0; l < 32; l++)
- {
- if (i >= (unsigned int) x)
- - return l;
- + return l;
- i <<= 1;
- }
-
- @@ -3815,8 +3941,8 @@ topower (x)
-
- lang_output_section_statement_type *
- lang_enter_output_section_statement (output_section_statement_name,
- - address_exp, sectype, block_value,
- - align, subalign, ebase)
- + address_exp, sectype, block_value,
- + align, subalign, ebase)
- const char *output_section_statement_name;
- etree_type * address_exp;
- enum section_type sectype;
- @@ -3854,11 +3980,11 @@ lang_enter_output_section_statement (output_section_statement_name,
-
- os->subsection_alignment = topower(
- exp_get_value_int(subalign, -1,
- - "subsection alignment",
- - 0));
- + "subsection alignment",
- + 0));
- os->section_alignment = topower(
- exp_get_value_int(align, -1,
- - "section alignment", 0));
- + "section alignment", 0));
-
- os->load_base = ebase;
- return os;
- @@ -3926,24 +4052,24 @@ lang_gc_sections_1 (s)
- for (; s != (lang_statement_union_type *) NULL; s = s->next)
- {
- switch (s->header.type)
- - {
- - case lang_wild_statement_enum:
- - lang_gc_wild (&s->wild_statement,
- - s->wild_statement.section_name,
- - s->wild_statement.filename);
- - break;
- - case lang_constructors_statement_enum:
- - lang_gc_sections_1 (constructor_list.head);
- - break;
- - case lang_output_section_statement_enum:
- - lang_gc_sections_1 (s->output_section_statement.children.head);
- - break;
- - case lang_group_statement_enum:
- - lang_gc_sections_1 (s->group_statement.children.head);
- - break;
- - default:
- - break;
- - }
- + {
- + case lang_wild_statement_enum:
- + lang_gc_wild (&s->wild_statement,
- + s->wild_statement.section_name,
- + s->wild_statement.filename);
- + break;
- + case lang_constructors_statement_enum:
- + lang_gc_sections_1 (constructor_list.head);
- + break;
- + case lang_output_section_statement_enum:
- + lang_gc_sections_1 (s->output_section_statement.children.head);
- + break;
- + case lang_group_statement_enum:
- + lang_gc_sections_1 (s->group_statement.children.head);
- + break;
- + default:
- + break;
- + }
- }
- }
-
- @@ -3972,15 +4098,15 @@ lang_gc_sections ()
- for (; ulist; ulist = ulist->next)
- {
- h = bfd_link_hash_lookup (link_info.hash, ulist->name,
- - false, false, false);
- + false, false, false);
-
- if (h != (struct bfd_link_hash_entry *) NULL
- && (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak)
- - && ! bfd_is_abs_section (h->u.def.section))
- - {
- - h->u.def.section->flags |= SEC_KEEP;
- - }
- + && ! bfd_is_abs_section (h->u.def.section))
- + {
- + h->u.def.section->flags |= SEC_KEEP;
- + }
- }
-
- bfd_gc_sections (output_bfd, &link_info);
- @@ -3992,7 +4118,7 @@ lang_process ()
- lang_reasonable_defaults ();
- current_target = default_target;
-
- - lang_for_each_statement (ldlang_open_output); /* Open the output file */
- + lang_for_each_statement (ldlang_open_output); /* Open the output file */
-
- ldemul_create_output_section_statements ();
-
- @@ -4035,7 +4161,7 @@ lang_process ()
- to the correct output sections
- */
- map_input_to_output_sections (statement_list.head, (char *) NULL,
- - (lang_output_section_statement_type *) NULL);
- + (lang_output_section_statement_type *) NULL);
-
-
- /* Find any sections not attached explicitly and handle them */
- @@ -4051,42 +4177,42 @@ lang_process ()
- if (command_line.relax)
- {
- /* First time round is a trial run to get the 'worst case'
- - addresses of the objects if there was no relaxing. */
- + addresses of the objects if there was no relaxing. */
- lang_size_sections (statement_list.head,
- - abs_output_section,
- - &(statement_list.head), 0, (bfd_vma) 0, false);
- + abs_output_section,
- + &(statement_list.head), 0, (bfd_vma) 0, false);
-
- /* Keep relaxing until bfd_relax_section gives up. */
- do
- - {
- - reset_memory_regions ();
- -
- - relax_again = false;
- -
- - /* Note: pe-dll.c does something like this also. If you find
- - you need to change this code, you probably need to change
- - pe-dll.c also. DJ */
- -
- - /* Do all the assignments with our current guesses as to
- - section sizes. */
- - lang_do_assignments (statement_list.head,
- - abs_output_section,
- - (fill_type) 0, (bfd_vma) 0);
- -
- - /* Perform another relax pass - this time we know where the
- - globals are, so can make better guess. */
- - lang_size_sections (statement_list.head,
- - abs_output_section,
- - &(statement_list.head), 0, (bfd_vma) 0, true);
- - }
- + {
- + reset_memory_regions ();
- +
- + relax_again = false;
- +
- + /* Note: pe-dll.c does something like this also. If you find
- + you need to change this code, you probably need to change
- + pe-dll.c also. DJ */
- +
- + /* Do all the assignments with our current guesses as to
- + section sizes. */
- + lang_do_assignments (statement_list.head,
- + abs_output_section,
- + (fill_type) 0, (bfd_vma) 0);
- +
- + /* Perform another relax pass - this time we know where the
- + globals are, so can make better guess. */
- + lang_size_sections (statement_list.head,
- + abs_output_section,
- + &(statement_list.head), 0, (bfd_vma) 0, true);
- + }
- while (relax_again);
- }
- else
- {
- /* Size up the sections. */
- lang_size_sections (statement_list.head,
- - abs_output_section,
- - &(statement_list.head), 0, (bfd_vma) 0, false);
- + abs_output_section,
- + &(statement_list.head), 0, (bfd_vma) 0, false);
- }
-
- /* See if anything special should be done now we know how big
- @@ -4100,8 +4226,8 @@ lang_process ()
- of all the symbols */
-
- lang_do_assignments (statement_list.head,
- - abs_output_section,
- - (fill_type) 0, (bfd_vma) 0);
- + abs_output_section,
- + (fill_type) 0, (bfd_vma) 0);
-
- /* Make sure that the section addresses make sense. */
- if (! link_info.relocateable
- @@ -4118,7 +4244,7 @@ lang_process ()
-
- void
- lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
- - keep_sections, exclude_filename_list)
- + keep_sections, exclude_filename_list)
- const char *const section_name;
- boolean sections_sorted;
- const char *const filename;
- @@ -4127,7 +4253,7 @@ lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
- struct name_list *exclude_filename_list;
- {
- lang_wild_statement_type *new = new_stat (lang_wild_statement,
- - stat_ptr);
- + stat_ptr);
-
- if (section_name != (char *) NULL && strcmp (section_name, "COMMON") == 0)
- {
- @@ -4181,7 +4307,7 @@ lang_add_target (name)
- CONST char *name;
- {
- lang_target_statement_type *new = new_stat (lang_target_statement,
- - stat_ptr);
- + stat_ptr);
-
- new->target = name;
-
- @@ -4194,11 +4320,11 @@ lang_add_map (name)
- while (*name)
- {
- switch (*name)
- - {
- - case 'F':
- - map_option_f = true;
- - break;
- - }
- + {
- + case 'F':
- + map_option_f = true;
- + break;
- + }
- name++;
- }
- }
- @@ -4208,7 +4334,7 @@ lang_add_fill (exp)
- int exp;
- {
- lang_fill_statement_type *new = new_stat (lang_fill_statement,
- - stat_ptr);
- + stat_ptr);
-
- new->fill = exp;
- }
- @@ -4220,7 +4346,7 @@ lang_add_data (type, exp)
- {
-
- lang_data_statement_type *new = new_stat (lang_data_statement,
- - stat_ptr);
- + stat_ptr);
-
- new->exp = exp;
- new->type = type;
- @@ -4260,7 +4386,7 @@ lang_add_assignment (exp)
- etree_type * exp;
- {
- lang_assignment_statement_type *new = new_stat (lang_assignment_statement,
- - stat_ptr);
- + stat_ptr);
-
- new->exp = exp;
- return new;
- @@ -4342,9 +4468,9 @@ lang_abs_symbol_at_beginning_of (secname, name)
-
- sec = bfd_get_section_by_name (output_bfd, secname);
- if (sec == (asection *) NULL)
- - h->u.def.value = 0;
- + h->u.def.value = 0;
- else
- - h->u.def.value = bfd_get_section_vma (output_bfd, sec);
- + h->u.def.value = bfd_get_section_vma (output_bfd, sec);
-
- h->u.def.section = bfd_abs_section_ptr;
- }
- @@ -4376,10 +4502,10 @@ lang_abs_symbol_at_end_of (secname, name)
-
- sec = bfd_get_section_by_name (output_bfd, secname);
- if (sec == (asection *) NULL)
- - h->u.def.value = 0;
- + h->u.def.value = 0;
- else
- - h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
- - + bfd_section_size (output_bfd, sec) /
- + h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
- + + bfd_section_size (output_bfd, sec) /
- bfd_octets_per_byte (output_bfd));
-
- h->u.def.section = bfd_abs_section_ptr;
- @@ -4408,11 +4534,11 @@ lang_add_output_format (format, big, little, from_script)
- if (output_target == NULL || !from_script)
- {
- if (command_line.endian == ENDIAN_BIG
- - && big != NULL)
- - format = big;
- + && big != NULL)
- + format = big;
- else if (command_line.endian == ENDIAN_LITTLE
- - && little != NULL)
- - format = little;
- + && little != NULL)
- + format = little;
-
- output_target = format;
- }
- @@ -4460,7 +4586,7 @@ lang_new_phdr (name, type, filehdr, phdrs, at, flags)
- n->next = NULL;
- n->name = name;
- n->type = exp_get_value_int (type, 0, "program header type",
- - lang_final_phase_enum);
- + lang_final_phase_enum);
- n->filehdr = filehdr;
- n->phdrs = phdrs;
- n->at = at;
- @@ -4494,64 +4620,64 @@ lang_record_phdrs ()
-
- c = 0;
- for (u = lang_output_section_statement.head;
- - u != NULL;
- - u = u->output_section_statement.next)
- - {
- - lang_output_section_statement_type *os;
- - struct lang_output_section_phdr_list *pl;
- -
- - os = &u->output_section_statement;
- -
- - pl = os->phdrs;
- - if (pl != NULL)
- - last = pl;
- - else
- - {
- - if (os->sectype == noload_section
- - || os->bfd_section == NULL
- - || (os->bfd_section->flags & SEC_ALLOC) == 0)
- - continue;
- - pl = last;
- - }
- + u != NULL;
- + u = u->output_section_statement.next)
- + {
- + lang_output_section_statement_type *os;
- + struct lang_output_section_phdr_list *pl;
-
- - if (os->bfd_section == NULL)
- - continue;
- + os = &u->output_section_statement;
-
- - for (; pl != NULL; pl = pl->next)
- - {
- - if (strcmp (pl->name, l->name) == 0)
- - {
- - if (c >= alc)
- - {
- - alc *= 2;
- - secs = ((asection **)
- - xrealloc (secs, alc * sizeof (asection *)));
- - }
- - secs[c] = os->bfd_section;
- - ++c;
- - pl->used = true;
- - }
- - }
- - }
- + pl = os->phdrs;
- + if (pl != NULL)
- + last = pl;
- + else
- + {
- + if (os->sectype == noload_section
- + || os->bfd_section == NULL
- + || (os->bfd_section->flags & SEC_ALLOC) == 0)
- + continue;
- + pl = last;
- + }
- +
- + if (os->bfd_section == NULL)
- + continue;
- +
- + for (; pl != NULL; pl = pl->next)
- + {
- + if (strcmp (pl->name, l->name) == 0)
- + {
- + if (c >= alc)
- + {
- + alc *= 2;
- + secs = ((asection **)
- + xrealloc (secs, alc * sizeof (asection *)));
- + }
- + secs[c] = os->bfd_section;
- + ++c;
- + pl->used = true;
- + }
- + }
- + }
-
- if (l->flags == NULL)
- - flags = 0;
- + flags = 0;
- else
- - flags = exp_get_vma (l->flags, 0, "phdr flags",
- - lang_final_phase_enum);
- + flags = exp_get_vma (l->flags, 0, "phdr flags",
- + lang_final_phase_enum);
-
- if (l->at == NULL)
- - at = 0;
- + at = 0;
- else
- - at = exp_get_vma (l->at, 0, "phdr load address",
- - lang_final_phase_enum);
- + at = exp_get_vma (l->at, 0, "phdr load address",
- + lang_final_phase_enum);
-
- if (! bfd_record_phdr (output_bfd, l->type,
- - l->flags == NULL ? false : true,
- - flags,
- - l->at == NULL ? false : true,
- - at, l->filehdr, l->phdrs, c, secs))
- - einfo (_("%F%P: bfd_record_phdr failed: %E\n"));
- + l->flags == NULL ? false : true,
- + flags,
- + l->at == NULL ? false : true,
- + at, l->filehdr, l->phdrs, c, secs))
- + einfo (_("%F%P: bfd_record_phdr failed: %E\n"));
- }
-
- free (secs);
- @@ -4564,14 +4690,14 @@ lang_record_phdrs ()
- struct lang_output_section_phdr_list *pl;
-
- if (u->output_section_statement.bfd_section == NULL)
- - continue;
- + continue;
-
- for (pl = u->output_section_statement.phdrs;
- - pl != NULL;
- - pl = pl->next)
- - if (! pl->used && strcmp (pl->name, "NONE") != 0)
- - einfo (_("%X%P: section `%s' assigned to non-existent phdr `%s'\n"),
- - u->output_section_statement.name, pl->name);
- + pl != NULL;
- + pl = pl->next)
- + if (! pl->used && strcmp (pl->name, "NONE") != 0)
- + einfo (_("%X%P: section `%s' assigned to non-existent phdr `%s'\n"),
- + u->output_section_statement.name, pl->name);
- }
- }
-
- @@ -4626,9 +4752,9 @@ lang_enter_overlay (vma_expr, lma_expr, nocrossrefs)
- {
- /* The grammar should prevent nested overlays from occurring. */
- ASSERT (overlay_vma == NULL
- - && overlay_lma == NULL
- - && overlay_list == NULL
- - && overlay_max == NULL);
- + && overlay_lma == NULL
- + && overlay_list == NULL
- + && overlay_max == NULL);
-
- overlay_vma = vma_expr;
- overlay_lma = lma_expr;
- @@ -4646,7 +4772,7 @@ lang_enter_overlay_section (name)
- etree_type *size;
-
- lang_enter_output_section_statement (name, overlay_vma, normal_section,
- - 0, 0, 0, overlay_lma);
- + 0, 0, 0, overlay_lma);
-
- /* If this is the first section, then base the VMA and LMA of future
- sections on this one. This will work correctly even if `.' is
- @@ -4705,14 +4831,14 @@ lang_leave_overlay_section (fill, phdrs)
- buf = xmalloc (strlen (clean) + sizeof "__load_start_");
- sprintf (buf, "__load_start_%s", clean);
- lang_add_assignment (exp_assop ('=', buf,
- - exp_nameop (LOADADDR, name)));
- + exp_nameop (LOADADDR, name)));
-
- buf = xmalloc (strlen (clean) + sizeof "__load_stop_");
- sprintf (buf, "__load_stop_%s", clean);
- lang_add_assignment (exp_assop ('=', buf,
- - exp_binop ('+',
- - exp_nameop (LOADADDR, name),
- - exp_nameop (SIZEOF, name))));
- + exp_binop ('+',
- + exp_nameop (LOADADDR, name),
- + exp_nameop (SIZEOF, name))));
-
- free (clean);
- }
- @@ -4750,23 +4876,23 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
- struct overlay_list *next;
-
- if (fill != 0 && l->os->fill == 0)
- - l->os->fill = fill;
- + l->os->fill = fill;
- if (region != NULL && l->os->region == NULL)
- - l->os->region = region;
- + l->os->region = region;
- if (lma_region != NULL && l->os->lma_region == NULL)
- l->os->lma_region = lma_region;
- if (phdrs != NULL && l->os->phdrs == NULL)
- - l->os->phdrs = phdrs;
- + l->os->phdrs = phdrs;
-
- if (overlay_nocrossrefs)
- - {
- - struct lang_nocrossref *nc;
- + {
- + struct lang_nocrossref *nc;
-
- - nc = (struct lang_nocrossref *) xmalloc (sizeof *nc);
- - nc->name = l->os->name;
- - nc->next = nocrossref;
- - nocrossref = nc;
- - }
- + nc = (struct lang_nocrossref *) xmalloc (sizeof *nc);
- + nc->name = l->os->name;
- + nc->next = nocrossref;
- + nocrossref = nc;
- + }
-
- next = l->next;
- free (l);
- @@ -4778,7 +4904,7 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
-
- /* Update . for the end of the overlay. */
- lang_add_assignment (exp_assop ('=', ".",
- - exp_binop ('+', overlay_vma, overlay_max)));
- + exp_binop ('+', overlay_vma, overlay_max)));
-
- overlay_vma = NULL;
- overlay_lma = NULL;
- @@ -4818,7 +4944,7 @@ lang_vers_match_lang_cplusplus (expr, sym)
- if (!alt_sym)
- {
- /* cplus_demangle (also) returns NULL when it is not a C++ symbol.
- - Should we early out false in this case? */
- + Should we early out false in this case? */
- result = fnmatch (expr->pattern, sym, 0) == 0;
- }
- else
- @@ -4845,7 +4971,7 @@ lang_vers_match_lang_java (expr, sym)
- if (!alt_sym)
- {
- /* cplus_demangle (also) returns NULL when it is not a Java symbol.
- - Should we early out false in this case? */
- + Should we early out false in this case? */
- result = fnmatch (expr->pattern, sym, 0) == 0;
- }
- else
- @@ -4880,7 +5006,7 @@ lang_new_vers_regex (orig, new, lang)
- else
- {
- einfo (_("%X%P: unknown language `%s' in version information\n"),
- - lang);
- + lang);
- ret->match = lang_vers_match_lang_c;
- }
-
- @@ -4936,27 +5062,27 @@ lang_register_vers_node (name, version, deps)
- for (e1 = version->globals; e1 != NULL; e1 = e1->next)
- {
- for (t = lang_elf_version_info; t != NULL; t = t->next)
- - {
- - struct bfd_elf_version_expr *e2;
- + {
- + struct bfd_elf_version_expr *e2;
-
- - for (e2 = t->locals; e2 != NULL; e2 = e2->next)
- - if (strcmp (e1->pattern, e2->pattern) == 0)
- - einfo (_("%X%P: duplicate expression `%s' in version information\n"),
- - e1->pattern);
- - }
- + for (e2 = t->locals; e2 != NULL; e2 = e2->next)
- + if (strcmp (e1->pattern, e2->pattern) == 0)
- + einfo (_("%X%P: duplicate expression `%s' in version information\n"),
- + e1->pattern);
- + }
- }
-
- for (e1 = version->locals; e1 != NULL; e1 = e1->next)
- {
- for (t = lang_elf_version_info; t != NULL; t = t->next)
- - {
- - struct bfd_elf_version_expr *e2;
- + {
- + struct bfd_elf_version_expr *e2;
-
- - for (e2 = t->globals; e2 != NULL; e2 = e2->next)
- - if (strcmp (e1->pattern, e2->pattern) == 0)
- - einfo (_("%X%P: duplicate expression `%s' in version information\n"),
- - e1->pattern);
- - }
- + for (e2 = t->globals; e2 != NULL; e2 = e2->next)
- + if (strcmp (e1->pattern, e2->pattern) == 0)
- + einfo (_("%X%P: duplicate expression `%s' in version information\n"),
- + e1->pattern);
- + }
- }
-
- version->deps = deps;
- @@ -4985,10 +5111,10 @@ lang_add_vers_depend (list, name)
- for (t = lang_elf_version_info; t != NULL; t = t->next)
- {
- if (strcmp (t->name, name) == 0)
- - {
- - ret->version_needed = t;
- - return ret;
- - }
- + {
- + ret->version_needed = t;
- + return ret;
- + }
- }
-
- einfo (_("%X%P: unable to find version dependency `%s'\n"), name);
- @@ -5013,23 +5139,23 @@ lang_do_version_exports_section ()
- len = bfd_section_size (is->the_bfd, sec);
- contents = xmalloc (len);
- if (!bfd_get_section_contents (is->the_bfd, sec, contents, 0, len))
- - einfo (_("%X%P: unable to read .exports section contents"), sec);
- + einfo (_("%X%P: unable to read .exports section contents"), sec);
-
- p = contents;
- while (p < contents+len)
- - {
- - greg = lang_new_vers_regex (greg, p, NULL);
- - p = strchr (p, '\0') + 1;
- - }
- + {
- + greg = lang_new_vers_regex (greg, p, NULL);
- + p = strchr (p, '\0') + 1;
- + }
-
- /* Do not free the contents, as we used them creating the regex. */
-
- /* Do not include this section in the link. */
- bfd_set_section_flags (is->the_bfd, sec,
- - bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
- + bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
- }
-
- lreg = lang_new_vers_regex (NULL, "*", NULL);
- lang_register_vers_node (command_line.version_exports_section,
- - lang_new_vers_node (greg, lreg), NULL);
- + lang_new_vers_node (greg, lreg), NULL);
- }
- diff --git a/ld/ldmain.c b/ld/ldmain.c
- index 676eeba..da117b6 100644
- --- a/ld/ldmain.c
- +++ b/ld/ldmain.c
- @@ -41,9 +41,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- #include "ldfile.h"
- #include "ldctor.h"
-
- +int g_iAdvance = 0; /* add T.Tazaki 2003/05/14 */
- +int g_iPE = 0; /* add T.Tazaki 2003/11/18 */
- +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +///* add architecture number 2003/05/14 T.Tazaki */
- +//#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor */
- +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +
- /* Somewhere above, sys/stat.h got included . . . . */
- #if !defined(S_ISDIR) && defined(S_IFDIR)
- -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- #endif
-
- #include <string.h>
- @@ -94,41 +101,41 @@ ld_config_type config;
- static void remove_output PARAMS ((void));
- static boolean check_for_scripts_dir PARAMS ((char *dir));
- static boolean add_archive_element PARAMS ((struct bfd_link_info *, bfd *,
- - const char *));
- + const char *));
- static boolean multiple_definition PARAMS ((struct bfd_link_info *,
- - const char *,
- - bfd *, asection *, bfd_vma,
- - bfd *, asection *, bfd_vma));
- + const char *,
- + bfd *, asection *, bfd_vma,
- + bfd *, asection *, bfd_vma));
- static boolean multiple_common PARAMS ((struct bfd_link_info *,
- - const char *, bfd *,
- - enum bfd_link_hash_type, bfd_vma,
- - bfd *, enum bfd_link_hash_type,
- - bfd_vma));
- + const char *, bfd *,
- + enum bfd_link_hash_type, bfd_vma,
- + bfd *, enum bfd_link_hash_type,
- + bfd_vma));
- static boolean add_to_set PARAMS ((struct bfd_link_info *,
- - struct bfd_link_hash_entry *,
- - bfd_reloc_code_real_type,
- - bfd *, asection *, bfd_vma));
- + struct bfd_link_hash_entry *,
- + bfd_reloc_code_real_type,
- + bfd *, asection *, bfd_vma));
- static boolean constructor_callback PARAMS ((struct bfd_link_info *,
- - boolean constructor,
- - const char *name,
- - bfd *, asection *, bfd_vma));
- + boolean constructor,
- + const char *name,
- + bfd *, asection *, bfd_vma));
- static boolean warning_callback PARAMS ((struct bfd_link_info *,
- - const char *, const char *, bfd *,
- - asection *, bfd_vma));
- + const char *, const char *, bfd *,
- + asection *, bfd_vma));
- static void warning_find_reloc PARAMS ((bfd *, asection *, PTR));
- static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
- - const char *, bfd *,
- - asection *, bfd_vma, boolean));
- + const char *, bfd *,
- + asection *, bfd_vma, boolean));
- static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
- - const char *, bfd_vma,
- - bfd *, asection *, bfd_vma));
- + const char *, bfd_vma,
- + bfd *, asection *, bfd_vma));
- static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *,
- - bfd *, asection *, bfd_vma));
- + bfd *, asection *, bfd_vma));
- static boolean unattached_reloc PARAMS ((struct bfd_link_info *,
- - const char *, bfd *, asection *,
- - bfd_vma));
- + const char *, bfd *, asection *,
- + bfd_vma));
- static boolean notice PARAMS ((struct bfd_link_info *, const char *,
- - bfd *, asection *, bfd_vma));
- + bfd *, asection *, bfd_vma));
-
- static struct bfd_link_callbacks link_callbacks =
- {
- @@ -153,9 +160,9 @@ remove_output ()
- if (output_filename)
- {
- if (output_bfd && output_bfd->iostream)
- - fclose((FILE *)(output_bfd->iostream));
- + fclose((FILE *)(output_bfd->iostream));
- if (delete_output_file_on_failure)
- - unlink (output_filename);
- + unlink (output_filename);
- }
- }
-
- @@ -166,6 +173,9 @@ main (argc, argv)
- {
- char *emulation;
- long start_time = get_run_time ();
- +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +// FILE *fpOut; /* ELF file write file pointer add T.Tazaki 2003/05/14 */
- +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
-
- #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
- setlocale (LC_MESSAGES, "");
- @@ -258,13 +268,13 @@ main (argc, argv)
- if (link_info.relocateable)
- {
- if (command_line.gc_sections)
- - einfo ("%P%F: --gc-sections and -r may not be used together\n");
- + einfo ("%P%F: --gc-sections and -r may not be used together\n");
- if (link_info.mpc860c0)
- - einfo (_("%P%F: -r and --mpc860c0 may not be used together\n"));
- + einfo (_("%P%F: -r and --mpc860c0 may not be used together\n"));
- else if (command_line.relax)
- - einfo (_("%P%F: --relax and -r may not be used together\n"));
- + einfo (_("%P%F: --relax and -r may not be used together\n"));
- if (link_info.shared)
- - einfo (_("%P%F: -r and -shared may not be used together\n"));
- + einfo (_("%P%F: -r and -shared may not be used together\n"));
- }
-
- /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
- @@ -274,7 +284,7 @@ main (argc, argv)
- {
- link_info.strip = strip_debugger;
- if (link_info.discard == discard_none)
- - link_info.discard = discard_all;
- + link_info.discard = discard_all;
- }
-
- /* This essentially adds another -L directory so this must be done after
- @@ -288,19 +298,19 @@ main (argc, argv)
- char *s = ldemul_get_script (&isfile);
-
- if (isfile)
- - ldfile_open_command_file (s);
- + ldfile_open_command_file (s);
- else
- - {
- - if (trace_file_tries)
- - {
- - info_msg (_("using internal linker script:\n"));
- - info_msg ("==================================================\n");
- - info_msg (s);
- - info_msg ("\n==================================================\n");
- - }
- - lex_string = s;
- - lex_redirect (s);
- - }
- + {
- + if (trace_file_tries)
- + {
- + info_msg (_("using internal linker script:\n"));
- + info_msg ("==================================================\n");
- + info_msg (s);
- + info_msg ("\n==================================================\n");
- + }
- + lex_string = s;
- + lex_redirect (s);
- + }
- parser_input = input_script;
- yyparse ();
- lex_string = NULL;
- @@ -311,7 +321,7 @@ main (argc, argv)
- if (lang_has_input_file == false)
- {
- if (version_printed)
- - xexit (0);
- + xexit (0);
- einfo (_("%P%F: no input files\n"));
- }
-
- @@ -326,19 +336,19 @@ main (argc, argv)
- if (config.map_filename)
- {
- if (strcmp (config.map_filename, "-") == 0)
- - {
- - config.map_file = stdout;
- - }
- + {
- + config.map_file = stdout;
- + }
- else
- - {
- - config.map_file = fopen (config.map_filename, FOPEN_WT);
- - if (config.map_file == (FILE *) NULL)
- - {
- - bfd_set_error (bfd_error_system_call);
- - einfo (_("%P%F: cannot open map file %s: %E\n"),
- - config.map_filename);
- - }
- - }
- + {
- + config.map_file = fopen (config.map_filename, FOPEN_WT);
- + if (config.map_file == (FILE *) NULL)
- + {
- + bfd_set_error (bfd_error_system_call);
- + einfo (_("%P%F: cannot open map file %s: %E\n"),
- + config.map_filename);
- + }
- + }
- }
-
-
- @@ -354,9 +364,9 @@ main (argc, argv)
- asection *found = bfd_get_section_by_name (output_bfd, ".text");
-
- if (found != (asection *) NULL)
- - {
- - found->flags |= SEC_READONLY;
- - }
- + {
- + found->flags |= SEC_READONLY;
- + }
- }
-
- if (link_info.relocateable)
- @@ -366,12 +376,17 @@ main (argc, argv)
-
- ldwrite ();
-
- +/* del T.Tazaki 2003/06/24 >>> : Map file output after bfd close.
- + : symbol with underbar modify */
- +//#if 0 /* add T.Tazaki 2003/11/19 bug fix */
- if (config.map_file != NULL)
- lang_map ();
- if (command_line.cref)
- output_cref (config.map_file != NULL ? config.map_file : stdout);
- if (nocrossref_list != NULL)
- check_nocrossrefs ();
- +//#endif
- +/* del T.Tazaki 2003/06/24 <<< */
-
- /* Even if we're producing relocateable output, some non-fatal errors should
- be reported in the exit status. (What non-fatal errors, if any, do we
- @@ -380,10 +395,10 @@ main (argc, argv)
- if (config.make_executable == false && force_make_executable == false)
- {
- if (trace_files == true)
- - {
- - einfo (_("%P: link errors found, deleting executable `%s'\n"),
- - output_filename);
- - }
- + {
- + einfo (_("%P: link errors found, deleting executable `%s'\n"),
- + output_filename);
- + }
-
- /* The file will be removed by remove_output. */
-
- @@ -392,50 +407,98 @@ main (argc, argv)
- else
- {
- if (! bfd_close (output_bfd))
- - einfo (_("%F%B: final close failed: %E\n"), output_bfd);
- + einfo (_("%F%B: final close failed: %E\n"), output_bfd);
- +
- +/* add T.Tazaki 2003/06/24 >>> : Map file output after bfd close.
- + : symbol with underbar modify */
- +#if 0 /* del T.Tazaki 2003/11/19 bug fix */
- + if (config.map_file != NULL)
- + lang_map ();
- + if (command_line.cref)
- + output_cref (config.map_file != NULL ? config.map_file : stdout);
- + if (nocrossref_list != NULL)
- + check_nocrossrefs ();
- +#endif
- +/* add T.Tazaki 2003/06/24 <<< */
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +///* add T.Tazaki 2003/05/14 >>> */
- +// fpOut = fopen( output_filename,"r+b" );
- +// if( fpOut != NULL )
- +// {
- +// /* e_machine number set */
- +// fseek( fpOut, 18, SEEK_SET );
- +// fputc( EM_SE_C33, fpOut );
- +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/01 macro flag output moved to bfd/elf32-c33.c */
- +// /* Advanced macro mode ? */
- +// if( g_iAdvance == 1 )
- +// {
- +// /* ELF header : e_flags bit31-28=CPU flag set */
- +// /* flag = 0x0 : Standard macro */
- +// /* flag = 'A' : Advanced macro */
- +// /* flag = 'P' : PE macro */
- +// fseek( fpOut, 39, SEEK_SET );
- +// fputc( 'A', fpOut );
- +// }
- +// else if ( g_iPE == 1 ) /* add T.Tazaki 2003/11/18 */
- +// {
- +// fseek( fpOut, 39, SEEK_SET );
- +// fputc( 'P', fpOut );
- +// }
- +/* <<<<< DELETED D.Fujimoto 2007/10/01 macro flag output moved to bfd/elf32-c33.c */
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +// fclose( fpOut );
- +// }
- +//
- +///* add T.Tazaki 2003/05/14 <<< */
- +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
- +
-
- /* If the --force-exe-suffix is enabled, and we're making an
- - executable file and it doesn't end in .exe, copy it to one which does. */
- + executable file and it doesn't end in .exe, copy it to one which does. */
-
- if (! link_info.relocateable && command_line.force_exe_suffix)
- - {
- - int len = strlen (output_filename);
- - if (len < 4
- - || (strcasecmp (output_filename + len - 4, ".exe") != 0
- - && strcasecmp (output_filename + len - 4, ".dll") != 0))
- - {
- - FILE *src;
- - FILE *dst;
- - const int bsize = 4096;
- - char *buf = xmalloc (bsize);
- - int l;
- - char *dst_name = xmalloc (len + 5);
- - strcpy (dst_name, output_filename);
- - strcat (dst_name, ".exe");
- - src = fopen (output_filename, FOPEN_RB);
- - dst = fopen (dst_name, FOPEN_WB);
- -
- - if (!src)
- - einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
- - if (!dst)
- - einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
- - while ((l = fread (buf, 1, bsize, src)) > 0)
- - {
- - int done = fwrite (buf, 1, l, dst);
- - if (done != l)
- - {
- - einfo (_("%P: Error writing file `%s'\n"), dst_name);
- - }
- - }
- - fclose (src);
- - if (fclose (dst) == EOF)
- - {
- - einfo (_("%P: Error closing file `%s'\n"), dst_name);
- - }
- - free (dst_name);
- - free (buf);
- - }
- - }
- + {
- + int len = strlen (output_filename);
- + if (len < 4
- + || (strcasecmp (output_filename + len - 4, ".exe") != 0
- + && strcasecmp (output_filename + len - 4, ".dll") != 0))
- + {
- + FILE *src;
- + FILE *dst;
- + const int bsize = 4096;
- + char *buf = xmalloc (bsize);
- + int l;
- + char *dst_name = xmalloc (len + 5);
- + strcpy (dst_name, output_filename);
- + strcat (dst_name, ".exe");
- + src = fopen (output_filename, FOPEN_RB);
- + dst = fopen (dst_name, FOPEN_WB);
- +
- + if (!src)
- + einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
- + if (!dst)
- + einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
- + while ((l = fread (buf, 1, bsize, src)) > 0)
- + {
- + int done = fwrite (buf, 1, l, dst);
- + if (done != l)
- + {
- + einfo (_("%P: Error writing file `%s'\n"), dst_name);
- + }
- + }
- + fclose (src);
- + if (fclose (dst) == EOF)
- + {
- + einfo (_("%P: Error closing file `%s'\n"), dst_name);
- + }
- + free (dst_name);
- + free (buf);
- + }
- + }
- }
-
- END_PROGRESS (program_name);
- @@ -448,10 +511,10 @@ main (argc, argv)
- long run_time = get_run_time () - start_time;
-
- fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"),
- - program_name, run_time / 1000000, run_time % 1000000);
- + program_name, run_time / 1000000, run_time % 1000000);
- #ifdef HAVE_SBRK
- fprintf (stderr, _("%s: data size %ld\n"), program_name,
- - (long) (lim - (char *) &environ));
- + (long) (lim - (char *) &environ));
- #endif
- }
-
- @@ -480,45 +543,45 @@ get_emulation (argc, argv)
- for (i = 1; i < argc; i++)
- {
- if (!strncmp (argv[i], "-m", 2))
- - {
- - if (argv[i][2] == '\0')
- - {
- - /* -m EMUL */
- - if (i < argc - 1)
- - {
- - emulation = argv[i + 1];
- - i++;
- - }
- - else
- - {
- - einfo(_("%P%F: missing argument to -m\n"));
- - }
- - }
- - else if (strcmp (argv[i], "-mips1") == 0
- - || strcmp (argv[i], "-mips2") == 0
- - || strcmp (argv[i], "-mips3") == 0
- - || strcmp (argv[i], "-mips4") == 0)
- - {
- - /* FIXME: The arguments -mips1, -mips2 and -mips3 are
- - passed to the linker by some MIPS compilers. They
- - generally tell the linker to use a slightly different
- - library path. Perhaps someday these should be
- - implemented as emulations; until then, we just ignore
- - the arguments and hope that nobody ever creates
- - emulations named ips1, ips2 or ips3. */
- - }
- - else if (strcmp (argv[i], "-m486") == 0)
- - {
- - /* FIXME: The argument -m486 is passed to the linker on
- - some Linux systems. Hope that nobody creates an
- - emulation named 486. */
- - }
- - else
- - {
- - /* -mEMUL */
- - emulation = &argv[i][2];
- - }
- - }
- + {
- + if (argv[i][2] == '\0')
- + {
- + /* -m EMUL */
- + if (i < argc - 1)
- + {
- + emulation = argv[i + 1];
- + i++;
- + }
- + else
- + {
- + einfo(_("%P%F: missing argument to -m\n"));
- + }
- + }
- + else if (strcmp (argv[i], "-mips1") == 0
- + || strcmp (argv[i], "-mips2") == 0
- + || strcmp (argv[i], "-mips3") == 0
- + || strcmp (argv[i], "-mips4") == 0)
- + {
- + /* FIXME: The arguments -mips1, -mips2 and -mips3 are
- + passed to the linker by some MIPS compilers. They
- + generally tell the linker to use a slightly different
- + library path. Perhaps someday these should be
- + implemented as emulations; until then, we just ignore
- + the arguments and hope that nobody ever creates
- + emulations named ips1, ips2 or ips3. */
- + }
- + else if (strcmp (argv[i], "-m486") == 0)
- + {
- + /* FIXME: The argument -m486 is passed to the linker on
- + some Linux systems. Hope that nobody creates an
- + emulation named 486. */
- + }
- + else
- + {
- + /* -mEMUL */
- + emulation = &argv[i][2];
- + }
- + }
- }
-
- return emulation;
- @@ -564,7 +627,7 @@ set_scripts_dir ()
- size_t dirlen;
-
- if (check_for_scripts_dir (SCRIPTDIR))
- - return; /* We've been installed normally. */
- + return; /* We've been installed normally. */
-
- /* Look for "ldscripts" in the dir where our binary is. */
- end = strrchr (program_name, '/');
- @@ -592,14 +655,14 @@ set_scripts_dir ()
- dir[dirlen] = '\0';
-
- if (check_for_scripts_dir (dir))
- - return; /* Don't free dir. */
- + return; /* Don't free dir. */
-
- /* Look for "ldscripts" in <the dir where our binary is>/../lib. */
- strcpy (dir + dirlen, "/../lib");
- if (check_for_scripts_dir (dir))
- return;
-
- - free (dir); /* Well, we tried. */
- + free (dir); /* Well, we tried. */
- }
-
- void
- @@ -609,11 +672,11 @@ add_ysym (name)
- if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
- {
- link_info.notice_hash = ((struct bfd_hash_table *)
- - xmalloc (sizeof (struct bfd_hash_table)));
- + xmalloc (sizeof (struct bfd_hash_table)));
- if (! bfd_hash_table_init_n (link_info.notice_hash,
- - bfd_hash_newfunc,
- - 61))
- - einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
- + bfd_hash_newfunc,
- + 61))
- + einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
- }
-
- if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
- @@ -630,11 +693,11 @@ add_wrap (name)
- if (link_info.wrap_hash == NULL)
- {
- link_info.wrap_hash = ((struct bfd_hash_table *)
- - xmalloc (sizeof (struct bfd_hash_table)));
- + xmalloc (sizeof (struct bfd_hash_table)));
- if (! bfd_hash_table_init_n (link_info.wrap_hash,
- - bfd_hash_newfunc,
- - 61))
- - einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
- + bfd_hash_newfunc,
- + 61))
- + einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
- }
- if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL)
- einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
- @@ -663,7 +726,7 @@ add_keepsyms_file (filename)
- }
-
- link_info.keep_hash = ((struct bfd_hash_table *)
- - xmalloc (sizeof (struct bfd_hash_table)));
- + xmalloc (sizeof (struct bfd_hash_table)));
- if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
- einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
-
- @@ -674,30 +737,30 @@ add_keepsyms_file (filename)
- while (c != EOF)
- {
- while (isspace (c))
- - c = getc (file);
- + c = getc (file);
-
- if (c != EOF)
- - {
- - size_t len = 0;
- -
- - while (! isspace (c) && c != EOF)
- - {
- - buf[len] = c;
- - ++len;
- - if (len >= bufsize)
- - {
- - bufsize *= 2;
- - buf = xrealloc (buf, bufsize);
- - }
- - c = getc (file);
- - }
- -
- - buf[len] = '\0';
- -
- - if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
- - == (struct bfd_hash_entry *) NULL)
- - einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
- - }
- + {
- + size_t len = 0;
- +
- + while (! isspace (c) && c != EOF)
- + {
- + buf[len] = c;
- + ++len;
- + if (len >= bufsize)
- + {
- + bufsize *= 2;
- + buf = xrealloc (buf, bufsize);
- + }
- + c = getc (file);
- + }
- +
- + buf[len] = '\0';
- +
- + if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
- + == (struct bfd_hash_entry *) NULL)
- + einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
- + }
- }
-
- if (link_info.strip != strip_none)
- @@ -721,7 +784,7 @@ add_archive_element (info, abfd, name)
- lang_input_statement_type *input;
-
- input = ((lang_input_statement_type *)
- - xmalloc (sizeof (lang_input_statement_type)));
- + xmalloc (sizeof (lang_input_statement_type)));
- input->filename = abfd->filename;
- input->local_sym_name = abfd->filename;
- input->the_bfd = abfd;
- @@ -749,72 +812,72 @@ add_archive_element (info, abfd, name)
- h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);
-
- if (h == NULL)
- - from = NULL;
- + from = NULL;
- else
- - {
- - switch (h->type)
- - {
- - default:
- - from = NULL;
- - break;
- -
- - case bfd_link_hash_defined:
- - case bfd_link_hash_defweak:
- - from = h->u.def.section->owner;
- - break;
- -
- - case bfd_link_hash_undefined:
- - case bfd_link_hash_undefweak:
- - from = h->u.undef.abfd;
- - break;
- -
- - case bfd_link_hash_common:
- - from = h->u.c.p->section->owner;
- - break;
- - }
- - }
- + {
- + switch (h->type)
- + {
- + default:
- + from = NULL;
- + break;
- +
- + case bfd_link_hash_defined:
- + case bfd_link_hash_defweak:
- + from = h->u.def.section->owner;
- + break;
- +
- + case bfd_link_hash_undefined:
- + case bfd_link_hash_undefweak:
- + from = h->u.undef.abfd;
- + break;
- +
- + case bfd_link_hash_common:
- + from = h->u.c.p->section->owner;
- + break;
- + }
- + }
-
- if (! header_printed)
- - {
- - char buf[100];
- + {
- + char buf[100];
-
- - sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
- - _("because of file (symbol)"));
- - minfo ("%s", buf);
- - header_printed = true;
- - }
- + sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
- + _("because of file (symbol)"));
- + minfo ("%s", buf);
- + header_printed = true;
- + }
-
- if (bfd_my_archive (abfd) == NULL)
- - {
- - minfo ("%s", bfd_get_filename (abfd));
- - len = strlen (bfd_get_filename (abfd));
- - }
- + {
- + minfo ("%s", bfd_get_filename (abfd));
- + len = strlen (bfd_get_filename (abfd));
- + }
- else
- - {
- - minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)),
- - bfd_get_filename (abfd));
- - len = (strlen (bfd_get_filename (bfd_my_archive (abfd)))
- - + strlen (bfd_get_filename (abfd))
- - + 2);
- - }
- + {
- + minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)),
- + bfd_get_filename (abfd));
- + len = (strlen (bfd_get_filename (bfd_my_archive (abfd)))
- + + strlen (bfd_get_filename (abfd))
- + + 2);
- + }
-
- if (len >= 29)
- - {
- - print_nl ();
- - len = 0;
- - }
- + {
- + print_nl ();
- + len = 0;
- + }
- while (len < 30)
- - {
- - print_space ();
- - ++len;
- - }
- + {
- + print_space ();
- + ++len;
- + }
-
- if (from != NULL)
- - minfo ("%B ", from);
- + minfo ("%B ", from);
- if (h != NULL)
- - minfo ("(%T)\n", h->root.string);
- + minfo ("(%T)\n", h->root.string);
- else
- - minfo ("(%s)\n", name);
- + minfo ("(%s)\n", name);
- }
-
- if (trace_files || trace_file_tries)
- @@ -847,15 +910,21 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
- && ! bfd_is_abs_section (osec)
- && bfd_is_abs_section (osec->output_section))
- || (nsec->output_section != NULL
- - && ! bfd_is_abs_section (nsec)
- - && bfd_is_abs_section (nsec->output_section)))
- + && ! bfd_is_abs_section (nsec)
- + && bfd_is_abs_section (nsec->output_section)))
- return true;
-
- +/* delete 2002.07.01 T.Tazaki mutiple difinition error */
- +#if 0
- +
- einfo (_("%X%C: multiple definition of `%T'\n"),
- - nbfd, nsec, nval, name);
- + nbfd, nsec, nval, name);
- if (obfd != (bfd *) NULL)
- einfo (_("%D: first defined here\n"), obfd, osec, oval);
- +
- +#endif
- return true;
- +
- }
-
- /* This is called when there is a definition of a common symbol, or
- @@ -884,43 +953,43 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
- {
- ASSERT (otype == bfd_link_hash_common);
- einfo (_("%B: warning: definition of `%T' overriding common\n"),
- - nbfd, name);
- + nbfd, name);
- if (obfd != NULL)
- - einfo (_("%B: warning: common is here\n"), obfd);
- + einfo (_("%B: warning: common is here\n"), obfd);
- }
- else if (otype == bfd_link_hash_defined
- - || otype == bfd_link_hash_defweak
- - || otype == bfd_link_hash_indirect)
- + || otype == bfd_link_hash_defweak
- + || otype == bfd_link_hash_indirect)
- {
- ASSERT (ntype == bfd_link_hash_common);
- einfo (_("%B: warning: common of `%T' overridden by definition\n"),
- - nbfd, name);
- + nbfd, name);
- if (obfd != NULL)
- - einfo (_("%B: warning: defined here\n"), obfd);
- + einfo (_("%B: warning: defined here\n"), obfd);
- }
- else
- {
- ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common);
- if (osize > nsize)
- - {
- - einfo (_("%B: warning: common of `%T' overridden by larger common\n"),
- - nbfd, name);
- - if (obfd != NULL)
- - einfo (_("%B: warning: larger common is here\n"), obfd);
- - }
- + {
- + einfo (_("%B: warning: common of `%T' overridden by larger common\n"),
- + nbfd, name);
- + if (obfd != NULL)
- + einfo (_("%B: warning: larger common is here\n"), obfd);
- + }
- else if (nsize > osize)
- - {
- - einfo (_("%B: warning: common of `%T' overriding smaller common\n"),
- - nbfd, name);
- - if (obfd != NULL)
- - einfo (_("%B: warning: smaller common is here\n"), obfd);
- - }
- + {
- + einfo (_("%B: warning: common of `%T' overriding smaller common\n"),
- + nbfd, name);
- + if (obfd != NULL)
- + einfo (_("%B: warning: smaller common is here\n"), obfd);
- + }
- else
- - {
- - einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name);
- - if (obfd != NULL)
- - einfo (_("%B: warning: previous common is here\n"), obfd);
- - }
- + {
- + einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name);
- + if (obfd != NULL)
- + einfo (_("%B: warning: previous common is here\n"), obfd);
- + }
- }
-
- return true;
- @@ -942,7 +1011,7 @@ add_to_set (info, h, reloc, abfd, section, value)
- {
- if (config.warn_constructors)
- einfo (_("%P: warning: global constructor %s used\n"),
- - h->root.string);
- + h->root.string);
-
- if (! config.build_constructors)
- return true;
- @@ -954,8 +1023,8 @@ add_to_set (info, h, reloc, abfd, section, value)
- h->type = bfd_link_hash_undefined;
- h->u.undef.abfd = abfd;
- /* We don't call bfd_link_add_undef to add this to the list of
- - undefined symbols because we are going to define it
- - ourselves. */
- + undefined symbols because we are going to define it
- + ourselves. */
- }
-
- return true;
- @@ -989,7 +1058,7 @@ constructor_callback (info, constructor, name, abfd, section, value)
- useful error message. */
- if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL
- && (link_info.relocateable
- - || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
- + || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
- einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
-
- s = set_name;
- @@ -1008,8 +1077,8 @@ constructor_callback (info, constructor, name, abfd, section, value)
- h->type = bfd_link_hash_undefined;
- h->u.undef.abfd = abfd;
- /* We don't call bfd_link_add_undef to add this to the list of
- - undefined symbols because we are going to define it
- - ourselves. */
- + undefined symbols because we are going to define it
- + ourselves. */
- }
-
- ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value);
- @@ -1058,29 +1127,29 @@ warning_callback (info, warning, symbol, abfd, section, address)
- struct warning_callback_info info;
-
- /* Look through the relocs to see if we can find a plausible
- - address. */
- + address. */
-
- entry = (lang_input_statement_type *) abfd->usrdata;
- if (entry != NULL && entry->asymbols != NULL)
- - asymbols = entry->asymbols;
- + asymbols = entry->asymbols;
- else
- - {
- - long symsize;
- - long symbol_count;
- -
- - symsize = bfd_get_symtab_upper_bound (abfd);
- - if (symsize < 0)
- - einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- - asymbols = (asymbol **) xmalloc (symsize);
- - symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
- - if (symbol_count < 0)
- - einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- - if (entry != NULL)
- - {
- - entry->asymbols = asymbols;
- - entry->symbol_count = symbol_count;
- - }
- - }
- + {
- + long symsize;
- + long symbol_count;
- +
- + symsize = bfd_get_symtab_upper_bound (abfd);
- + if (symsize < 0)
- + einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- + asymbols = (asymbol **) xmalloc (symsize);
- + symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
- + if (symbol_count < 0)
- + einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- + if (entry != NULL)
- + {
- + entry->asymbols = asymbols;
- + entry->symbol_count = symbol_count;
- + }
- + }
-
- info.found = false;
- info.warning = warning;
- @@ -1089,10 +1158,10 @@ warning_callback (info, warning, symbol, abfd, section, address)
- bfd_map_over_sections (abfd, warning_find_reloc, (PTR) &info);
-
- if (! info.found)
- - einfo ("%B: %s\n", abfd, warning);
- + einfo ("%B: %s\n", abfd, warning);
-
- if (entry == NULL)
- - free (asymbols);
- + free (asymbols);
- }
-
- return true;
- @@ -1136,14 +1205,14 @@ warning_find_reloc (abfd, sec, iarg)
- arelent *q = *p;
-
- if (q->sym_ptr_ptr != NULL
- - && *q->sym_ptr_ptr != NULL
- - && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
- - {
- - /* We found a reloc for the symbol we are looking for. */
- - einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
- - info->found = true;
- - break;
- - }
- + && *q->sym_ptr_ptr != NULL
- + && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
- + {
- + /* We found a reloc for the symbol we are looking for. */
- + einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
- + info->found = true;
- + break;
- + }
- }
-
- free (relpp);
- @@ -1173,18 +1242,18 @@ undefined_symbol (info, name, abfd, section, address, fatal)
- /* Only warn once about a particular undefined symbol. */
-
- if (hash == NULL)
- - {
- - hash = ((struct bfd_hash_table *)
- - xmalloc (sizeof (struct bfd_hash_table)));
- - if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
- - einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
- - }
- + {
- + hash = ((struct bfd_hash_table *)
- + xmalloc (sizeof (struct bfd_hash_table)));
- + if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
- + einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
- + }
-
- if (bfd_hash_lookup (hash, name, false, false) != NULL)
- - return true;
- + return true;
-
- if (bfd_hash_lookup (hash, name, true, true) == NULL)
- - einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
- + einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
- }
-
- /* We never print more than a reasonable number of errors in a row
- @@ -1196,35 +1265,35 @@ undefined_symbol (info, name, abfd, section, address, fatal)
- {
- error_count = 0;
- if (error_name != (char *) NULL)
- - free (error_name);
- + free (error_name);
- error_name = buystring (name);
- }
-
- if (section != NULL)
- {
- if (error_count < MAX_ERRORS_IN_A_ROW)
- - {
- - einfo (_("%C: undefined reference to `%T'\n"),
- - abfd, section, address, name);
- - if (fatal)
- - einfo ("%X");
- - }
- + {
- + einfo (_("%C: undefined reference to `%T'\n"),
- + abfd, section, address, name);
- + if (fatal)
- + einfo ("%X");
- + }
- else if (error_count == MAX_ERRORS_IN_A_ROW)
- - einfo (_("%D: more undefined references to `%T' follow\n"),
- - abfd, section, address, name);
- + einfo (_("%D: more undefined references to `%T' follow\n"),
- + abfd, section, address, name);
- }
- else
- {
- if (error_count < MAX_ERRORS_IN_A_ROW)
- - {
- - einfo (_("%B: undefined reference to `%T'\n"),
- - abfd, name);
- - if (fatal)
- - einfo ("%X");
- - }
- + {
- + einfo (_("%B: undefined reference to `%T'\n"),
- + abfd, name);
- + if (fatal)
- + einfo ("%X");
- + }
- else if (error_count == MAX_ERRORS_IN_A_ROW)
- - einfo (_("%B: more undefined references to `%T' follow\n"),
- - abfd, name);
- + einfo (_("%B: more undefined references to `%T' follow\n"),
- + abfd, name);
- }
-
- return true;
- @@ -1307,12 +1376,12 @@ notice (info, name, abfd, section, value)
- {
- if (! info->notice_all
- || (info->notice_hash != NULL
- - && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
- + && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
- {
- if (bfd_is_und_section (section))
- - einfo ("%B: reference to %s\n", abfd, name);
- + einfo ("%B: reference to %s\n", abfd, name);
- else
- - einfo ("%B: definition of %s\n", abfd, name);
- + einfo ("%B: definition of %s\n", abfd, name);
- }
-
- if (command_line.cref || nocrossref_list != NULL)
- diff --git a/ld/ldver.c b/ld/ldver.c
- index 5b600a2..aaef41b 100644
- --- a/ld/ldver.c
- +++ b/ld/ldver.c
- @@ -26,14 +26,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- #include "ldemul.h"
- #include "ldmain.h"
-
- +#define C33_LD_REVISION "2.15 <2008/05/22>"
- +
- const char *ld_program_version = VERSION;
-
- void
- ldversion (noisy)
- int noisy;
- {
- +/* change T.Tazaki 2002.01.31 >>> */
- +/*
- fprintf (stdout, _("GNU ld version %s (with BFD %s)\n"),
- - ld_program_version, BFD_VERSION);
- + ld_program_version, BFD_VERSION);
- +*/
- + fprintf (stdout, _("GNU ld version %s (with BFD %s) (rev %s)\n"),
- + ld_program_version, BFD_VERSION, C33_LD_REVISION );
- +/* change T.Tazaki 2002.01.31 <<< */
-
- if (noisy)
- {
- @@ -41,9 +49,9 @@ ldversion (noisy)
-
- printf (_(" Supported emulations:\n"));
- while (*ptr)
- - {
- - printf (" %s\n", (*ptr)->emulation_name);
- - ptr++;
- - }
- + {
- + printf (" %s\n", (*ptr)->emulation_name);
- + ptr++;
- + }
- }
- }
- diff --git a/ld/lexsup.c b/ld/lexsup.c
- index e2aac47..c46ba36 100644
- --- a/ld/lexsup.c
- +++ b/ld/lexsup.c
- @@ -48,7 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-
- /* Somewhere above, sys/stat.h got included . . . . */
- #if !defined(S_ISDIR) && defined(S_IFDIR)
- -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
- #endif
-
- /* Omit args to avoid the possibility of clashing with a system header
- @@ -66,61 +66,61 @@ int parsing_defsym = 0;
- /* Codes used for the long options with no short synonyms. 150 isn't
- special; it's just an arbitrary non-ASCII char value. */
-
- -#define OPTION_ASSERT 150
- -#define OPTION_CALL_SHARED (OPTION_ASSERT + 1)
- -#define OPTION_CREF (OPTION_CALL_SHARED + 1)
- -#define OPTION_DEFSYM (OPTION_CREF + 1)
- -#define OPTION_DEMANGLE (OPTION_DEFSYM + 1)
- -#define OPTION_DYNAMIC_LINKER (OPTION_DEMANGLE + 1)
- -#define OPTION_EB (OPTION_DYNAMIC_LINKER + 1)
- -#define OPTION_EL (OPTION_EB + 1)
- -#define OPTION_EMBEDDED_RELOCS (OPTION_EL + 1)
- -#define OPTION_EXPORT_DYNAMIC (OPTION_EMBEDDED_RELOCS + 1)
- -#define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1)
- -#define OPTION_IGNORE (OPTION_HELP + 1)
- -#define OPTION_MAP (OPTION_IGNORE + 1)
- -#define OPTION_NO_DEMANGLE (OPTION_MAP + 1)
- -#define OPTION_NO_KEEP_MEMORY (OPTION_NO_DEMANGLE + 1)
- -#define OPTION_NO_WARN_MISMATCH (OPTION_NO_KEEP_MEMORY + 1)
- -#define OPTION_NOINHIBIT_EXEC (OPTION_NO_WARN_MISMATCH + 1)
- -#define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1)
- -#define OPTION_NO_WHOLE_ARCHIVE (OPTION_NON_SHARED + 1)
- -#define OPTION_OFORMAT (OPTION_NO_WHOLE_ARCHIVE + 1)
- -#define OPTION_RELAX (OPTION_OFORMAT + 1)
- -#define OPTION_RETAIN_SYMBOLS_FILE (OPTION_RELAX + 1)
- -#define OPTION_RPATH (OPTION_RETAIN_SYMBOLS_FILE + 1)
- -#define OPTION_RPATH_LINK (OPTION_RPATH + 1)
- -#define OPTION_SHARED (OPTION_RPATH_LINK + 1)
- -#define OPTION_SONAME (OPTION_SHARED + 1)
- -#define OPTION_SORT_COMMON (OPTION_SONAME + 1)
- -#define OPTION_STATS (OPTION_SORT_COMMON + 1)
- -#define OPTION_SYMBOLIC (OPTION_STATS + 1)
- -#define OPTION_TASK_LINK (OPTION_SYMBOLIC + 1)
- -#define OPTION_TBSS (OPTION_TASK_LINK + 1)
- -#define OPTION_TDATA (OPTION_TBSS + 1)
- -#define OPTION_TTEXT (OPTION_TDATA + 1)
- -#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
- -#define OPTION_UR (OPTION_TRADITIONAL_FORMAT + 1)
- -#define OPTION_VERBOSE (OPTION_UR + 1)
- -#define OPTION_VERSION (OPTION_VERBOSE + 1)
- -#define OPTION_VERSION_SCRIPT (OPTION_VERSION + 1)
- -#define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
- -#define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1)
- -#define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1)
- -#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1)
- -#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
- -#define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1)
- -#define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
- -#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
- -#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
- -#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
- -#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
- -#define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
- -#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
- -#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
- -#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
- +#define OPTION_ASSERT 150
- +#define OPTION_CALL_SHARED (OPTION_ASSERT + 1)
- +#define OPTION_CREF (OPTION_CALL_SHARED + 1)
- +#define OPTION_DEFSYM (OPTION_CREF + 1)
- +#define OPTION_DEMANGLE (OPTION_DEFSYM + 1)
- +#define OPTION_DYNAMIC_LINKER (OPTION_DEMANGLE + 1)
- +#define OPTION_EB (OPTION_DYNAMIC_LINKER + 1)
- +#define OPTION_EL (OPTION_EB + 1)
- +#define OPTION_EMBEDDED_RELOCS (OPTION_EL + 1)
- +#define OPTION_EXPORT_DYNAMIC (OPTION_EMBEDDED_RELOCS + 1)
- +#define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1)
- +#define OPTION_IGNORE (OPTION_HELP + 1)
- +#define OPTION_MAP (OPTION_IGNORE + 1)
- +#define OPTION_NO_DEMANGLE (OPTION_MAP + 1)
- +#define OPTION_NO_KEEP_MEMORY (OPTION_NO_DEMANGLE + 1)
- +#define OPTION_NO_WARN_MISMATCH (OPTION_NO_KEEP_MEMORY + 1)
- +#define OPTION_NOINHIBIT_EXEC (OPTION_NO_WARN_MISMATCH + 1)
- +#define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1)
- +#define OPTION_NO_WHOLE_ARCHIVE (OPTION_NON_SHARED + 1)
- +#define OPTION_OFORMAT (OPTION_NO_WHOLE_ARCHIVE + 1)
- +#define OPTION_RELAX (OPTION_OFORMAT + 1)
- +#define OPTION_RETAIN_SYMBOLS_FILE (OPTION_RELAX + 1)
- +#define OPTION_RPATH (OPTION_RETAIN_SYMBOLS_FILE + 1)
- +#define OPTION_RPATH_LINK (OPTION_RPATH + 1)
- +#define OPTION_SHARED (OPTION_RPATH_LINK + 1)
- +#define OPTION_SONAME (OPTION_SHARED + 1)
- +#define OPTION_SORT_COMMON (OPTION_SONAME + 1)
- +#define OPTION_STATS (OPTION_SORT_COMMON + 1)
- +#define OPTION_SYMBOLIC (OPTION_STATS + 1)
- +#define OPTION_TASK_LINK (OPTION_SYMBOLIC + 1)
- +#define OPTION_TBSS (OPTION_TASK_LINK + 1)
- +#define OPTION_TDATA (OPTION_TBSS + 1)
- +#define OPTION_TTEXT (OPTION_TDATA + 1)
- +#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
- +#define OPTION_UR (OPTION_TRADITIONAL_FORMAT + 1)
- +#define OPTION_VERBOSE (OPTION_UR + 1)
- +#define OPTION_VERSION (OPTION_VERBOSE + 1)
- +#define OPTION_VERSION_SCRIPT (OPTION_VERSION + 1)
- +#define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
- +#define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1)
- +#define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1)
- +#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1)
- +#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
- +#define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1)
- +#define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
- +#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
- +#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
- +#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
- +#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
- +#define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
- +#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
- +#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
- +#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
- #define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
- -#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
- +#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
- #define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
- #define OPTION_FINI (OPTION_INIT + 1)
-
- @@ -387,10 +387,10 @@ is_num (string, min, max, err)
- for (; *string; ++string)
- {
- if (! isdigit (*string))
- - {
- - result = err;
- - break;
- - }
- + {
- + result = err;
- + break;
- + }
- result = result * 10 + (*string - '0');
- }
- if (result < min || result > max)
- @@ -411,6 +411,11 @@ parse_args (argc, argv)
- struct option longopts[OPTION_COUNT + 1];
- int last_optind;
-
- + FILE *fpIn; /* Object file read file pointer add T.Tazaki 2003/05/14 */
- + unsigned char ucFlag; /* add T.Tazaki 2003/05/14 */
- + extern int g_iAdvance; /* add T.Tazaki 2003/05/14 */
- + extern int g_iPE; /* add T.Tazaki 2003/11/18 */
- +
- /* Starting the short option string with '-' is for programs that
- expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- @@ -421,26 +426,26 @@ parse_args (argc, argv)
- for (i = 0; i < OPTION_COUNT; i++)
- {
- if (ld_options[i].shortopt != '\0')
- - {
- - shortopts[is] = ld_options[i].shortopt;
- - ++is;
- - if (ld_options[i].opt.has_arg == required_argument
- - || ld_options[i].opt.has_arg == optional_argument)
- - {
- - shortopts[is] = ':';
- - ++is;
- - if (ld_options[i].opt.has_arg == optional_argument)
- - {
- - shortopts[is] = ':';
- - ++is;
- - }
- - }
- - }
- + {
- + shortopts[is] = ld_options[i].shortopt;
- + ++is;
- + if (ld_options[i].opt.has_arg == required_argument
- + || ld_options[i].opt.has_arg == optional_argument)
- + {
- + shortopts[is] = ':';
- + ++is;
- + if (ld_options[i].opt.has_arg == optional_argument)
- + {
- + shortopts[is] = ':';
- + ++is;
- + }
- + }
- + }
- if (ld_options[i].opt.name != NULL)
- - {
- - longopts[il] = ld_options[i].opt;
- - ++il;
- - }
- + {
- + longopts[il] = ld_options[i].opt;
- + ++il;
- + }
- }
- shortopts[is] = '\0';
- longopts[il].name = NULL;
- @@ -458,8 +463,8 @@ parse_args (argc, argv)
- This will work for most normal cases. */
- for (i = 1; i < argc; i++)
- if (strcmp (argv[i], "-G") == 0
- - && (i + 1 >= argc
- - || ! isdigit ((unsigned char) argv[i + 1][0])))
- + && (i + 1 >= argc
- + || ! isdigit ((unsigned char) argv[i + 1][0])))
- argv[i] = (char *) "--shared";
-
- /* Because we permit long options to start with a single dash, and
- @@ -477,15 +482,15 @@ parse_args (argc, argv)
- for (i = 1; i < argc; i++)
- {
- if (argv[i][0] == '-'
- - && argv[i][1] == 'l'
- - && argv[i][2] != '\0')
- - {
- - char *n;
- -
- - n = (char *) xmalloc (strlen (argv[i]) + 20);
- - sprintf (n, "--library=%s", argv[i] + 2);
- - argv[i] = n;
- - }
- + && argv[i][1] == 'l'
- + && argv[i][2] != '\0')
- + {
- + char *n;
- +
- + n = (char *) xmalloc (strlen (argv[i]) + 20);
- + sprintf (n, "--library=%s", argv[i] + 2);
- + argv[i] = n;
- + }
- }
-
- last_optind = -1;
- @@ -495,498 +500,532 @@ parse_args (argc, argv)
- int optc;
-
- /* Using last_optind lets us avoid calling ldemul_parse_args
- - multiple times on a single option, which would lead to
- - confusion in the internal static variables maintained by
- - getopt. This could otherwise happen for an argument like
- - -nx, in which the -n is parsed as a single option, and we
- - loop around to pick up the -x. */
- + multiple times on a single option, which would lead to
- + confusion in the internal static variables maintained by
- + getopt. This could otherwise happen for an argument like
- + -nx, in which the -n is parsed as a single option, and we
- + loop around to pick up the -x. */
- if (optind != last_optind)
- - {
- - if (ldemul_parse_args (argc, argv))
- - continue;
- - last_optind = optind;
- - }
- + {
- + if (ldemul_parse_args (argc, argv))
- + continue;
- + last_optind = optind;
- + }
-
- /* getopt_long_only is like getopt_long, but '-' as well as '--'
- - can indicate a long option. */
- + can indicate a long option. */
- optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
-
- if (optc == -1)
- - break;
- + break;
- switch (optc)
- - {
- - default:
- - fprintf (stderr,
- - _("%s: use the --help option for usage information\n"),
- - program_name);
- - xexit (1);
- - case 1: /* File name. */
- - lang_add_input_file (optarg, lang_input_file_is_file_enum,
- - (char *) NULL);
- - break;
- -
- - case OPTION_IGNORE:
- - break;
- - case 'a':
- - /* For HP/UX compatibility. Actually -a shared should mean
- + {
- + default:
- + fprintf (stderr,
- + _("%s: use the --help option for usage information\n"),
- + program_name);
- + xexit (1);
- + case 1: /* File name. */
- + lang_add_input_file (optarg, lang_input_file_is_file_enum,
- + (char *) NULL);
- +
- +/* add T.Tazaki 2003/05/14 >>> */
- + /* Save Link Object file name table. for ELF header flag */
- + fpIn = fopen( optarg, "rb" );
- + if( fpIn != NULL )
- + {
- + fseek( fpIn, 39, SEEK_SET );
- + ucFlag = fgetc( fpIn );
- + if( ucFlag == 0x41 ) /* Advanced macro ? */
- + {
- +/* >>>>> DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
- +// if( g_iPE == 1 ) /* already link PE object file ? add T.Tazaki 2004/04/28 */
- +// {
- +// fprintf( stderr,"Warning: do not link Advanced macro object file and PE object file.\n" );
- +// }
- +/* <<<<< DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
- +
- + g_iAdvance = 1; /* on */
- + }
- + else if( ucFlag == 'P' ) /* PE macro ? add T.Tazaki 2003/11/18 */
- + {
- +/* >>>>> DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
- +// if( g_iAdvance == 1 ) /* already link Advanced object file ? add T.Tazaki 2004/04/28 */
- +// {
- +// fprintf( stderr,"Warning: do not link Advanced macro object file and PE object file.\n" );
- +// }
- +/* <<<<< DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
- +
- + g_iPE = 1; /* on */
- + }
- + fclose( fpIn );
- + }
- + break;
- +/* add T.Tazaki 2003/05/14 <<< */
- + break;
- +
- + case OPTION_IGNORE:
- + break;
- + case 'a':
- + /* For HP/UX compatibility. Actually -a shared should mean
- ``use only shared libraries'' but, then, we don't
- currently support shared libraries on HP/UX anyhow. */
- - if (strcmp (optarg, "archive") == 0)
- - config.dynamic_link = false;
- - else if (strcmp (optarg, "shared") == 0
- - || strcmp (optarg, "default") == 0)
- - config.dynamic_link = true;
- - else
- - einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
- - break;
- - case OPTION_ASSERT:
- - /* FIXME: We just ignore these, but we should handle them. */
- - if (strcmp (optarg, "definitions") == 0)
- - ;
- - else if (strcmp (optarg, "nodefinitions") == 0)
- - ;
- - else if (strcmp (optarg, "nosymbolic") == 0)
- - ;
- - else if (strcmp (optarg, "pure-text") == 0)
- - ;
- - else
- - einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
- - break;
- - case 'A':
- - ldfile_add_arch (optarg);
- - break;
- - case 'b':
- - lang_add_target (optarg);
- - break;
- - case 'c':
- - ldfile_open_command_file (optarg);
- - parser_input = input_mri_script;
- - yyparse ();
- - break;
- - case OPTION_CALL_SHARED:
- - config.dynamic_link = true;
- - break;
- - case OPTION_NON_SHARED:
- - config.dynamic_link = false;
- - break;
- - case OPTION_CREF:
- - command_line.cref = true;
- - link_info.notice_all = true;
- - break;
- - case 'd':
- - command_line.force_common_definition = true;
- - break;
- - case OPTION_DEFSYM:
- - lex_string = optarg;
- - lex_redirect (optarg);
- - parser_input = input_defsym;
- - parsing_defsym = 1;
- - yyparse ();
- - parsing_defsym = 0;
- - lex_string = NULL;
- - break;
- - case OPTION_DEMANGLE:
- - demangling = true;
- - break;
- - case OPTION_DYNAMIC_LINKER:
- - command_line.interpreter = optarg;
- - break;
- - case OPTION_EB:
- - command_line.endian = ENDIAN_BIG;
- - break;
- - case OPTION_EL:
- - command_line.endian = ENDIAN_LITTLE;
- - break;
- - case OPTION_EMBEDDED_RELOCS:
- - command_line.embedded_relocs = true;
- - break;
- - case OPTION_EXPORT_DYNAMIC:
- - case 'E': /* HP/UX compatibility. */
- - command_line.export_dynamic = true;
- - break;
- - case 'e':
- - lang_add_entry (optarg, true);
- - break;
- - case 'f':
- - if (command_line.auxiliary_filters == NULL)
- - {
- - command_line.auxiliary_filters =
- - (char **) xmalloc (2 * sizeof (char *));
- - command_line.auxiliary_filters[0] = optarg;
- - command_line.auxiliary_filters[1] = NULL;
- - }
- - else
- - {
- - int c;
- - char **p;
- -
- - c = 0;
- - for (p = command_line.auxiliary_filters; *p != NULL; p++)
- - ++c;
- - command_line.auxiliary_filters =
- - (char **) xrealloc (command_line.auxiliary_filters,
- - (c + 2) * sizeof (char *));
- - command_line.auxiliary_filters[c] = optarg;
- - command_line.auxiliary_filters[c + 1] = NULL;
- - }
- - break;
- - case 'F':
- - command_line.filter_shlib = optarg;
- - break;
- - case OPTION_FORCE_EXE_SUFFIX:
- - command_line.force_exe_suffix = true;
- - break;
- - case 'G':
- - {
- - char *end;
- - g_switch_value = strtoul (optarg, &end, 0);
- - if (*end)
- - einfo (_("%P%F: invalid number `%s'\n"), optarg);
- - }
- - break;
- - case 'g':
- - /* Ignore. */
- - break;
- - case OPTION_GC_SECTIONS:
- - command_line.gc_sections = true;
- - break;
- - case OPTION_HELP:
- - help ();
- - xexit (0);
- - break;
- - case 'L':
- - ldfile_add_library_path (optarg, true);
- - break;
- - case 'l':
- - lang_add_input_file (optarg, lang_input_file_is_l_enum,
- - (char *) NULL);
- - break;
- - case 'M':
- - config.map_filename = "-";
- - break;
- - case 'm':
- - /* Ignore. Was handled in a pre-parse. */
- - break;
- - case OPTION_MAP:
- - config.map_filename = optarg;
- - break;
- - case 'N':
- - config.text_read_only = false;
- - config.magic_demand_paged = false;
- - config.dynamic_link = false;
- - break;
- - case 'n':
- - config.magic_demand_paged = false;
- - config.dynamic_link = false;
- - break;
- - case OPTION_NO_DEMANGLE:
- - demangling = false;
- - break;
- - case OPTION_NO_GC_SECTIONS:
- - command_line.gc_sections = false;
- - break;
- - case OPTION_NO_KEEP_MEMORY:
- - link_info.keep_memory = false;
- - break;
- - case OPTION_NO_UNDEFINED:
- - link_info.no_undefined = true;
- - break;
- - case OPTION_NO_WARN_MISMATCH:
- - command_line.warn_mismatch = false;
- - break;
- - case OPTION_NOINHIBIT_EXEC:
- - force_make_executable = true;
- - break;
- - case OPTION_NO_WHOLE_ARCHIVE:
- - whole_archive = false;
- - break;
- - case 'O':
- - /* FIXME "-O<non-digits> <value>" used to set the address of
- - section <non-digits>. Was this for compatibility with
- - something, or can we create a new option to do that
- - (with a syntax similar to -defsym)?
- - getopt can't handle two args to an option without kludges. */
- -
- - /* Enable optimizations of output files. */
- - link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
- - break;
- - case 'o':
- - lang_add_output (optarg, 0);
- - break;
- - case OPTION_OFORMAT:
- - lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
- - break;
- - case 'i':
- - case 'r':
- - link_info.relocateable = true;
- - config.build_constructors = false;
- - config.magic_demand_paged = false;
- - config.text_read_only = false;
- - config.dynamic_link = false;
- - break;
- - case 'R':
- - /* The GNU linker traditionally uses -R to mean to include
- - only the symbols from a file. The Solaris linker uses -R
- - to set the path used by the runtime linker to find
- - libraries. This is the GNU linker -rpath argument. We
- - try to support both simultaneously by checking the file
- - named. If it is a directory, rather than a regular file,
- - we assume -rpath was meant. */
- - {
- - struct stat s;
- -
- - if (stat (optarg, &s) >= 0
- - && ! S_ISDIR (s.st_mode))
- - {
- - lang_add_input_file (optarg,
- - lang_input_file_is_symbols_only_enum,
- - (char *) NULL);
- - break;
- - }
- - }
- - /* Fall through. */
- - case OPTION_RPATH:
- - if (command_line.rpath == NULL)
- - command_line.rpath = buystring (optarg);
- - else
- - {
- - size_t rpath_len = strlen (command_line.rpath);
- - size_t optarg_len = strlen (optarg);
- - char *buf;
- - char *cp = command_line.rpath;
- -
- - /* First see whether OPTARG is already in the path. */
- - do
- - {
- - size_t idx = 0;
- - while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
- - ++idx;
- - if (optarg[idx] == '\0'
- - && (cp[idx] == '\0' || cp[idx] == ':'))
- - /* We found it. */
- - break;
- -
- - /* Not yet found. */
- - cp = strchr (cp, ':');
- - if (cp != NULL)
- - ++cp;
- - }
- - while (cp != NULL);
- -
- - if (cp == NULL)
- - {
- - buf = xmalloc (rpath_len + optarg_len + 2);
- - sprintf (buf, "%s:%s", command_line.rpath, optarg);
- - free (command_line.rpath);
- - command_line.rpath = buf;
- - }
- - }
- - break;
- - case OPTION_RPATH_LINK:
- - if (command_line.rpath_link == NULL)
- - command_line.rpath_link = buystring (optarg);
- - else
- - {
- - char *buf;
- -
- - buf = xmalloc (strlen (command_line.rpath_link)
- - + strlen (optarg)
- - + 2);
- - sprintf (buf, "%s:%s", command_line.rpath_link, optarg);
- - free (command_line.rpath_link);
- - command_line.rpath_link = buf;
- - }
- - break;
- - case OPTION_RELAX:
- - command_line.relax = true;
- - break;
- - case OPTION_RETAIN_SYMBOLS_FILE:
- - add_keepsyms_file (optarg);
- - break;
- - case 'S':
- - link_info.strip = strip_debugger;
- - break;
- - case 's':
- - link_info.strip = strip_all;
- - break;
- - case OPTION_SHARED:
- - if (config.has_shared)
- - link_info.shared = true;
- - else
- - einfo (_("%P%F: -shared not supported\n"));
- - break;
- - case 'h': /* Used on Solaris. */
- - case OPTION_SONAME:
- - command_line.soname = optarg;
- - break;
- - case OPTION_SORT_COMMON:
- - config.sort_common = true;
- - break;
- - case OPTION_STATS:
- - config.stats = true;
- - break;
- - case OPTION_SYMBOLIC:
- - link_info.symbolic = true;
- - break;
- - case 't':
- - trace_files = true;
- - break;
- - case 'T':
- - ldfile_open_command_file (optarg);
- - parser_input = input_script;
- - yyparse ();
- - break;
- - case OPTION_TBSS:
- - set_section_start (".bss", optarg);
- - break;
- - case OPTION_TDATA:
- - set_section_start (".data", optarg);
- - break;
- - case OPTION_TTEXT:
- - set_section_start (".text", optarg);
- - break;
- - case OPTION_TRADITIONAL_FORMAT:
- - link_info.traditional_format = true;
- - break;
- - case OPTION_TASK_LINK:
- - link_info.task_link = true;
- - /* Fall through - do an implied -r option. */
- - case OPTION_UR:
- - link_info.relocateable = true;
- - config.build_constructors = true;
- - config.magic_demand_paged = false;
- - config.text_read_only = false;
- - config.dynamic_link = false;
- - break;
- - case 'u':
- - ldlang_add_undef (optarg);
- - break;
- - case OPTION_VERBOSE:
- - ldversion (1);
- - version_printed = true;
- - trace_file_tries = true;
- - break;
- - case 'v':
- - ldversion (0);
- - version_printed = true;
- - break;
- - case 'V':
- - ldversion (1);
- - version_printed = true;
- - break;
- - case OPTION_VERSION:
- - /* This output is intended to follow the GNU standards document. */
- - printf ("GNU ld %s\n", ld_program_version);
- - printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
- - printf (_("\
- + if (strcmp (optarg, "archive") == 0)
- + config.dynamic_link = false;
- + else if (strcmp (optarg, "shared") == 0
- + || strcmp (optarg, "default") == 0)
- + config.dynamic_link = true;
- + else
- + einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
- + break;
- + case OPTION_ASSERT:
- + /* FIXME: We just ignore these, but we should handle them. */
- + if (strcmp (optarg, "definitions") == 0)
- + ;
- + else if (strcmp (optarg, "nodefinitions") == 0)
- + ;
- + else if (strcmp (optarg, "nosymbolic") == 0)
- + ;
- + else if (strcmp (optarg, "pure-text") == 0)
- + ;
- + else
- + einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
- + break;
- + case 'A':
- + ldfile_add_arch (optarg);
- + break;
- + case 'b':
- + lang_add_target (optarg);
- + break;
- + case 'c':
- + ldfile_open_command_file (optarg);
- + parser_input = input_mri_script;
- + yyparse ();
- + break;
- + case OPTION_CALL_SHARED:
- + config.dynamic_link = true;
- + break;
- + case OPTION_NON_SHARED:
- + config.dynamic_link = false;
- + break;
- + case OPTION_CREF:
- + command_line.cref = true;
- + link_info.notice_all = true;
- + break;
- + case 'd':
- + command_line.force_common_definition = true;
- + break;
- + case OPTION_DEFSYM:
- + lex_string = optarg;
- + lex_redirect (optarg);
- + parser_input = input_defsym;
- + parsing_defsym = 1;
- + yyparse ();
- + parsing_defsym = 0;
- + lex_string = NULL;
- + break;
- + case OPTION_DEMANGLE:
- + demangling = true;
- + break;
- + case OPTION_DYNAMIC_LINKER:
- + command_line.interpreter = optarg;
- + break;
- + case OPTION_EB:
- + command_line.endian = ENDIAN_BIG;
- + break;
- + case OPTION_EL:
- + command_line.endian = ENDIAN_LITTLE;
- + break;
- + case OPTION_EMBEDDED_RELOCS:
- + command_line.embedded_relocs = true;
- + break;
- + case OPTION_EXPORT_DYNAMIC:
- + case 'E': /* HP/UX compatibility. */
- + command_line.export_dynamic = true;
- + break;
- + case 'e':
- + lang_add_entry (optarg, true);
- + break;
- + case 'f':
- + if (command_line.auxiliary_filters == NULL)
- + {
- + command_line.auxiliary_filters =
- + (char **) xmalloc (2 * sizeof (char *));
- + command_line.auxiliary_filters[0] = optarg;
- + command_line.auxiliary_filters[1] = NULL;
- + }
- + else
- + {
- + int c;
- + char **p;
- +
- + c = 0;
- + for (p = command_line.auxiliary_filters; *p != NULL; p++)
- + ++c;
- + command_line.auxiliary_filters =
- + (char **) xrealloc (command_line.auxiliary_filters,
- + (c + 2) * sizeof (char *));
- + command_line.auxiliary_filters[c] = optarg;
- + command_line.auxiliary_filters[c + 1] = NULL;
- + }
- + break;
- + case 'F':
- + command_line.filter_shlib = optarg;
- + break;
- + case OPTION_FORCE_EXE_SUFFIX:
- + command_line.force_exe_suffix = true;
- + break;
- + case 'G':
- + {
- + char *end;
- + g_switch_value = strtoul (optarg, &end, 0);
- + if (*end)
- + einfo (_("%P%F: invalid number `%s'\n"), optarg);
- + }
- + break;
- + case 'g':
- + /* Ignore. */
- + break;
- + case OPTION_GC_SECTIONS:
- + command_line.gc_sections = true;
- + break;
- + case OPTION_HELP:
- + help ();
- + xexit (0);
- + break;
- + case 'L':
- + ldfile_add_library_path (optarg, true);
- + break;
- + case 'l':
- + lang_add_input_file (optarg, lang_input_file_is_l_enum,
- + (char *) NULL);
- + break;
- + case 'M':
- + config.map_filename = "-";
- + break;
- + case 'm':
- + /* Ignore. Was handled in a pre-parse. */
- + break;
- + case OPTION_MAP:
- + config.map_filename = optarg;
- + break;
- + case 'N':
- + config.text_read_only = false;
- + config.magic_demand_paged = false;
- + config.dynamic_link = false;
- + break;
- + case 'n':
- + config.magic_demand_paged = false;
- + config.dynamic_link = false;
- + break;
- + case OPTION_NO_DEMANGLE:
- + demangling = false;
- + break;
- + case OPTION_NO_GC_SECTIONS:
- + command_line.gc_sections = false;
- + break;
- + case OPTION_NO_KEEP_MEMORY:
- + link_info.keep_memory = false;
- + break;
- + case OPTION_NO_UNDEFINED:
- + link_info.no_undefined = true;
- + break;
- + case OPTION_NO_WARN_MISMATCH:
- + command_line.warn_mismatch = false;
- + break;
- + case OPTION_NOINHIBIT_EXEC:
- + force_make_executable = true;
- + break;
- + case OPTION_NO_WHOLE_ARCHIVE:
- + whole_archive = false;
- + break;
- + case 'O':
- + /* FIXME "-O<non-digits> <value>" used to set the address of
- + section <non-digits>. Was this for compatibility with
- + something, or can we create a new option to do that
- + (with a syntax similar to -defsym)?
- + getopt can't handle two args to an option without kludges. */
- +
- + /* Enable optimizations of output files. */
- + link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
- + break;
- + case 'o':
- + lang_add_output (optarg, 0);
- + break;
- + case OPTION_OFORMAT:
- + lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
- + break;
- + case 'i':
- + case 'r':
- + link_info.relocateable = true;
- + config.build_constructors = false;
- + config.magic_demand_paged = false;
- + config.text_read_only = false;
- + config.dynamic_link = false;
- + break;
- + case 'R':
- + /* The GNU linker traditionally uses -R to mean to include
- + only the symbols from a file. The Solaris linker uses -R
- + to set the path used by the runtime linker to find
- + libraries. This is the GNU linker -rpath argument. We
- + try to support both simultaneously by checking the file
- + named. If it is a directory, rather than a regular file,
- + we assume -rpath was meant. */
- + {
- + struct stat s;
- +
- + if (stat (optarg, &s) >= 0
- + && ! S_ISDIR (s.st_mode))
- + {
- + lang_add_input_file (optarg,
- + lang_input_file_is_symbols_only_enum,
- + (char *) NULL);
- + break;
- + }
- + }
- + /* Fall through. */
- + case OPTION_RPATH:
- + if (command_line.rpath == NULL)
- + command_line.rpath = buystring (optarg);
- + else
- + {
- + size_t rpath_len = strlen (command_line.rpath);
- + size_t optarg_len = strlen (optarg);
- + char *buf;
- + char *cp = command_line.rpath;
- +
- + /* First see whether OPTARG is already in the path. */
- + do
- + {
- + size_t idx = 0;
- + while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
- + ++idx;
- + if (optarg[idx] == '\0'
- + && (cp[idx] == '\0' || cp[idx] == ':'))
- + /* We found it. */
- + break;
- +
- + /* Not yet found. */
- + cp = strchr (cp, ':');
- + if (cp != NULL)
- + ++cp;
- + }
- + while (cp != NULL);
- +
- + if (cp == NULL)
- + {
- + buf = xmalloc (rpath_len + optarg_len + 2);
- + sprintf (buf, "%s:%s", command_line.rpath, optarg);
- + free (command_line.rpath);
- + command_line.rpath = buf;
- + }
- + }
- + break;
- + case OPTION_RPATH_LINK:
- + if (command_line.rpath_link == NULL)
- + command_line.rpath_link = buystring (optarg);
- + else
- + {
- + char *buf;
- +
- + buf = xmalloc (strlen (command_line.rpath_link)
- + + strlen (optarg)
- + + 2);
- + sprintf (buf, "%s:%s", command_line.rpath_link, optarg);
- + free (command_line.rpath_link);
- + command_line.rpath_link = buf;
- + }
- + break;
- + case OPTION_RELAX:
- + command_line.relax = true;
- + break;
- + case OPTION_RETAIN_SYMBOLS_FILE:
- + add_keepsyms_file (optarg);
- + break;
- + case 'S':
- + link_info.strip = strip_debugger;
- + break;
- + case 's':
- + link_info.strip = strip_all;
- + break;
- + case OPTION_SHARED:
- + if (config.has_shared)
- + link_info.shared = true;
- + else
- + einfo (_("%P%F: -shared not supported\n"));
- + break;
- + case 'h': /* Used on Solaris. */
- + case OPTION_SONAME:
- + command_line.soname = optarg;
- + break;
- + case OPTION_SORT_COMMON:
- + config.sort_common = true;
- + break;
- + case OPTION_STATS:
- + config.stats = true;
- + break;
- + case OPTION_SYMBOLIC:
- + link_info.symbolic = true;
- + break;
- + case 't':
- + trace_files = true;
- + break;
- + case 'T':
- + ldfile_open_command_file (optarg);
- + parser_input = input_script;
- + yyparse ();
- + break;
- + case OPTION_TBSS:
- + set_section_start (".bss", optarg);
- + break;
- + case OPTION_TDATA:
- + set_section_start (".data", optarg);
- + break;
- + case OPTION_TTEXT:
- + set_section_start (".text", optarg);
- + break;
- + case OPTION_TRADITIONAL_FORMAT:
- + link_info.traditional_format = true;
- + break;
- + case OPTION_TASK_LINK:
- + link_info.task_link = true;
- + /* Fall through - do an implied -r option. */
- + case OPTION_UR:
- + link_info.relocateable = true;
- + config.build_constructors = true;
- + config.magic_demand_paged = false;
- + config.text_read_only = false;
- + config.dynamic_link = false;
- + break;
- + case 'u':
- + ldlang_add_undef (optarg);
- + break;
- + case OPTION_VERBOSE:
- + ldversion (1);
- + version_printed = true;
- + trace_file_tries = true;
- + break;
- + case 'v':
- + ldversion (0);
- + version_printed = true;
- + break;
- + case 'V':
- + ldversion (1);
- + version_printed = true;
- + break;
- + case OPTION_VERSION:
- + /* This output is intended to follow the GNU standards document. */
- + printf ("GNU ld %s\n", ld_program_version);
- + printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
- + printf (_("\
- This program is free software; you may redistribute it under the terms of\n\
- the GNU General Public License. This program has absolutely no warranty.\n"));
- - {
- - ld_emulation_xfer_type **ptr = ld_emulations;
- + {
- + ld_emulation_xfer_type **ptr = ld_emulations;
-
- - printf (_(" Supported emulations:\n"));
- - while (*ptr)
- - {
- - printf (" %s\n", (*ptr)->emulation_name);
- - ptr++;
- - }
- - }
- - xexit (0);
- - break;
- - case OPTION_VERSION_SCRIPT:
- - /* This option indicates a small script that only specifies
- + printf (_(" Supported emulations:\n"));
- + while (*ptr)
- + {
- + printf (" %s\n", (*ptr)->emulation_name);
- + ptr++;
- + }
- + }
- + xexit (0);
- + break;
- + case OPTION_VERSION_SCRIPT:
- + /* This option indicates a small script that only specifies
- version information. Read it, but don't assume that
- we've seen a linker script. */
- - {
- - boolean hold_had_script;
- -
- - hold_had_script = had_script;
- - ldfile_open_command_file (optarg);
- - had_script = hold_had_script;
- - parser_input = input_version_script;
- - yyparse ();
- - }
- - break;
- - case OPTION_VERSION_EXPORTS_SECTION:
- - /* This option records a version symbol to be applied to the
- - symbols listed for export to be found in the object files
- - .exports sections. */
- - command_line.version_exports_section = optarg;
- - break;
- - case OPTION_WARN_COMMON:
- - config.warn_common = true;
- - break;
- - case OPTION_WARN_CONSTRUCTORS:
- - config.warn_constructors = true;
- - break;
- - case OPTION_WARN_MULTIPLE_GP:
- - config.warn_multiple_gp = true;
- - break;
- - case OPTION_WARN_ONCE:
- - config.warn_once = true;
- - break;
- - case OPTION_WARN_SECTION_ALIGN:
- - config.warn_section_align = true;
- - break;
- - case OPTION_WHOLE_ARCHIVE:
- - whole_archive = true;
- - break;
- - case OPTION_WRAP:
- - add_wrap (optarg);
- - break;
- - case 'X':
- - link_info.discard = discard_l;
- - break;
- - case 'x':
- - link_info.discard = discard_all;
- - break;
- - case 'Y':
- - if (strncmp (optarg, "P,", 2) == 0)
- - optarg += 2;
- - default_dirlist = xstrdup (optarg);
- - break;
- - case 'y':
- - add_ysym (optarg);
- - break;
- - case 'z':
- - /* We accept and ignore this option for Solaris
- + {
- + boolean hold_had_script;
- +
- + hold_had_script = had_script;
- + ldfile_open_command_file (optarg);
- + had_script = hold_had_script;
- + parser_input = input_version_script;
- + yyparse ();
- + }
- + break;
- + case OPTION_VERSION_EXPORTS_SECTION:
- + /* This option records a version symbol to be applied to the
- + symbols listed for export to be found in the object files
- + .exports sections. */
- + command_line.version_exports_section = optarg;
- + break;
- + case OPTION_WARN_COMMON:
- + config.warn_common = true;
- + break;
- + case OPTION_WARN_CONSTRUCTORS:
- + config.warn_constructors = true;
- + break;
- + case OPTION_WARN_MULTIPLE_GP:
- + config.warn_multiple_gp = true;
- + break;
- + case OPTION_WARN_ONCE:
- + config.warn_once = true;
- + break;
- + case OPTION_WARN_SECTION_ALIGN:
- + config.warn_section_align = true;
- + break;
- + case OPTION_WHOLE_ARCHIVE:
- + whole_archive = true;
- + break;
- + case OPTION_WRAP:
- + add_wrap (optarg);
- + break;
- + case 'X':
- + link_info.discard = discard_l;
- + break;
- + case 'x':
- + link_info.discard = discard_all;
- + break;
- + case 'Y':
- + if (strncmp (optarg, "P,", 2) == 0)
- + optarg += 2;
- + default_dirlist = xstrdup (optarg);
- + break;
- + case 'y':
- + add_ysym (optarg);
- + break;
- + case 'z':
- + /* We accept and ignore this option for Solaris
- compatibility. Actually, on Solaris, optarg is not
- ignored. Someday we should handle it correctly. FIXME. */
- - break;
- - case OPTION_SPLIT_BY_RELOC:
- - config.split_by_reloc = strtoul (optarg, NULL, 0);
- - break;
- - case OPTION_SPLIT_BY_FILE:
- - config.split_by_file = true;
- - break;
- - case OPTION_CHECK_SECTIONS:
- - command_line.check_section_addresses = true;
- - break;
- - case OPTION_NO_CHECK_SECTIONS:
- - command_line.check_section_addresses = false;
- - break;
- - case '(':
- - if (ingroup)
- - {
- - fprintf (stderr,
- - _("%s: may not nest groups (--help for usage)\n"),
- - program_name);
- - xexit (1);
- - }
- - lang_enter_group ();
- - ingroup = 1;
- - break;
- - case ')':
- - if (! ingroup)
- - {
- - fprintf (stderr,
- - _("%s: group ended before it began (--help for usage)\n"),
- - program_name);
- - xexit (1);
- - }
- - lang_leave_group ();
- - ingroup = 0;
- - break;
- + break;
- + case OPTION_SPLIT_BY_RELOC:
- + config.split_by_reloc = strtoul (optarg, NULL, 0);
- + break;
- + case OPTION_SPLIT_BY_FILE:
- + config.split_by_file = true;
- + break;
- + case OPTION_CHECK_SECTIONS:
- + command_line.check_section_addresses = true;
- + break;
- + case OPTION_NO_CHECK_SECTIONS:
- + command_line.check_section_addresses = false;
- + break;
- + case '(':
- + if (ingroup)
- + {
- + fprintf (stderr,
- + _("%s: may not nest groups (--help for usage)\n"),
- + program_name);
- + xexit (1);
- + }
- + lang_enter_group ();
- + ingroup = 1;
- + break;
- + case ')':
- + if (! ingroup)
- + {
- + fprintf (stderr,
- + _("%s: group ended before it began (--help for usage)\n"),
- + program_name);
- + xexit (1);
- + }
- + lang_leave_group ();
- + ingroup = 0;
- + break;
- case OPTION_MPC860C0:
- link_info.mpc860c0 = 20; /* default value (in bytes) */
- if (optarg)
- @@ -997,8 +1036,8 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
- if (words == 0)
- {
- fprintf (stderr,
- - _("%s: Invalid argument to option \"mpc860c0\"\n"),
- - program_name);
- + _("%s: Invalid argument to option \"mpc860c0\"\n"),
- + program_name);
- xexit (1);
- }
- link_info.mpc860c0 = words * 4; /* convert words to bytes */
- @@ -1006,14 +1045,14 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
- command_line.relax = true;
- break;
-
- - case OPTION_INIT:
- - link_info.init_function = optarg;
- - break;
- -
- - case OPTION_FINI:
- - link_info.fini_function = optarg;
- - break;
- - }
- + case OPTION_INIT:
- + link_info.init_function = optarg;
- + break;
- +
- + case OPTION_FINI:
- + link_info.fini_function = optarg;
- + break;
- + }
- }
-
- if (ingroup)
- @@ -1037,11 +1076,11 @@ set_default_dirlist (dirlist_ptr)
- {
- p = strchr (dirlist_ptr, PATH_SEPARATOR);
- if (p != NULL)
- - *p = '\0';
- + *p = '\0';
- if (*dirlist_ptr != '\0')
- - ldfile_add_library_path (dirlist_ptr, true);
- + ldfile_add_library_path (dirlist_ptr, true);
- if (p == NULL)
- - break;
- + break;
- dirlist_ptr = p + 1;
- }
- }
- @@ -1071,76 +1110,76 @@ help ()
- for (i = 0; i < OPTION_COUNT; i++)
- {
- if (ld_options[i].doc != NULL)
- - {
- - boolean comma;
- - int len;
- - int j;
- -
- - printf (" ");
- -
- - comma = false;
- - len = 2;
- -
- - j = i;
- - do
- - {
- - if (ld_options[j].shortopt != '\0'
- - && ld_options[j].control != NO_HELP)
- - {
- - printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
- - len += (comma ? 2 : 0) + 2;
- - if (ld_options[j].arg != NULL)
- - {
- - if (ld_options[j].opt.has_arg != optional_argument)
- - {
- - printf (" ");
- - ++len;
- - }
- - printf ("%s", _(ld_options[j].arg));
- - len += strlen (_(ld_options[j].arg));
- - }
- - comma = true;
- - }
- - ++j;
- - }
- - while (j < OPTION_COUNT && ld_options[j].doc == NULL);
- -
- - j = i;
- - do
- - {
- - if (ld_options[j].opt.name != NULL
- - && ld_options[j].control != NO_HELP)
- - {
- - printf ("%s-%s%s",
- - comma ? ", " : "",
- - ld_options[j].control == TWO_DASHES ? "-" : "",
- - ld_options[j].opt.name);
- - len += ((comma ? 2 : 0)
- - + 1
- - + (ld_options[j].control == TWO_DASHES ? 1 : 0)
- - + strlen (ld_options[j].opt.name));
- - if (ld_options[j].arg != NULL)
- - {
- - printf (" %s", _(ld_options[j].arg));
- - len += 1 + strlen (_(ld_options[j].arg));
- - }
- - comma = true;
- - }
- - ++j;
- - }
- - while (j < OPTION_COUNT && ld_options[j].doc == NULL);
- -
- - if (len >= 30)
- - {
- - printf ("\n");
- - len = 0;
- - }
- -
- - for (; len < 30; len++)
- - putchar (' ');
- -
- - printf ("%s\n", _(ld_options[i].doc));
- - }
- + {
- + boolean comma;
- + int len;
- + int j;
- +
- + printf (" ");
- +
- + comma = false;
- + len = 2;
- +
- + j = i;
- + do
- + {
- + if (ld_options[j].shortopt != '\0'
- + && ld_options[j].control != NO_HELP)
- + {
- + printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
- + len += (comma ? 2 : 0) + 2;
- + if (ld_options[j].arg != NULL)
- + {
- + if (ld_options[j].opt.has_arg != optional_argument)
- + {
- + printf (" ");
- + ++len;
- + }
- + printf ("%s", _(ld_options[j].arg));
- + len += strlen (_(ld_options[j].arg));
- + }
- + comma = true;
- + }
- + ++j;
- + }
- + while (j < OPTION_COUNT && ld_options[j].doc == NULL);
- +
- + j = i;
- + do
- + {
- + if (ld_options[j].opt.name != NULL
- + && ld_options[j].control != NO_HELP)
- + {
- + printf ("%s-%s%s",
- + comma ? ", " : "",
- + ld_options[j].control == TWO_DASHES ? "-" : "",
- + ld_options[j].opt.name);
- + len += ((comma ? 2 : 0)
- + + 1
- + + (ld_options[j].control == TWO_DASHES ? 1 : 0)
- + + strlen (ld_options[j].opt.name));
- + if (ld_options[j].arg != NULL)
- + {
- + printf (" %s", _(ld_options[j].arg));
- + len += 1 + strlen (_(ld_options[j].arg));
- + }
- + comma = true;
- + }
- + ++j;
- + }
- + while (j < OPTION_COUNT && ld_options[j].doc == NULL);
- +
- + if (len >= 30)
- + {
- + printf ("\n");
- + len = 0;
- + }
- +
- + for (; len < 30; len++)
- + putchar (' ');
- +
- + printf ("%s\n", _(ld_options[i].doc));
- + }
- }
-
- /* Note: Various tools (such as libtool) depend upon the
- diff --git a/ld/scripttempl/c33.sc b/ld/scripttempl/c33.sc
- new file mode 100644
- index 0000000..add0cc4
- --- /dev/null
- +++ b/ld/scripttempl/c33.sc
- @@ -0,0 +1,98 @@
- +cat << EOF
- +/*=======================================================================
- +
- + c33 ld default linker script
- +
- + 2002.02.28 start T.Tazaki
- +
- +=========================================================================*/
- +OUTPUT_FORMAT("elf32-c33", "elf32-c33",
- + "elf32-c33")
- +OUTPUT_ARCH(c33)
- +SEARCH_DIR(.);
- +SECTIONS
- +{
- +
- + __dp = 0x0;
- +
- + . = 0x0;
- + .comm : { *(.comm) }
- + .bss : { *(.bss) }
- + .data : { *(.data) }
- +
- + . = 0xc00000;
- + .text : { *(.text) }
- + .rodata : { *(.rodata) }
- +
- + /* Read-only sections, merged into text segment: */
- + .interp : { *(.interp) }
- + .hash : { *(.hash) }
- + .dynsym : { *(.dynsym) }
- + .dynstr : { *(.dynstr) }
- + .rel.text : { *(.rel.text) }
- + .rela.text : { *(.rela.text) }
- + .rel.data : { *(.rel.data) }
- + .rela.data : { *(.rela.data) }
- + .rel.rodata : { *(.rel.rodata) }
- + .rela.rodata : { *(.rela.rodata) }
- + .rel.got : { *(.rel.got) }
- + .rela.got : { *(.rela.got) }
- + .rel.ctors : { *(.rel.ctors) }
- + .rela.ctors : { *(.rela.ctors) }
- + .rel.dtors : { *(.rel.dtors) }
- + .rela.dtors : { *(.rela.dtors) }
- + .rel.init : { *(.rel.init) }
- + .rela.init : { *(.rela.init) }
- + .rel.fini : { *(.rel.fini) }
- + .rela.fini : { *(.rela.fini) }
- + .rel.bss : { *(.rel.bss) }
- + .rela.bss : { *(.rela.bss) }
- + .rel.plt : { *(.rel.plt) }
- + .rela.plt : { *(.rela.plt) }
- + .init : { KEEP (*(.init)) } =0
- + .plt : { *(.plt) }
- +
- +
- + /* Stabs debugging sections. */
- + .stab 0 : { *(.stab) }
- + .stabstr 0 : { *(.stabstr) }
- + .stab.excl 0 : { *(.stab.excl) }
- + .stab.exclstr 0 : { *(.stab.exclstr) }
- + .stab.index 0 : { *(.stab.index) }
- + .stab.indexstr 0 : { *(.stab.indexstr) }
- + .comment 0 : { *(.comment) }
- +
- + /* DWARF debug sections.
- + Symbols in the DWARF debugging sections are relative to the beginning
- + of the section so we begin them at 0. */
- +
- + /* DWARF 1 */
- + .debug 0 : { *(.debug) }
- + .line 0 : { *(.line) }
- +
- + /* GNU DWARF 1 extensions */
- + .debug_srcinfo 0 : { *(.debug_srcinfo) }
- + .debug_sfnames 0 : { *(.debug_sfnames) }
- +
- + /* DWARF 1.1 and DWARF 2 */
- + .debug_aranges 0 : { *(.debug_aranges) }
- + .debug_pubnames 0 : { *(.debug_pubnames) }
- +
- + /* DWARF 2 */
- + .debug_info 0 : { *(.debug_info) }
- + .debug_abbrev 0 : { *(.debug_abbrev) }
- + .debug_line 0 : { *(.debug_line) }
- + .debug_frame 0 : { *(.debug_frame) }
- + .debug_str 0 : { *(.debug_str) }
- + .debug_loc 0 : { *(.debug_loc) }
- + .debug_macinfo 0 : { *(.debug_macinfo) }
- +
- + /* SGI/MIPS DWARF 2 extensions */
- + .debug_weaknames 0 : { *(.debug_weaknames) }
- + .debug_funcnames 0 : { *(.debug_funcnames) }
- + .debug_typenames 0 : { *(.debug_typenames) }
- + .debug_varnames 0 : { *(.debug_varnames) }
- +
- + /* These must appear regardless of . */
- +}
- +EOF
- diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
- index 77beb4d..27bb95f 100644
- --- a/opcodes/Makefile.am
- +++ b/opcodes/Makefile.am
- @@ -85,6 +85,8 @@ CFILES = \
- tic80-opc.c \
- v850-dis.c \
- v850-opc.c \
- + c33-dis.c \
- + c33-opc.c \
- vax-dis.c \
- w65-dis.c \
- z8k-dis.c \
- @@ -145,6 +147,8 @@ ALL_MACHINES = \
- tic30-dis.lo \
- tic80-dis.lo \
- tic80-opc.lo \
- + c33-dis.lo \
- + c33-opc.lo \
- v850-dis.lo \
- v850-opc.lo \
- vax-dis.lo \
- @@ -370,6 +374,10 @@ v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
- $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
- v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
- opintl.h
- +c33-dis.lo: c33-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
- + $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
- +c33-opc.lo: c33-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
- + opintl.h
- vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
- $(BFD_H) $(INCDIR)/ansidecl.h
- w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
- diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
- index 0cf1c27..5f1fe32 100644
- --- a/opcodes/Makefile.in
- +++ b/opcodes/Makefile.in
- @@ -189,6 +189,8 @@ CFILES = \
- tic80-opc.c \
- v850-dis.c \
- v850-opc.c \
- + c33-dis.c \
- + c33-opc.c \
- vax-dis.c \
- w65-dis.c \
- z8k-dis.c \
- @@ -252,6 +254,8 @@ ALL_MACHINES = \
- tic80-opc.lo \
- v850-dis.lo \
- v850-opc.lo \
- + c33-dis.lo \
- + c33-opc.lo \
- vax-dis.lo \
- w65-dis.lo \
- z8k-dis.lo
- @@ -867,6 +871,10 @@ v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
- $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
- v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
- opintl.h
- +c33-dis.lo: c33-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
- + $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
- +c33-opc.lo: c33-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
- + opintl.h
- vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
- $(BFD_H) $(INCDIR)/ansidecl.h
- w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
- diff --git a/opcodes/c33-dis.c b/opcodes/c33-dis.c
- new file mode 100644
- index 0000000..699bc22
- --- /dev/null
- +++ b/opcodes/c33-dis.c
- @@ -0,0 +1,2824 @@
- +/* Disassemble V850 instructions.
- + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +
- +#include <stdio.h>
- +
- +#include "sysdep.h"
- +#include "opcode/c33.h"
- +#include "dis-asm.h"
- +#include "opintl.h"
- +
- +static const char *const c33_reg_names[] =
- +{ "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
- + "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
- +};
- +
- +static const char *const c33_sreg_names[] = /* add "idir,dbg__base" T.Tazaki 2003/11/18 */
- +{ "%psr","%sp", "%alr", "%ahr", "%lco", "%lsa", "%lea", "%sor", "%ttbr", "%dp","%idir","%dbbr","","%usp", "%ssp", "%pc" };
- +
- +/* add tazaki 2001.09.12 >>>>> */
- +
- +/******* type definiton ******/
- +typedef char INT8;
- +typedef short INT16;
- +typedef long INT32;
- +typedef unsigned char UINT8;
- +typedef unsigned short UINT16;
- +typedef unsigned long UINT32;
- +typedef unsigned long ADDR;
- +
- +#define NO_ERR 0
- +#define ERR 2
- +#define ERR2 3
- +#define QUIT 100 /* add D.Fujimoto 2007/10/17 */
- +
- +#define BIT0 0x01
- +#define BIT1 0x02
- +#define BIT2 0x04
- +#define BIT3 0x08
- +#define BIT4 0x10
- +#define BIT5 0x20
- +#define BIT6 0x40
- +#define BIT7 0x80
- +#define BIT8 0x100
- +#define BIT9 0x200
- +#define BIT10 0x400
- +#define BIT11 0x800
- +#define BIT12 0x1000
- +#define BIT13 0x2000
- +#define BIT14 0x4000
- +#define BIT15 0x8000
- +#define BIT16 0x10000
- +#define BIT17 0x20000
- +#define BIT18 0x40000
- +#define BIT19 0x80000
- +#define BIT20 0x100000
- +#define BIT21 0x200000
- +#define BIT22 0x400000
- +#define BIT23 0x800000
- +#define BIT24 0x1000000
- +#define BIT25 0x2000000
- +#define BIT26 0x4000000
- +#define BIT27 0x8000000
- +#define BIT28 0x10000000
- +#define BIT29 0x20000000
- +#define BIT30 0x40000000
- +#define BIT31 0x80000000
- +
- +#define YES 1
- +#define NO 0
- +
- +#define CLASS_MASK 0xE000
- +#define CLASS0 0x0000
- +#define CLASS1 0x2000
- +#define CLASS2 0x4000
- +#define CLASS3 0x6000
- +#define CLASS5 0xA000
- +#define CLASS6 0xC000
- +#define CLASS7 0xE000 /* add tazaki 2001.09.19 */
- +#define CLASS6_DATA 0x1fff
- +#define EXT1 1
- +#define EXT2 2
- +#define EXT3 3
- +#define CALC1 10
- +#define CALC2 20
- +#define CALC3_BYTE 31
- +#define CALC3_HALF 32
- +#define CALC3_WORD 33
- +#define CALC4 40
- +#define CALC5 50
- +
- +#define MASK1_0 0x3
- +#define MASK7_0 0xff
- +#define MASK9_4 0x3f0
- +#define MASK9_5 0x3e0
- +#define MASK9_6 0x3c0
- +#define MASK12_0 0x1fff
- +#define MASK12_3 0x1ff8
- +#define MASK31_6 0xffffffc0
- +#define MASK31_9 0xfffffe00
- +#define MASK31_19 0xfff80000
- +#define MASK31_22 0xffc00000
- +
- +/* #define DEBUG33 1 */
- +
- +/* >>>>> D.Fujimoto 2007/10/04 string buffer size for objdump output */
- +#define DUMP_OUTPUT_BUF_SIZE 512
- +#define SYMBOL_NAME_BUF_SIZE 256
- +/* <<<<< D.Fujimoto 2007/10/04 string buffer size for objdump output */
- +
- +/* >>>>> D.Fujimoto 2007/10/04 declare prototypes */
- +static UINT8
- +fnCrGetExtType(UINT32 ulCode,int *iExtType, int *iCalcType);
- +static UINT32
- +fnCrCalcImmVal(int nExtInst, int iCalcType, UINT32 ulExt1, UINT32 ulExt2, UINT32 ulCode);
- +static UINT8
- +fnCrGetXinst(UINT32 ulCode, UINT32 ulImmVal,int iExtType, ADDR tdAddr, INT8 *szXinst, int iArraySize, INT8 *szTmp, int iExtCnt, struct disassemble_info *info);
- +static void
- +vfnDisasm (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass0 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass1 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass2 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass3 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass4 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass5 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass6 (unsigned short uwCode, char *pszBuf);
- +static void
- +vfnDisasmClass7 (unsigned short uwCode, char *pszBuf);
- +/* <<<<< D.Fujimoto 2007/10/04 declare prototypes */
- +
- +static int g_iExtCnt = 0;
- +static int g_ExtImm[ 2 ];
- +
- +/* <<<<< add tazaki 2001.09.18 */
- +/* Advanced Macro Opecode name class0 - bit5,4 = 0,1 */
- +extern const char *c33_adv_opcodes[];
- +
- +/* Advanced Macro Opecode name class5 - bit12_8 = 111:11 */
- +extern const char *c33_adv_class5_opcodes[];
- +/* >>>>> add tazaki 2001.09.18 */
- +
- +/* <<<<< add tazaki 2002.02.29 */
- +
- +int g_iShiftFlag =0;
- +const char szOpShift[3][4] = { "sra","sla","sll" };
- +const char szCond[10][4] = { "gt","ge","lt","le","ugt","uge","ult","ule","eq","ne" };
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/03 for displaying symbol */
- +#include <stdarg.h>
- +static char dummy_buffer[4096], *dummy_p;
- +static int
- +dummy_sprintf (FILE *f, const char *format, ...)
- +{
- + char *buf;
- + va_list args;
- + size_t n;
- +
- + va_start (args, format);
- +
- + vasprintf (&buf, format, args);
- +
- + va_end (args);
- +
- + n = strlen (buf);
- + if (dummy_p + n + 1 < dummy_buffer + sizeof(dummy_buffer)) {
- + strcpy(dummy_p, buf);
- + dummy_p += n;
- + } else {
- + n = 0;
- + }
- +
- + free (buf);
- +
- + return n;
- +}
- +
- +static char *find_symbolname_for_address(bfd_vma vma, struct disassemble_info *info)
- +{
- + char *name;
- + fprintf_ftype saved_fprintf_func;
- +
- + if (!info->symbol_at_address_func(vma, info)) return NULL;
- +
- + dummy_p = dummy_buffer;
- +
- + saved_fprintf_func = info->fprintf_func;
- + info->fprintf_func = (fprintf_ftype)dummy_sprintf;
- +
- + info->print_address_func(vma, info);
- +
- + info->fprintf_func = saved_fprintf_func;
- +
- + name = strrchr(dummy_buffer, '>');
- + if (!name) return NULL;
- + *name = '\0';
- + name = strchr(dummy_buffer, '<');
- + if (!name) return NULL;
- + return name + 1;
- +}
- +/* <<<<< ADDED D.Fujimoto 2007/10/03 */
- +
- +static int
- +disassemble (memaddr, info, insn)
- + bfd_vma memaddr;
- + struct disassemble_info *info;
- + unsigned long insn;
- +{
- +/* struct c33_opcode * op = (struct c33_opcode *)c33_opcodes; */
- + struct c33_opcode * op = (struct c33_opcode *)c33_advance_opcodes; /* tazaki 2001.12.05 */
- +
- + const struct c33_operand * operand;
- + int match = 0;
- + int bytes_read;
- +
- +/* add tazaki 2001.07.31 >>>>> */
- + ADDR tdAddr; /* address of target instruction */
- + INT8 szExtString[DUMP_OUTPUT_BUF_SIZE]; /* extended instruntion string */ // MOD D.Fujimoto 2007/10/04 string buffer size
- + int nExtInst; /* number of ext-instrcution */
- + int iCalcType; /* immediate value calculation type */
- + int iExtType; /* extension type */
- + int i;
- + UINT32 ulImm; /* extended immediate value */
- + UINT32 ulImm1; /* immediate value of first ext_instruction */
- + UINT32 ulImm2; /* immediate value of second ext_instruction */
- + UINT32 ulCode; /* target instruction code */
- + INT8 szMessage[DUMP_OUTPUT_BUF_SIZE]; /* array of mnemonic or warning message */ // MOD D.Fujimoto 2007/10/04 string buffer size
- + INT8 szTmp[DUMP_OUTPUT_BUF_SIZE]; // MOD D.Fujimoto 2007/10/04 string buffer size
- + UINT8 ucErrFlag = NO_ERR;/* error flag */
- + INT8 szDisp[DUMP_OUTPUT_BUF_SIZE]; /* for Get string length compute */ // MOD D.Fujimoto 2007/10/04 string buffer size
- + INT8 szBuf[DUMP_OUTPUT_BUF_SIZE]; /* for Get string length compute work buffer */ // MOD D.Fujimoto 2007/10/04 string buffer size
- + INT8 szName[DUMP_OUTPUT_BUF_SIZE]; // MOD D.Fujimoto 2007/10/04 string buffer size
- + unsigned long insn_wk;
- +/* <<<<< add tazaki 2001.07.31 */
- +
- +
- + bytes_read = 2;
- + insn &= 0xffff;
- +
- + szDisp[0] = 0; /* add tazaki 2001.08.03 */
- +
- + g_iShiftFlag =0;
- +
- +
- + if ((insn & CLASS_MASK) == CLASS1) { /* class1 */
- +
- + g_iShiftFlag = 1;
- +
- + /* Convert Opecode */
- + insn_wk = insn & 0xff00;
- +
- + switch( insn_wk ){
- + case 0x2300: insn_wk = 0x8800; break; /* srl -->class 4 : srl */
- + case 0x2700: insn_wk = 0x8c00; break; /* sll -->class 4 : sll */
- + case 0x2b00: insn_wk = 0x9000; break; /* sra -->class 4 : sra */
- + case 0x2f00: insn_wk = 0x9400; break; /* sla -->class 4 : sla */
- + case 0x3300: insn_wk = 0x9800; break; /* rr -->class 4 : rr */
- + case 0x3700: insn_wk = 0x9c00; break; /* rl -->class 4 : rl */
- + default:
- + g_iShiftFlag = 0;
- + break;
- + }
- + insn = insn_wk | ( insn & 0x00ff );
- + }
- +
- + /* Find the opcode. */
- + while (op->name)
- + {
- +
- + if ((op->mask & insn) == op->opcode)
- + {
- + const unsigned char * opindex_ptr;
- + unsigned int opnum;
- + unsigned int memop;
- + unsigned short uwOp1;
- + unsigned short uwOp2;
- + int i;
- + int iLength;
- +
- +
- + strcpy( szName, op->name );
- +
- +
- + /* Advanced Macro bit5,4 = 0,1 ? add tazaki 2001.09.12 >>> */
- + /* ONLY class0 */
- + if ((insn & CLASS_MASK) == CLASS0) { /* class0 */
- + uwOp1 = insn & 0x1e00;
- + uwOp1 >>= 9;
- + if( uwOp1 < 4 ){
- + if( insn & 0x0010 ){ /* bit5,4 = 0,1 ? */
- + i = 0;
- + while( c33_adv_opcodes[ i ] != 0 ){
- + if( !strcmp( c33_adv_opcodes[ i ], szName ) ){
- + break;
- + }
- + ++i;
- + }
- + if( c33_adv_opcodes[ i ] == 0 ){ /* No found ? */
- + op++;
- + continue; /* skip --> next search */
- + }
- + }
- + }
- + }
- + /* <<< add tazaki 2001.09.12 */
- +
- + /* Advanced Macro bit12-8=111:11 add tazaki 2001.09.18 >>> */
- + /* ONLY class5 */
- + if ((insn & 0xff00) == 0xbf00) { /* class5 111:11 */
- + if( (insn & 0x00c0) == 0x0000 ){ /* do.c imm6 ? */
- + if( strcmp( c33_adv_class5_opcodes[ 0 ], szName )){
- + op++;
- + continue;
- + }
- + }
- + if( (insn & 0x00c0) == 0x0040 ){ /* psrset imm5 ? */
- + if( strcmp( c33_adv_class5_opcodes[ 1 ], szName )){
- + op++;
- + continue;
- + }
- + }
- + if( (insn & 0x00c0) == 0x0080 ){ /* psrclr imm5 ? */
- + if( strcmp( c33_adv_class5_opcodes[ 2 ], szName )){
- + op++;
- + continue;
- + }
- + }
- +
- + }
- + /* <<< add tazaki 2001.09.12 */
- +
- + /* add tazaki 2001.08.03 >>>>> TAB数の計算 */
- +
- + match = 1;
- +
- + (*info->fprintf_func) (info->stream, " %s", szName);
- + sprintf( szBuf," %s", szName );
- + strcat( szDisp,szBuf );
- +
- + iLength = 8 - strlen( szName );
- + for( i = 0; i < iLength; ++i ){
- + (*info->fprintf_func) (info->stream, " ");
- + strcat( szDisp," " );
- + }
- + /* <<<<< add tazaki 2001.08.03 */
- +
- +
- + memop = op->memop;
- + /* Now print the operands.
- +
- + MEMOP is the operand number at which a memory
- + address specification starts, or zero if this
- + instruction has no memory addresses.
- +
- + A memory address is always two arguments.
- +
- + This information allows us to determine when to
- + insert commas into the output stream as well as
- + when to insert disp[reg] expressions onto the
- + output stream. */
- +
- + for (opindex_ptr = op->operands, opnum = 1;
- + *opindex_ptr != 0;
- + opindex_ptr++, opnum++)
- + {
- + long value;
- + long value2;
- + long value3;
- + int flag;
- + int status;
- + bfd_byte buffer[ 4 ];
- + int i_op_match;
- +
- + operand = &c33_operands[*opindex_ptr];
- +
- + if (operand->extract)
- + value = (operand->extract) (insn, 0);
- + else
- + {
- + value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
- + }
- +
- + if (opnum > 1) {
- + info->fprintf_func (info->stream, ",");
- + sprintf( szBuf,"," ); /* add tazaki 2001.08.03 */
- + strcat( szDisp,szBuf ); /* add tazaki 2001.08.03 */
- + }
- + /* extract the flags, ignorng ones which do not effect disassembly output. */
- + flag = operand->flags;
- +
- + i_op_match = 0;
- + /* >>> add tazaki 2002.02.29 */
- +
- + if( !strcmp( szName,"ext" ) )
- + {
- + if ((insn & 0xff00) == 0x3b00) { /* class1 001:11011 */
- + if( (insn & 0x00f0) == 0x0000 ){
- + /* ext OP,imm2 */
- + value = insn & 0x000c;
- + value >>= 2;
- + value2 = insn & 0x0003;
- + if( value > 0 ){
- + info->fprintf_func (info->stream, "%s,0x%x", szOpShift[ value - 1],value2 );
- + sprintf( szBuf,"%s,0x%x", szOpShift[ value - 1],value2 );
- + strcat( szDisp,szBuf );
- + i_op_match = 1;
- + }
- + }
- + else
- + {
- + /* ext cond */
- + value = insn & 0x00f0;
- + value >>= 4;
- +/* >>>>> MODIFIED D.Fujimoto 2008/05/22 disassemble hangs when processing with -D */
- +// if( value >= 4 ){
- + if( value >= 4 && value - 4 < 10 ){ // depends on szCond index
- +/* <<<<< MODIFIED D.Fujimoto 2008/05/22 disassemble hangs when processing with -D */
- + info->fprintf_func (info->stream, "%s", szCond[ value - 4] );
- + sprintf( szBuf,"%s", szCond[ value - 4] );
- + strcat( szDisp,szBuf );
- + i_op_match = 1;
- + }
- + }
- +
- + }
- + if ((insn & 0xff00) == 0x3f00) { /* class1 001:11111 */
- + if( (insn & 0x000f) != 0x0000 ){
- + /* ext %rs,OP,imm2 */
- + value = insn & 0x00f0;
- + value >>= 4;
- + value2 = insn & 0x000c;
- + value2 >>= 2;
- + value3 = insn & 0x0003;
- + if( value2 >= 1 ){
- + info->fprintf_func (info->stream, "%s,%s,0x%x",
- + c33_reg_names[value],
- + szOpShift[ value2 - 1 ],
- + value3
- + );
- + sprintf( szBuf, "%s,%s,0x%x",
- + c33_reg_names[value],
- + szOpShift[ value2 - 1 ],
- + value3
- + );
- + strcat( szDisp,szBuf );
- + i_op_match = 1;
- + }
- + }
- + else
- + {
- + /* ext %rs */
- + value = insn & 0x00f0;
- + value >>= 4;
- + info->fprintf_func (info->stream, "%s", c33_reg_names[value] );
- + sprintf( szBuf,"%s", c33_reg_names[value] );
- + strcat( szDisp,szBuf );
- + i_op_match = 1;
- + }
- + }
- + }
- +
- + if( i_op_match == 0 )
- + {
- + if( flag == C33_OPERAND_LD_SREG ){
- + flag = C33_OPERAND_SREG;
- + }
- + if( flag == (C33_OPERAND_PUSHS_SREG | C33_OPERAND_01) ){
- + flag = C33_OPERAND_SREG;
- + }
- + if( flag == ( C33_OPERAND_DP | C33_OPERAND_01 ) ){
- + flag &= ( C33_OPERAND_01 ^ 0xffff );
- + }
- +
- + if( flag != C33_OPERAND_DPMEM && flag != C33_OPERAND_DP ) {
- + flag &= - flag;
- + }
- +
- + switch (flag)
- + {
- +
- + case C33_OPERAND_MEM :
- + info->fprintf_func (info->stream, "[0x%x]", value);
- + sprintf( szBuf,"[0x%x]", value );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_SPMEM :
- + info->fprintf_func (info->stream, "[%%sp+0x%x]", value); /* [%sp+imm6] */
- + sprintf( szBuf,"[%%sp+0x%x]", value );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_DPMEM :
- + info->fprintf_func (info->stream, "[%%dp+0x%x]", value); /* [%dp+imm6] */
- + sprintf( szBuf,"[%%dp+0x%x]", value );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_REG:
- + info->fprintf_func (info->stream, "%s", c33_reg_names[value]);
- + sprintf( szBuf,"%s", c33_reg_names[value] );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_SREG:
- + info->fprintf_func (info->stream, "%s", c33_sreg_names[value]);
- + sprintf( szBuf,"%s", c33_sreg_names[value] );
- + strcat( szDisp,szBuf );
- + break;
- +
- +
- + case C33_OPERAND_REGINC :
- + info->fprintf_func (info->stream, "[%s]+", c33_reg_names[value]);
- + sprintf( szBuf,"[%s]+", c33_reg_names[value] );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_RB :
- + info->fprintf_func (info->stream, "[%s]", c33_reg_names[value]);
- + sprintf( szBuf,"[%s]", c33_reg_names[value] );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_SP :
- + info->fprintf_func (info->stream, "%%sp");
- + sprintf( szBuf,"%%sp" );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_DP :
- + info->fprintf_func (info->stream, "%%dp");
- + sprintf( szBuf,"%%dp" );
- + strcat( szDisp,szBuf );
- + break;
- +
- + case C33_OPERAND_IMM :
- + if( g_iShiftFlag == 1 ){
- + value += 16; /* shift : imm + 16 */
- + }
- + case C33_OPERAND_SIGNED :
- + default:
- + info->fprintf_func (info->stream, "0x%x", value);
- + sprintf( szBuf,"0x%x", value );
- + strcat( szDisp,szBuf );
- + break;
- +
- + }
- + }
- + else
- + {
- + break; // exit operand loop
- + }
- + }
- +
- + /* All done. */
- + break; /* exit while loop */
- + }
- + op++;
- + }
- +
- + /* not found opcode ? */
- + if (!match)
- + {
- + info->fprintf_func (info->stream, " .short\t0x%04x", insn);
- + g_iExtCnt = 0;
- + return bytes_read;
- + }
- +
- +
- +/* add tazaki 2001.07.31 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
- +
- + /*==========================================*/
- + /* Extended Instruction Display */
- + /*==========================================*/
- + /* insn : 16 bit */
- +
- + if( ( insn & CLASS_MASK ) == CLASS6 ){ /* ext ? */
- + if( g_iExtCnt == 2 ){
- + g_ExtImm[ 1 ] = insn & CLASS6_DATA;
- + }else{
- + g_ExtImm[g_iExtCnt] = insn & CLASS6_DATA;
- + }
- + if( g_iExtCnt < 2 ){
- + ++g_iExtCnt; /* increment ext counter */
- + }
- + return bytes_read;
- + }
- +
- + ulCode = insn;
- + ulImm1 = ulImm2 = 0;
- + if( g_iExtCnt == 2 ){
- + ulImm1 = g_ExtImm[ 0 ];
- + ulImm2 = g_ExtImm[ 1 ];
- + }else if( g_iExtCnt == 1 ){
- + ulImm2 = g_ExtImm[ 0 ];
- + }
- +
- + nExtInst = g_iExtCnt;
- +
- + tdAddr = memaddr; /* offset address set */
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
- +// if( g_iExtCnt > 0 ){
- +/* <<<<< DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
- +
- + /* analize instruction code */ /* extention type and calculation type */
- + ucErrFlag = fnCrGetExtType(ulCode, &iExtType, &iCalcType);
- +
- + if (ucErrFlag == NO_ERR) { /* the target instruction is extendable */
- + /* calculate extended immediate value */
- + ulImm = fnCrCalcImmVal(nExtInst, iCalcType, ulImm1, ulImm2, ulCode);
- +
- + /* make extended instruction */
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/03 added info as param */
- +// ucErrFlag = fnCrGetXinst(ulCode, ulImm, iExtType, tdAddr, szMessage, 256, szTmp);
- + ucErrFlag = fnCrGetXinst(ulCode, ulImm, iExtType, tdAddr, szMessage, DUMP_OUTPUT_BUF_SIZE, szTmp, g_iExtCnt, info);
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/03 added info as param */
- +
- + if (ucErrFlag == NO_ERR) { /* not disassemble error */
- + if( strlen( szMessage ) > 0 ){
- + strcpy( (INT8 *)szExtString, szMessage );
- + szExtString[ strlen(szExtString)-1 ] = 0;
- +
- + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
- + info->fprintf_func (info->stream, " ");
- + }
- + info->fprintf_func (info->stream, "%s", szExtString);
- + }
- +/* >>>>> ADDED D.Fujimoto 2007/10/10 display plain mnemonic */
- + } else if (ucErrFlag == QUIT) {
- + /* get mnemonic code */
- + vfnDisasm ((unsigned short)ulCode, szTmp);
- + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
- + info->fprintf_func (info->stream, " ");
- + }
- + info->fprintf_func (info->stream, "%s", szTmp);
- +/* <<<<< ADDED D.Fujimoto 2007/10/10 display plain mnemonic */
- + }
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/04 display when ERR and ERR2 */
- +// }else if (ucErrFlag == ERR) {
- + } else {
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/04 display when ERR and ERR2 */
- + /* get mnemonic code */
- + vfnDisasm ((unsigned short)ulCode, szTmp);
- + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
- + info->fprintf_func (info->stream, " ");
- + }
- + info->fprintf_func (info->stream, "%s", szTmp);
- + }
- +
- +/* >>>>> DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
- +// }else{
- +// /* get mnemonic code */
- +// vfnDisasm ((unsigned short)ulCode, szTmp);
- +// for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
- +// info->fprintf_func (info->stream, " ");
- +// }
- +// info->fprintf_func (info->stream, "%s", szTmp);
- +//
- +// }
- +/* <<<<< DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
- +
- + g_iExtCnt = 0; /* clear ext inst counter */
- +
- + return bytes_read;
- +}
- +
- +static UINT8
- +fnCrGetExtType(ulCode,iExtType,iCalcType)
- +
- + /***************************************************************
- + *
- + * --- Get the extention type and
- + * the immediate calculation type ---
- + *
- + * Check the extention type (set to the parameter2) and
- + * immediate value calculation type (set to the parameter3).
- + *
- + * RETURN: NO_ERR: the target instruction is extendable
- + * ERR : the target instruction cannot be extended
- + *
- + ***************************************************************/
- +
- + UINT32 ulCode; /* target instruction */
- + int *iExtType; /* extention type, 1-3 */
- + int *iCalcType; /* immediate value calculation type, 1-5 */
- +
- +{
- + UINT32 ulOp1; /* op1 */
- + UINT32 ulOp2; /* op2 */
- + UINT8 ucErrFlag = ERR; /* error flag */
- +
- + /* get the extention type and the immediate calculation type, according to the class */
- + switch (ulCode & CLASS_MASK) { /* switch by class type */
- + case CLASS0:
- + if ((ulCode & 0xfff0 )== 0x0350) { /* add %rd,%dp ? */
- + ucErrFlag = ERR2; /* not show 3 operand. add tazaki 2001.12.21 */
- + }else{
- + ulOp1 = (ulCode >> 0x9) & 0xf; /* bit12:9 */
- + if ((ulOp1 & 0xc) != 0x0) { /* not OP1 = 00XX, illeagal */
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT1;
- + *iCalcType = CALC1;
- + }
- + }
- + break;
- +
- + case CLASS1:
- + if (((ulCode & BIT8) == 0x0) && ((ulCode & BIT9) == 0x0)) { /* load/store */
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT2;
- + *iCalcType = CALC2;
- + }
- + else{
- + if (((ulCode & BIT8) == 0x0) && ((ulCode & BIT9) != 0x0)) {/* numeric/logical/compare */
- + if ( ((ulCode & BIT10) != 0x0) && ((ulCode & BIT11) != 0x0) && ((ulCode & BIT12) != 0x0)) { /* not ? */
- + ulOp1 = (ulCode >> 0xa) & 0x7;
- + if ((ulOp1 != 0x3) && (ulOp1 != 0x7)) {
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT3;
- + *iCalcType = CALC2;
- + }
- + }else{
- + ucErrFlag = ERR2; /* not show 3 operand. add tazaki 2001.11.06 */
- + }
- + }
- + }
- + break;
- +
- + case CLASS2:
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT1;
- +
- + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
- + if (((ulOp1 & 0x6) == 0x0) || (ulOp1 == 0x5)) { /* byte type */
- + *iCalcType = CALC3_BYTE;
- + }
- + else if (((ulOp1 & 0x6) == 0x2) || (ulOp1 == 0x6)) { /* half word type */
- + *iCalcType = CALC3_HALF;
- + }
- + else { /* word type */
- + *iCalcType = CALC3_WORD;
- + }
- + break;
- +
- + case CLASS3:
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT1;
- +
- + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
- + if ((ulOp1 & 0x6) == 0x0) { /* OP1 = 00x, imm6 type */
- + *iCalcType = CALC4;
- + }
- + else { /* sign6 type */
- + *iCalcType = CALC5;
- + }
- + break;
- +
- + case CLASS5:
- + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
- + ulOp2 = (ulCode >> 0x8) & 0x3; /* bit9:8 */
- + if ((ulOp1 == 0x2) || (ulOp1 == 0x3) || (ulOp1 == 0x4) || (ulOp1 == 0x5)) {
- + if ((ulOp2 == 0x0) && ((ulCode & BIT3) == 0x0)) {
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT2;
- + *iCalcType = CALC2;
- + }
- + }
- + break;
- +
- + /* >>> add tazaki 2001.09.19 */
- +
- + case CLASS7:
- + ucErrFlag = NO_ERR;
- + *iExtType = EXT1;
- +
- + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
- + if (((ulOp1 & 0x6) == 0x0) || (ulOp1 == 0x5)) { /* byte type */
- + *iCalcType = CALC3_BYTE;
- + }
- + else if (((ulOp1 & 0x6) == 0x2) || (ulOp1 == 0x6)) { /* half word type */
- + *iCalcType = CALC3_HALF;
- + }
- + else { /* word type */
- + *iCalcType = CALC3_WORD;
- + }
- + break;
- +
- + /* >>> add tazaki 2001.09.19 */
- +
- + }
- +
- + return ucErrFlag;
- +}
- +
- +
- +
- +static UINT32
- +fnCrCalcImmVal(nExtInst,iCalcType,ulExt1,ulExt2,ulCode)
- +
- + /***************************************************************
- + *
- + * --- Calculate the extended immediate value ---
- + *
- + * Calculate the extended immediate value according to the
- + * extention type and the immediate value calculation type.
- + *
- + * RETURN: extended immediate value
- + *
- + ***************************************************************/
- +
- + int nExtInst; /* extention type, 1-3 */
- + int iCalcType; /* immediate value calculation type, 1-5 */
- + UINT32 ulExt1; /* immediate value of ext1 */
- + UINT32 ulExt2; /* immediate value of ext2 */
- + UINT32 ulCode; /* target instruction code */
- +
- +{
- + UINT32 ulImm32; /* extended immediate value */
- +
- + /* clear not ext-instruction code */
- + if (nExtInst == 0) {
- + ulExt1 = 0x0;
- + ulExt2 = 0x0;
- + }
- + else if (nExtInst == 1) {
- + ulExt1 = 0x0;
- + }
- +
- + /* calculate immediate value according to iCalcType */
- + switch (iCalcType) {
- + case CALC1: /* ext1[bit12:3] + ext2[bit12:0] + IR[bit7:0]"0" */
- + ulImm32 = ((ulExt1 & MASK12_3) << 19)
- + + ((ulExt2 & MASK12_0) << 9) + ((ulCode & MASK7_0) << 1);
- +
- + /* sign extention */
- + if (nExtInst == 0) {
- + if ((ulCode & BIT7) != 0x0) {
- + ulImm32 |= MASK31_9;
- + }
- + }
- + else if (nExtInst == 1) {
- + if ((ulExt2 & BIT12) != 0x0) {
- + ulImm32 |= MASK31_22;
- + }
- + }
- + break;
- +
- + case CALC2: /* ext1[bit12:0] + ext2[bit12:0] */
- + ulImm32 = ((ulExt1 & MASK12_0) << 13) + (ulExt2 & MASK12_0);
- + break;
- +
- + case CALC3_BYTE:
- + case CALC4: /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:4] */
- + ulImm32 = ((ulExt1 & MASK12_0) << 19)
- + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_4) >> 4);
- + break;
- +
- + case CALC3_HALF:
- + if (nExtInst == 0) { /* IR[bit9:4]"0" */
- + ulImm32 = (ulCode & MASK9_4) >> 3;
- + ulImm32 &= ~BIT0;
- + }
- + else { /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:5]"0" */
- + ulImm32 =((ulExt1 & MASK12_0) << 19)
- + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_5) >> 4);
- + ulImm32 &= ~BIT0;
- + }
- + break;
- +
- + case CALC3_WORD:
- + if (nExtInst == 0) { /* IR[bit9:4]"00" */
- + ulImm32 = (ulCode & MASK9_4) >> 2;
- + ulImm32 &= ~MASK1_0;
- + }
- + else { /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:6]"00" */
- + ulImm32 =((ulExt1 & MASK12_0) << 19)
- + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_6) >> 4);
- + ulImm32 &= ~MASK1_0;
- + }
- + break;
- +
- + case CALC5: /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:4] */
- + ulImm32 = ((ulExt1 & MASK12_0) << 19)
- + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_4) >> 4);
- +
- + /* sign extention */
- + if (nExtInst == 0) {
- + if ((ulCode & BIT9) != 0x0) {
- + ulImm32 |= MASK31_6;
- + }
- + }
- + else if (nExtInst == 1) {
- + if ((ulExt2 & BIT12) != 0x0) {
- + ulImm32 |= MASK31_19;
- + }
- + }
- +
- + break;
- +
- + default: /* this may not be occured */
- + ulImm32 = 0;
- + break;
- + } /* end of switch */
- +
- + return ulImm32;
- +}
- +
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/03 added params for displaying symbols */
- +//static UINT8
- +//fnCrGetXinst(ulCode,ulImmVal,iExtType,tdAddr,szXinst,iArraySize,szTmp)
- +static UINT8
- +fnCrGetXinst(ulCode,ulImmVal,iExtType,tdAddr,szXinst,iArraySize,szTmp, iExtCnt, info)
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/03 added params for displaying symbols */
- +
- + /***************************************************************
- + *
- + * --- Make output string ---
- + *
- + * Get extended mnemonic code from instruction code.
- + * Replace extended immediate value with original immediate
- + * value or add extended immediate value according to the
- + * extention type.
- + * If instruction is one of branch instruction, destination
- + * address is added to the extended mnemonic code.
- + *
- + * RETURN: NO_ERR success
- + * ERR cannot get correct mnemonic
- + *
- + ***************************************************************/
- +
- + UINT32 ulCode; /* target instruction code */
- + UINT32 ulImmVal; /* extended immediate value */
- + int iExtType; /* extention type, 1-3 */
- + ADDR tdAddr; /* address of target instruction */
- + INT8 *szXinst; /* extended mnemonic code */
- + int iArraySize; /* size of szXinst */
- + INT8 *szTmp; /* extended mnemonic code */
- +/* >>>>> ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
- + int iExtCnt; /* size of szXinst */
- + struct disassemble_info *info;
- +/* <<<<< ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
- +{
- +/* INT8 szTmp[256]; */ /* temporal array */
- +/* >>>>> MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
- +// INT8 szImm32[32]; /* immediate value */
- + INT8 szImm32[DUMP_OUTPUT_BUF_SIZE]; /* immediate value */
- +/* <<<<< MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
- + INT8 *pchCutText; /* pointer to the character to be replaced */
- + INT8 *pchNextToCutText; /* pointer next to the character to be replaced */
- + INT8 *pchMnemonic; /* pointer to the extended mnemonic code */
- + INT8 *pchCopyChar; /* pointer to the original memonic code */
- + UINT32 ulOp1; /* OP code to check if branch instruction or not */
- + UINT8 ucErrFlag = ERR; /* error flag */
- + int iIsBranch = NO; /* branch instruction check flag */
- +/* >>>>> ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
- + char *name; /* symbol name for display */
- + char nameBuf[SYMBOL_NAME_BUF_SIZE]; // length should be under szImm32
- + int iAbbrevStrLength;
- + UINT32 sign8Val = 0;
- + enum eOpcode {add, sub, cmp, ld, and, or, xor, not};
- + enum eOpcode opc3 = ld; // class3 opecode
- +/* <<<<< ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
- +
- +/* >>>>> MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
- +// if( iArraySize > 256){
- + if( iArraySize > DUMP_OUTPUT_BUF_SIZE){
- + return ucErrFlag;
- + }
- +/* <<<<< MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
- +
- + /* get mnemonic code */
- + vfnDisasm ((unsigned short)ulCode, szTmp);
- +
- + /* set the pointer, according to the extention type */
- + switch(iExtType) {
- + case EXT1: /* immediate value ---> extended immediate value */
- + pchCutText = szTmp;
- +
- + /* search immediate value */
- + while((pchCutText = strchr(pchCutText, '0')) != NULL) {
- + if (strncmp(pchCutText, "0x", 2) == 0) { /* immediate value starts with "0x" */
- + pchNextToCutText = pchCutText + 2;
- + while (isxdigit(*pchNextToCutText) != 0) { /* search the end of immediate value */
- + ++pchNextToCutText;
- + }
- +
- + ucErrFlag = NO_ERR;
- + break;
- + }
- + else {
- + ++pchCutText; /* feed for next search */
- + }
- + }
- + break;
- +
- + case EXT2: /* add displace ment */
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/10 display plain mnemonic */
- +// pchNextToCutText = strchr(szTmp, ']');
- +// if (pchNextToCutText != NULL) {
- +// pchCutText = pchNextToCutText;
- +// ucErrFlag = NO_ERR;
- +// }
- +
- + if (iExtCnt != 0) {
- + pchNextToCutText = strchr(szTmp, ']');
- + if (pchNextToCutText != NULL) {
- + pchCutText = pchNextToCutText;
- + ucErrFlag = NO_ERR;
- + }
- + } else {
- + // do not add displacement, disasm shown in disassemble()
- + ucErrFlag = QUIT;
- + }
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/10 display plain mnemonic */
- +
- + break;
- +
- + case EXT3: /* three opeland */
- + pchNextToCutText = strchr(szTmp, '\0');
- + if (pchNextToCutText != NULL) {
- + pchCutText = pchNextToCutText;
- + ucErrFlag = NO_ERR;
- + }
- + break;
- +
- + default:
- + break;
- + }
- +
- + /* get extended mnemonic code */
- + if (ucErrFlag == NO_ERR) {
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/10 do not add 'x' when iExtCnt is 0 */
- +// pchMnemonic = szXinst;
- +// *pchMnemonic = 'x';
- +// ++pchMnemonic;
- +
- + pchMnemonic = szXinst;
- + if (iExtCnt != 0) {
- + *pchMnemonic = 'x';
- + ++pchMnemonic;
- +
- +
- + /* special case */
- + if (strncmp(szTmp, "or", 2) == 0) { /* or ---> xoor */
- + *pchMnemonic = 'o';
- + ++pchMnemonic;
- + }
- + }
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/10 do not add 'x' when iExtCnt is 0 */
- +
- + for (pchCopyChar = szTmp; pchCopyChar < pchCutText;) {
- + *pchMnemonic = *pchCopyChar;
- + ++pchMnemonic;
- + ++pchCopyChar;
- + }
- +
- + switch (iExtType) {
- + case EXT1: /* immediate value ---> extended immediate value */
- + ; /* null */
- + break;
- +
- + case EXT2: /* add displace ment */
- + *pchMnemonic = '+';
- + ++pchMnemonic;
- + break;
- +
- + case EXT3: /* three opeland */
- + *pchMnemonic = ',';
- + ++pchMnemonic;
- + break;
- +
- + }
- +
- + /* change immediate value */
- + /* set branch instruction flag, in case of branch instruction */
- + if ((ulCode & CLASS_MASK) == CLASS0) { /* class0 */
- + ulOp1 = (ulCode >> 0x9) & 0xf; /* bit12:9 */
- + if ((ulOp1 & 0xc) != 0x0) { /* branch inst is not OP1 = 00XX, illeagal */
- + iIsBranch = YES;
- +/* >>>>> ADDED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
- + sign8Val = ulCode & 0xff;
- +/* <<<<< ADDED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
- + }
- + }
- +
- + if (iIsBranch == YES) {
- + tdAddr += ulImmVal; /* destination address */
- +/* >>>>> MODIFIED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
- +// sprintf(szImm32, "0x%-8lx (0x%08lX)", ulImmVal, tdAddr);
- + if (iExtCnt == 0) {
- + // sign8
- + sprintf(szImm32, "0x%-8lx (0x%08lX)", sign8Val, tdAddr);
- + } else {
- + sprintf(szImm32, "0x%-8lx (0x%08lX)", ulImmVal, tdAddr);
- + }
- +/* <<<<< MODIFIED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
- + strcpy(pchMnemonic, szImm32);
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/03 */
- + // show symbol for branch
- + name = find_symbolname_for_address((bfd_vma) tdAddr, info);
- + if (name) {
- + // avoid buffer overflow for szImm32
- + iAbbrevStrLength = strlen("...");
- + if (strlen(name) > SYMBOL_NAME_BUF_SIZE ) { // length of " <>", "..." and '\0'
- + strncpy(nameBuf, name, SYMBOL_NAME_BUF_SIZE); // copy string
- + strncpy(nameBuf + (SYMBOL_NAME_BUF_SIZE - iAbbrevStrLength - 1), "...", iAbbrevStrLength); // replace
- + nameBuf[SYMBOL_NAME_BUF_SIZE - 1] = '\0';
- + } else {
- + strcpy(nameBuf, name);
- + }
- + sprintf(szImm32, " <%s>", nameBuf);
- + strcat(pchMnemonic, szImm32);
- + }
- +
- + strcat(pchMnemonic, pchNextToCutText); /* maybe none */
- +
- +/* <<<<< ADDED D.Fujimoto 2007/10/03 */
- +
- + } else { // not branch
- +/* >>>>> ADDED D.Fujimoto 2007/10/09 */
- + // determine class3 opecode
- + if ((ulCode & CLASS_MASK) == CLASS3) {
- + switch ((ulCode & 0xfc00)) {
- + case 0x6000:
- + opc3 = add;
- + break;
- + case 0x6400:
- + opc3 = sub;
- + break;
- + case 0x6800:
- + opc3 = cmp;
- + break;
- + case 0x6c00:
- + opc3 = ld;
- + break;
- + case 0x7000:
- + opc3 = and;
- + break;
- + case 0x7400:
- + opc3 = or;
- + break;
- + case 0x7800:
- + opc3 = xor;
- + break;
- + case 0x7c00:
- + opc3 = not;
- + break;
- + }
- + } else if (iExtCnt == 0) {
- + // recalculate imm6 value
- + if ((ulCode & CLASS_MASK) == CLASS2) {
- + // ld.* %rd, [%sp+imm6]
- + // ld.* [%sp+imm6], %rs
- + ulImmVal = (ulCode & MASK9_4) >> 4;
- + } else if ((ulCode & CLASS_MASK) == CLASS7) {
- + // ld.* %rd, [%dp+imm6]
- + // ld.* [%dp+imm6], %rs
- + ulImmVal = (ulCode & MASK9_4) >> 4;
- + }
- + }
- +
- +/* <<<<< ADDED D.Fujimoto 2007/10/09 */
- +
- + sprintf(szImm32, "0x%lx", ulImmVal);
- + strcpy(pchMnemonic, szImm32); /* change immediate value */
- + strcat(pchMnemonic, pchNextToCutText);
- +
- +/* >>>>> ADDED D.Fujimoto 2007/10/09 */
- + // skip insns that do not take label operands
- + if ((ulCode & CLASS_MASK) == CLASS3 && opc3 == ld) {
- + // show symbol for normal insn
- + name = find_symbolname_for_address((bfd_vma) ulImmVal, info);
- + if (name) {
- + // avoid buffer overflow for szImm32
- + iAbbrevStrLength = strlen("...");
- + if (strlen(name) > SYMBOL_NAME_BUF_SIZE ) { // length of " <>", "..." and '\0'
- + strncpy(nameBuf, name, SYMBOL_NAME_BUF_SIZE); // copy string
- + strncpy(nameBuf + (SYMBOL_NAME_BUF_SIZE - iAbbrevStrLength - 1), "...", iAbbrevStrLength); // replace
- + nameBuf[SYMBOL_NAME_BUF_SIZE - 1] = '\0';
- + } else {
- + strcpy(nameBuf, name);
- + }
- + sprintf(szImm32, " <%s>", nameBuf);
- + strcat(pchMnemonic, szImm32);
- + }
- + }
- +/* <<<<< ADDED D.Fujimoto 2007/10/09 */
- +
- + }
- + strcat(pchMnemonic, "\n");
- + }
- +
- + return ucErrFlag;
- +}
- +
- +/************************************************
- + * vfnDisasm : execute dis-assemble *
- + ************************************************/
- +
- +static void
- +vfnDisasm (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +{
- + unsigned short uwClass;
- +
- + /*@ extract class */
- + uwClass = uwCode & 0xe000;
- + uwClass >>= 13;
- +
- + switch (uwClass) { /* class */
- +
- + case 0: /* class 0 */
- + vfnDisasmClass0 (uwCode, pszBuf);
- + break;
- +
- + case 1: /* class 1 */
- + vfnDisasmClass1 (uwCode, pszBuf);
- + break;
- +
- + case 2: /* class 2 */
- + vfnDisasmClass2 (uwCode, pszBuf);
- + break;
- +
- + case 3: /* class 3 */
- + vfnDisasmClass3 (uwCode, pszBuf);
- + break;
- +
- + case 4: /* class 4 */
- + vfnDisasmClass4 (uwCode, pszBuf);
- + break;
- +
- + case 5: /* class 5 */
- + vfnDisasmClass5 (uwCode, pszBuf);
- + break;
- +
- + case 6: /* class 6 */
- + vfnDisasmClass6 (uwCode, pszBuf);
- + break;
- +
- + case 7: /* class 7 */
- + vfnDisasmClass7 (uwCode, pszBuf);
- + break;
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass0 : execute dis-assemble class0 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass0 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +{
- + unsigned short uwOp1, uwDelay, uwOp2;
- + unsigned short uwBit0_3, uwBit4_5, uwBit0_7;
- + char szTmpBuf[10];
- + char *spSpecialReg[16];
- + int i;
- + int iLoop;
- +
- + /*@ initialize */
- + spSpecialReg[0] = "%psr";
- + spSpecialReg[1] = "%sp";
- + spSpecialReg[2] = "%alr";
- + spSpecialReg[3] = "%ahr";
- + spSpecialReg[4] = "%lco";
- + spSpecialReg[5] = "%lsa";
- + spSpecialReg[6] = "%lea";
- + spSpecialReg[7] = "%sor";
- + spSpecialReg[8] = "%ttbr";
- + spSpecialReg[9] = "%dp";
- + spSpecialReg[10] = "%idir"; /* "" -->"%idir" T.Tazaki 20003/11/18 */
- + spSpecialReg[11] = "%dbbr"; /* "" -->"%dbbr" T.Tazaki 20003/11/18 */
- + spSpecialReg[12] = "";
- + spSpecialReg[13] = "%usp";
- + spSpecialReg[14] = "%ssp";
- + spSpecialReg[15] = "%pc";
- +
- + /*@ extract op1 */
- + uwOp1 = uwCode & 0x1e00;
- + uwOp1 >>= 9;
- +
- + /*@ extract "d" */
- + uwDelay = uwCode & 0x0100;
- + uwDelay >>= 8;
- +
- + if (uwOp1 < 4) {
- + /*@ Yes op1 : 0000 - 0011 */
- +
- + /*@ extract op2 from code */
- + uwOp2 = uwCode & 0x00c0;
- + uwOp2 >>= 6;
- + /*@ extract bit4_5 from code */
- + uwBit4_5 = uwCode & 0x0030;
- + uwBit4_5 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + /*@ check if code is OK */
- + if (uwBit4_5 == 0) {
- + switch (uwOp1 << 2 | uwOp2) { /* instruction */
- +
- + case 0: /* 0000:00 nop */
- +
- + /*@ check if code is OK */
- + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "nop");
- + }
- + break;
- +
- + case 1: /* 0000:01 slp */
- +
- + /*@ check if code is OK */
- + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "slp");
- + }
- + break;
- +
- + case 2: /* 0000:10 halt */
- +
- + /*@ check if code is OK */
- + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "halt");
- + }
- + break;
- +
- + case 3: /* 0000:11 reserved */
- +
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- +
- + case 4: /* 0001:00 pushn rs */
- +
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "pushn %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 5: /* 0001:01 popn %rd */
- +
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "popn %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 6: /* 0001:10 reserved */
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- +
- + case 7: /* 0001:11 jpr %rb */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "jpr.d %%r%d", uwBit0_3);
- + }
- + else {
- + (void) sprintf (pszBuf, "jpr %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 8: /* 0010:00 brk */
- +
- + /*@ check if code is OK */
- + if (uwBit0_3 == 0) {
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "brk");
- + }
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 9: /* 0010:01 retd */
- +
- + /*@ check if code is OK */
- + if (uwBit0_3 == 0) {
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "retd");
- + }
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 10: /* 0010:10 int imm2 */
- +
- + /*@ check if code is OK */
- + if ((uwBit0_3 & 0xc) == 0) {
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "int 0x%x", uwBit0_3);
- + }
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 11: /* 0010:11 reti */
- +
- + /*@ check if code is OK */
- + if (uwBit0_3 == 0) {
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "reti");
- + }
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 12: /* 0011:00 call rb */
- +
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "call.d %%r%d", uwBit0_3);
- + }
- + else {
- + (void) sprintf (pszBuf, "call %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 13: /* 0011:01 ret */
- +
- + /*@ check if code is OK */
- + if (uwBit0_3 == 0) {
- + /*@ check if code is OK */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "ret.d");
- + }
- + else {
- + (void) sprintf (pszBuf, "ret");
- + }
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 14: /* 0011:10 jp rb */
- +
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "jp.d %%r%d", uwBit0_3);
- + }
- + else {
- + (void) sprintf (pszBuf, "jp %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 15: /* 0011:11 reserved */
- +
- + if (uwDelay == 0) {
- + (void) sprintf (pszBuf, "retm"); /* 2002/10/01 */
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- + }
- + }
- + else if (uwBit4_5 == 1)
- + {
- + switch (uwOp1 << 2 | uwOp2) { /* instruction */
- +
- + case 0: /* 0000:00 push %rs , d=1 mac.w %rs*/
- +
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "mac.w %%r%d", uwBit0_3);
- + }
- + else {
- + (void) sprintf (pszBuf, "push %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 1: /* 0000:01 pop %rd , d=1 mac.hw %rs*/
- +
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "mac.hw %%r%d", uwBit0_3);
- + }
- + else {
- + (void) sprintf (pszBuf, "pop %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 2: /* 0000:10 pushs %ss , d=1 macclr */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "macclr");
- + }else{
- +// if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){ /* change T.Tazaki 2003/11/18 */
- + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 11)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
- + (void) sprintf (pszBuf, "pushs %s", spSpecialReg[uwBit0_3]);
- + }
- + else {
- + (void) sprintf (pszBuf, "***");
- + }
- + }
- + break;
- +
- + case 3: /* 0000:11 pops %sd , d=1 ld.cf */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "ld.cf");
- + }else{
- +// if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){ /* change T.Tazaki 2003/11/18 */
- + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 11)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
- + (void) sprintf (pszBuf, "pops %s", spSpecialReg[uwBit0_3]);
- + }
- + else {
- + (void) sprintf (pszBuf, "***");
- + }
- + }
- + break;
- +
- + case 4: /* 0001:00 divu.w %rb */
- + (void) sprintf (pszBuf, "divu.w %%r%d", uwBit0_3);
- + break;
- +
- + case 5: /* 0001:01 div.w %rb , d=1 add &rd,%dp */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "add %%r%d,%%dp", uwBit0_3);
- + }else {
- + (void) sprintf (pszBuf, "div.w %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 6: /* 0001:10 repeat %rb */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "***");
- + }else {
- + (void) sprintf (pszBuf, "repeat %%r%d", uwBit0_3);
- + }
- + break;
- +
- + case 7: /* 0001:11 repeat imm4 */
- + if (uwDelay != 0) {
- + (void) sprintf (pszBuf, "***");
- + }else {
- + (void) sprintf (pszBuf, "repeat 0x%x", uwBit0_3);
- + }
- + break;
- +
- + default:
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- + }else{
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + }
- + else {
- + /*@ No op1 : 0100 - 1111 */
- +
- + /*@ extract bit0_7 from code */
- + uwBit0_7 = uwCode & 0x00ff;
- +
- + switch (uwOp1) { /* instruction */
- +
- + case 4: /* 0100 jrgt sign9 */
- + (void) sprintf (pszBuf, "jrgt");
- + break;
- +
- + case 5: /* 0101 jrge sign9 */
- +
- + (void) sprintf (pszBuf, "jrge");
- + break;
- +
- + case 6: /* 0110 jrlt sign9 */
- +
- + (void) sprintf (pszBuf, "jrlt");
- + break;
- +
- + case 7: /* 0111 jrle sign9 */
- +
- + (void) sprintf (pszBuf, "jrle");
- + break;
- +
- + case 8: /* 1000 jrugt sign9 */
- +
- + (void) sprintf (pszBuf, "jrugt");
- + break;
- +
- + case 9: /* 1001 jruge sign9 */
- +
- + (void) sprintf (pszBuf, "jruge");
- + break;
- +
- + case 10: /* 1010 jrult sign9 */
- +
- + (void) sprintf (pszBuf, "jrult");
- + break;
- +
- + case 11: /* 1011 jrule sign9 */
- +
- + (void) sprintf (pszBuf, "jrule");
- + break;
- +
- + case 12: /* 1100 jreq sign9 */
- +
- + (void) sprintf (pszBuf, "jreq");
- + break;
- +
- + case 13: /* 1101 jrne sign9 */
- +
- + (void) sprintf (pszBuf, "jrne");
- + break;
- +
- + case 14: /* 1110 call sign9 */
- +
- + (void) sprintf (pszBuf, "call");
- + break;
- +
- + case 15: /* 1111 jp sign9 */
- +
- + (void) sprintf (pszBuf, "jp");
- + break;
- + }
- + /*@ check if "d" bit exist */
- + if (uwDelay != 0) {
- + /*@ add ".d" to mnemonic */
- + (void) strcat (pszBuf, ".d");
- + }
- + iLoop = 9 - strlen( pszBuf );
- + for( i = 0; i < iLoop; ++i ){
- + (void) strcat (pszBuf, " ");
- + }
- +
- + /*@ format mnemonic */
- + /* pszBuf[8] = 0; */
- +
- + /*@ convert immediate value to string */
- + (void) sprintf (&szTmpBuf[0], "0x%x", uwBit0_7);
- +
- + /*@ concatenate mnemonic and string */
- + (void) strcat (pszBuf, &szTmpBuf[0]);
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass1 : execute dis-assemble class1 *
- + ****************************************************************/
- +
- +
- +static void
- +vfnDisasmClass1 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1, uwOp2;
- + unsigned short uwBit0_3, uwBit4_7, uwBit0_1, uwBit2_3;
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract op2 from code */
- + uwOp2 = uwCode & 0x0300; /* uwCode[9:8] */
- + uwOp2 >>= 8;
- + /*@ extract bit4_7 from code */
- + uwBit4_7 = uwCode & 0x00f0;
- + uwBit4_7 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + uwBit2_3 = uwBit0_3 & 0x000c;
- + uwBit2_3 >>= 2;
- + uwBit0_1 = uwBit0_3 & 0x0003;
- +
- + switch (uwOp2) { /* op2 */
- +
- + case 0: /* 00 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:00 ld.b rd,[rb] */
- +
- + (void) sprintf (pszBuf, "ld.b %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:00 ld.ub rd,[rb] */
- +
- + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:00 ld.h rd,[rb] */
- +
- + (void) sprintf (pszBuf, "ld.h %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:00 ld.uh rd,[rb] */
- +
- + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:00 ld.w rd,[rb] */
- +
- + (void) sprintf (pszBuf, "ld.w %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:00 ld.b [rb],rs */
- +
- + (void) sprintf (pszBuf, "ld.b [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
- + break;
- +
- + case 6: /* 110:00 ld.h [rb],rs */
- +
- + (void) sprintf (pszBuf, "ld.h [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
- + break;
- +
- + case 7: /* 111:00 ld.w [rb],rs */
- +
- + (void) sprintf (pszBuf, "ld.w [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
- + break;
- + }
- +
- + break;
- +
- + case 1: /* 01 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:01 ld.b rd,[rb]+ */
- +
- + (void) sprintf (pszBuf, "ld.b %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:01 ld.ub rd,[rb]+ */
- +
- + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:01 ld.h rd,[rb]+ */
- +
- + (void) sprintf (pszBuf, "ld.h %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:01 ld.uh rd,[rb]+ */
- +
- + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:01 ld.w rd,[rb]+ */
- +
- + (void) sprintf (pszBuf, "ld.w %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:01 ld.b [rb]+,rs */
- +
- + (void) sprintf (pszBuf, "ld.b [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
- + break;
- +
- + case 6: /* 110:01 ld.h [rb]+,rs */
- +
- + (void) sprintf (pszBuf, "ld.h [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
- + break;
- +
- + case 7: /* 111:01 ld.w [rb]+,rs */
- +
- + (void) sprintf (pszBuf, "ld.w [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
- + break;
- + }
- +
- + break;
- +
- + case 2: /* 10 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:10 add rd,rs */
- +
- + (void) sprintf (pszBuf, "add %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:10 sub rd,rs */
- +
- + (void) sprintf (pszBuf, "sub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:10 cmp rd,rs */
- +
- + (void) sprintf (pszBuf, "cmp %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:10 ld.w rd,rs */
- +
- + (void) sprintf (pszBuf, "ld.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:10 and rd,rs */
- +
- + (void) sprintf (pszBuf, "and %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:10 or rd,rs */
- +
- + (void) sprintf (pszBuf, "or %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* 110:10 xor rd,rs */
- +
- + (void) sprintf (pszBuf, "xor %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111:10 not rd,rs */
- +
- + (void) sprintf (pszBuf, "not %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- + }
- +
- + break;
- +
- + case 3: /* 11 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:11 srl rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "srl %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:11 sll rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "sll %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:11 sra rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "sra %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:11 sla rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "sla %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:11 rr rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "rr %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:11 rl rd,imm4 */
- +
- + /* class4-->class1 convert,add 16 */
- + uwBit4_7 += 16;
- +
- + (void) sprintf (pszBuf, "rl %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6:
- +
- + if( uwBit4_7 == 0 ) {
- +
- + /* ext OP,imm2 */
- + if( uwBit2_3 > 0 ) {
- + (void) sprintf (pszBuf, "ext %s,0x%x", szOpShift[ uwBit2_3 - 1 ], uwBit0_1);
- + }
- + }else{
- + /* ext Cond */
- + if( uwBit4_7 >= 4 && uwBit4_7 <= 0x0d ) {
- + (void) sprintf (pszBuf, "ext %s",szCond[ uwBit4_7 - 4 ] );
- + }
- + }
- + break;
- +
- + case 7:
- +
- + if( uwBit0_3 == 0 ) {
- +
- + /* ext %rs */
- + (void) sprintf (pszBuf, "ext %%r%d", uwBit4_7);
- + }else{
- + /* ext %rs,OP,imm2 */
- + if( uwBit2_3 > 0 ) {
- + (void) sprintf (pszBuf, "ext %%r%d,%s,0x%x",
- + uwBit4_7,szOpShift[ uwBit2_3 - 1 ], uwBit0_1);
- + }
- + }
- +
- + break;
- + }
- +
- + break;
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass2 : execute dis-assemble class2 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass2 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1;
- + unsigned short uwBit0_3, uwBit4_9;
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract bit4_9 from code */
- + uwBit4_9 = uwCode & 0x03f0;
- + uwBit4_9 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000 ld.b rd,[sp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.b %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 1: /* 001 ld.ub rd,[sp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 2: /* 010 ld.h rd,[sp+imm7] */
- +
- + (void) sprintf (pszBuf, "ld.h %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 3: /* 011 ld.uh rd,[sp+imm7] */
- +
- + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 4: /* 100 ld.w rd,[sp+imm8] */
- +
- + (void) sprintf (pszBuf, "ld.w %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 5: /* 101 ld.b [sp+imm6],rs */
- +
- + (void) sprintf (pszBuf, "ld.b [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- +
- + case 6: /* 110 ld.h [sp+imm7],rs */
- +
- + (void) sprintf (pszBuf, "ld.h [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- +
- + case 7: /* 111 ld.w [sp+imm8],rs */
- +
- + (void) sprintf (pszBuf, "ld.w [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass3 : execute dis-assemble class3 *
- + ****************************************************************/
- +
- +
- +static void
- +vfnDisasmClass3 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1;
- + unsigned short uwBit0_3, uwBit4_9;
- + unsigned long ulSign32;
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract bit4_9 from code */
- + uwBit4_9 = uwCode & 0x03f0;
- + uwBit4_9 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000 add rd,imm6 */
- +
- + (void) sprintf (pszBuf, "add %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 1: /* 001 sub rd,imm6 */
- +
- + (void) sprintf (pszBuf, "sub %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 2: /* 010 cmp rd,sign6 */
- +
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "cmp %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xcmp %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "cmp %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +/* (void) sprintf (pszBuf, "cmp\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- +
- + case 3: /* 011 ld.w rd,sign6 */
- +
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "ld.w %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xld.w %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "ld.w %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +/* (void) sprintf (pszBuf, "ld.w\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- +
- + case 4: /* 100 and rd,sign6 */
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "and %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xand %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "and %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +
- +/* (void) sprintf (pszBuf, "and\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- +
- + case 5: /* 101 or rd,sign6 */
- +
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "or %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xoor %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "or %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +/* (void) sprintf (pszBuf, "or\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- +
- + case 6: /* 110 xor rd,sign6 */
- +
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "xor %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xxor %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "xor %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +/* (void) sprintf (pszBuf, "xor\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- +
- + case 7: /* 111 not rd,sign6 */
- +
- +/* >>>>> add tazaki 2001.10.10 */
- + if( uwBit4_9 & 0x20 ){
- + if( g_iExtCnt > 0 ){
- + (void) sprintf (pszBuf, "not %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }else{
- + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
- + (void) sprintf (pszBuf, "xnot %%r%d,0x%x", uwBit0_3, ulSign32);
- + }
- + }else{
- + (void) sprintf (pszBuf, "not %%r%d,0x%x", uwBit0_3, uwBit4_9);
- + }
- +/* <<<<< add tazaki 2001.10.10 */
- +/* (void) sprintf (pszBuf, "not\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
- + break;
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass4 : execute dis-assemble class4 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass4 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1, uwOp2;
- + unsigned short uwBit0_3, uwBit4_7, uwBit0_9;
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract op2 from code */
- + uwOp2 = uwCode & 0x0300;
- + uwOp2 >>= 8;
- + /*@ extract bit0_9 from code */
- + uwBit0_9 = uwCode & 0x03ff;
- + /*@ extract bit4_7 from code */
- + uwBit4_7 = uwCode & 0x00f0;
- + uwBit4_7 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + if (uwOp1 == 0) {
- + /* 000 add sp,imm12 */
- + (void) sprintf (pszBuf, "add %%sp,0x%x", uwBit0_9);
- + }
- + else if (uwOp1 == 1) {
- + /* 001 sub sp,imm12 */
- + (void) sprintf (pszBuf, "sub %%sp,0x%x", uwBit0_9);
- + }
- + else {
- + /*@ op1 : 010 - 111 */
- +
- + switch (uwOp2) { /* op2 */
- +
- + case 0: /* op2 = 00 */
- +
- + if( g_iShiftFlag == 1 ){
- + uwBit4_7 += 16;
- + }
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 2: /* 010 srl rd,imm4 */
- +
- + (void) sprintf (pszBuf, "srl %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011 sll rd,imm4 */
- +
- + (void) sprintf (pszBuf, "sll %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100 sra rd,imm4 */
- +
- + (void) sprintf (pszBuf, "sra %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101 sla rd,imm4 */
- +
- + (void) sprintf (pszBuf, "sla %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* 110 rr rd,imm4 */
- +
- + (void) sprintf (pszBuf, "rr %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111 rl rd,imm4 */
- +
- + (void) sprintf (pszBuf, "rl %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- + }
- +
- + break;
- +
- + case 1: /* op2 = 01 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 2: /* 010 srl rd,rs */
- +
- + (void) sprintf (pszBuf, "srl %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011 sll rd,rs */
- +
- + (void) sprintf (pszBuf, "sll %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100 sra rd,rs */
- +
- + (void) sprintf (pszBuf, "sra %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101 sla rd,rs */
- +
- + (void) sprintf (pszBuf, "sla %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* 110 rr rd,rs */
- +
- + (void) sprintf (pszBuf, "rr %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111 rl rd,rs */
- +
- + (void) sprintf (pszBuf, "rl %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- + }
- +
- + break;
- +
- + case 2: /* op2 = 10 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 2: /* scan0 rd,rs */
- +
- + (void) sprintf (pszBuf, "scan0 %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* scan1 rd,rs */
- +
- + (void) sprintf (pszBuf, "scan1 %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* swap rd,rs */
- +
- + (void) sprintf (pszBuf, "swap %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* mirror rd,rs */
- +
- + (void) sprintf (pszBuf, "mirror %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* swaph rd,rs */
- +
- + (void) sprintf (pszBuf, "swaph %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* sat.b rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.b %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- +
- + break;
- +
- + case 3: /* op2 = 11 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 2: /* div0s rs */
- +
- + (void) sprintf (pszBuf, "div0s %%r%d", uwBit4_7);
- + break;
- +
- + case 3: /* div0u rs */
- +
- + (void) sprintf (pszBuf, "div0u %%r%d", uwBit4_7);
- + break;
- +
- + case 4: /* div1 rs */
- +
- + (void) sprintf (pszBuf, "div1 %%r%d", uwBit4_7);
- + break;
- +
- + case 5: /* div2s rs */
- +
- + (void) sprintf (pszBuf, "div2s %%r%d", uwBit4_7);
- + break;
- +
- + case 6: /* div3s */
- +
- + (void) sprintf (pszBuf, "div3s");
- + break;
- +
- + case 7: /* sat.ub rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.ub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- + }
- +
- + break;
- + }
- + }
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass5 : execute dis-assemble class5 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass5 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1, uwOp2, uwOp3;
- + unsigned short uwBit0_3, uwBit4_7, uwBit0_5;
- + char *spSpecialReg[16];
- +
- + /*@ initialize */
- + spSpecialReg[0] = "%psr";
- + spSpecialReg[1] = "%sp";
- + spSpecialReg[2] = "%alr";
- + spSpecialReg[3] = "%ahr";
- + spSpecialReg[4] = "%lco";
- + spSpecialReg[5] = "%lsa";
- + spSpecialReg[6] = "%lea";
- + spSpecialReg[7] = "%sor";
- + spSpecialReg[8] = "%ttbr";
- + spSpecialReg[9] = "%dp";
- + spSpecialReg[10] = "%idir"; /* "" -->"%idir" T.Tazaki 20003/11/18 */
- + spSpecialReg[11] = "%dbbr"; /* "" -->"%dbbr" T.Tazaki 20003/11/18 */
- + spSpecialReg[12] = "";
- + spSpecialReg[13] = "%usp";
- + spSpecialReg[14] = "%ssp";
- + spSpecialReg[15] = "%pc";
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract op2 from code */
- + uwOp2 = uwCode & 0x0300;
- + uwOp2 >>= 8;
- + /*@ extract op3 from code */
- + uwOp3 = uwCode & 0x00c0;
- + uwOp3 >>= 6;
- + /*@ extract bit4_7 from code */
- + uwBit4_7 = uwCode & 0x00f0;
- + uwBit4_7 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- + /*@ extract bit0_5 from code */
- + uwBit0_5 = uwCode & 0x003f;
- +
- + switch (uwOp2) { /* op2 */
- +
- + case 0: /* 00 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:00 ld.w %sd,rs */
- +
- + /*@ check if code is OK */
- + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
- + (void) sprintf (pszBuf, "ld.w %s,%%r%d", spSpecialReg[uwBit0_3], uwBit4_7);
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 1: /* 001:00 ld.w rd,%ss */
- +
- + /*@ check if code is OK */
- +// if (((uwBit4_7 >= 0) && (uwBit4_7 <= 9)) || ((uwBit4_7 >= 13) && (uwBit4_7 <= 15))){ /* change T.Tazaki 2003/11/18 */
- + if (((uwBit4_7 >= 0) && (uwBit4_7 <= 11)) || ((uwBit4_7 >= 13) && (uwBit4_7 <= 15))){
- + (void) sprintf (pszBuf, "ld.w %%r%d,%s", uwBit0_3, spSpecialReg[uwBit4_7]);
- + }
- + else {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + break;
- +
- + case 2: /* 010:00 btst [rb],imm3 */
- +
- + /*@ check if code is OK */
- + if ((uwBit0_3 & 0x8) != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "btst [%%r%d],0x%d", uwBit4_7, uwBit0_3);
- + }
- + break;
- +
- + case 3: /* 011:00 bclr [rb],imm3 */
- +
- + /*@ check if code is OK */
- + if ((uwBit0_3 & 0x8) != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "bclr [%%r%d],0x%d", uwBit4_7, uwBit0_3);
- + }
- + break;
- +
- + case 4: /* 100:00 bset [rb],imm3 */
- +
- + /*@ check if code is OK */
- + if ((uwBit0_3 & 0x8) != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "bset [%%r%d],0x%d", uwBit4_7, uwBit0_3);
- + }
- + break;
- +
- + case 5: /* 101:00 bnot [rb],imm3 */
- +
- + /*@ check if code is OK */
- + if ((uwBit0_3 & 0x8) != 0) {
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + }
- + else {
- + (void) sprintf (pszBuf, "bnot [%%r%d],0x%d", uwBit4_7, uwBit0_3);
- + }
- + break;
- +
- + case 6: /* 110:00 adc rd,rs */
- +
- + (void) sprintf (pszBuf, "adc %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111:00 sbc rd,rs */
- +
- + (void) sprintf (pszBuf, "sbc %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- + }
- +
- + break;
- +
- + case 1: /* 01 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:01 ld.b rd,rs */
- +
- + (void) sprintf (pszBuf, "ld.b %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:01 ld.ub rd,rs */
- +
- + (void) sprintf (pszBuf, "ld.ub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:01 ld.h rd,rs */
- +
- + (void) sprintf (pszBuf, "ld.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:01 ld.uh rd,rs */
- +
- + (void) sprintf (pszBuf, "ld.uh %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:01 ld.c rd,imm4 */
- +
- + (void) sprintf (pszBuf, "ld.c %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:01 ld.c imm4,rs */
- +
- + (void) sprintf (pszBuf, "ld.c 0x%x,%%r%d", uwBit4_7, uwBit0_3);
- + break;
- +
- + case 6: /* 110:01 loop rc,ra */
- +
- + (void) sprintf (pszBuf, "loop %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111:01 sat.w rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + default:
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- +
- + break;
- +
- + case 2: /* 10 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:10 mlt.h rd,rs */
- +
- + (void) sprintf (pszBuf, "mlt.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:10 mltu.h rd,rs */
- +
- + (void) sprintf (pszBuf, "mltu.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:10 mlt.w rd,rs */
- +
- + (void) sprintf (pszBuf, "mlt.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 3: /* 011:10 mltu.w rd,rs */
- +
- + (void) sprintf (pszBuf, "mltu.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:10 mac rs */
- +
- + (void) sprintf (pszBuf, "mac %%r%d", uwBit4_7);
- + break;
- +
- + case 5: /* 101:10 sat.h rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* 110:10 loop rc,imm4 */
- +
- + (void) sprintf (pszBuf, "loop %%r%d,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111:10 sat.uw rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.uw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + default:
- +
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- +
- + break;
- +
- + case 3: /* 11 */
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000:11 mlt.hw rd,rs */
- +
- + (void) sprintf (pszBuf, "mlt.hw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 1: /* 001:11 mac1.h rd,rs */
- +
- + (void) sprintf (pszBuf, "mac1.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 2: /* 010:11 mac1.hw rd,rs */
- +
- + (void) sprintf (pszBuf, "mac1.hw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 4: /* 100:11 mac1.w rd,rs */
- +
- + (void) sprintf (pszBuf, "mac1.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 5: /* 101:11 sat.uh rd,rs */
- +
- + (void) sprintf (pszBuf, "sat.uh %%r%d,%%r%d", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 6: /* 110:11 loop imm4,imm4 */
- +
- + (void) sprintf (pszBuf, "loop 0x%x,0x%x", uwBit0_3, uwBit4_7);
- + break;
- +
- + case 7: /* 111:11 */
- +
- + switch( uwOp3 ) { /* op3 */
- +
- + case 0: /* 111:11:00 do.c imm6 */
- + (void) sprintf (pszBuf, "do.c 0x%x", uwBit0_5);
- + break;
- + case 1: /* 111:11:01 psrset imm5 */
- + (void) sprintf (pszBuf, "psrset 0x%x", uwBit0_5);
- + break;
- + case 2: /* 111:11:10 psrclr imm5 */
- + (void) sprintf (pszBuf, "psrclr 0x%x", uwBit0_5);
- + break;
- + default:
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- + break;
- +
- + default:
- + /*@ error */
- + (void) sprintf (pszBuf, "***");
- + break;
- + }
- +
- + break;
- + }
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass6 : execute dis-assemble class6 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass6 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwBit0_12;
- +
- + /*@ extract bit0_12 from code */
- + uwBit0_12 = uwCode & 0x1fff;
- +
- + (void) sprintf (pszBuf, "ext 0x%x", uwBit0_12);
- +
- + return;
- +}
- +
- +/****************************************************************
- + * vfnDisasmClass7 : execute dis-assemble class7 *
- + ****************************************************************/
- +
- +static void
- +vfnDisasmClass7 (uwCode, pszBuf)
- + unsigned short uwCode; /* 16bit code */
- + char *pszBuf;
- +
- +
- +{
- + unsigned short uwOp1;
- + unsigned short uwBit0_3, uwBit4_9;
- +
- + /*@ extract op1 from code */
- + uwOp1 = uwCode & 0x1c00;
- + uwOp1 >>= 10;
- + /*@ extract bit4_9 from code */
- + uwBit4_9 = uwCode & 0x03f0;
- + uwBit4_9 >>= 4;
- + /*@ extract bit0_3 from code */
- + uwBit0_3 = uwCode & 0x000f;
- +
- + switch (uwOp1) { /* op1 */
- +
- + case 0: /* 000 ld.b rd,[dp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.b %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 1: /* 001 ld.ub rd,[dp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 2: /* 010 ld.h rd,[dp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.h %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 3: /* 011 ld.uh rd,[dp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 4: /* 100 ld.w rd,[dp+imm6] */
- +
- + (void) sprintf (pszBuf, "ld.w %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
- + break;
- +
- + case 5: /* 101 ld.b [dp+imm6],rs */
- +
- + (void) sprintf (pszBuf, "ld.b [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- +
- + case 6: /* 110 ld.h [dp+imm6],rs */
- +
- + (void) sprintf (pszBuf, "ld.h [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- +
- + case 7: /* 111 ld.w [dp+imm6],rs */
- +
- + (void) sprintf (pszBuf, "ld.w [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
- + break;
- + }
- +
- + return;
- +}
- +
- +/* <<<<<<<<<<<<<<< add tazaki 2001.07.31 */
- +
- +
- +int
- +print_insn_c33 (memaddr, info)
- + bfd_vma memaddr;
- + struct disassemble_info * info;
- +{
- + int status;
- + bfd_byte buffer[ 4 ];
- + unsigned long insn = 0;
- +
- + /* First figure out how big the opcode is. */
- +
- + status = info->read_memory_func (memaddr, buffer, 2, info);
- + if (status == 0)
- + {
- + insn = bfd_getl16 (buffer);
- + }
- +
- + if (status != 0)
- + {
- + info->memory_error_func (status, memaddr, info);
- + return -1;
- + }
- +
- + /* Make sure we tell our caller how many bytes we consumed. */
- + return disassemble (memaddr, info, insn);
- +}
- diff --git a/opcodes/c33-opc.c b/opcodes/c33-opc.c
- new file mode 100644
- index 0000000..797dd1a
- --- /dev/null
- +++ b/opcodes/c33-opc.c
- @@ -0,0 +1,2146 @@
- +/* Assemble V850 instructions.
- + Copyright (C) 1996 Free Software Foundation, Inc.
- +
- +This program is free software; you can redistribute it and/or modify
- +it under the terms of the GNU General Public License as published by
- +the Free Software Foundation; either version 2 of the License, or
- +(at your option) any later version.
- +
- +This program is distributed in the hope that it will be useful,
- +but WITHOUT ANY WARRANTY; without even the implied warranty of
- +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +GNU General Public License for more details.
- +
- +You should have received a copy of the GNU General Public License
- +along with this program; if not, write to the Free Software
- +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- +
- +#include "sysdep.h"
- +#include "opcode/c33.h"
- +#include <stdio.h>
- +#include "opintl.h"
- +
- +#if 0 /* c33 */
- +/* regular opcode */
- +#define OP(x) ((x & 0x3f) << 5)
- +#define OP_MASK OP (0x3f)
- +#endif /* c33 */
- +
- +/* c33 addition */
- +#define OP_CLASS0_1(x) ((x & 0x3ff) << 6)
- +#define OP_CLASS0_2(x) ((x & 0xff) << 8)
- +#define OP_CLASS1(x) ((x & 0xff) << 8)
- +#define OP_CLASS2(x) ((x & 0x3f) << 10)
- +#define OP_CLASS3(x) ((x & 0x3f) << 10)
- +#define OP_CLASS4_1(x) ((x & 0x3f) << 10)
- +#define OP_CLASS4_2(x) OP_CLASS1(x) /* shift/rotate,div */
- +#define OP_CLASS5(x) OP_CLASS1(x)
- +#define OP_CLASS6(x) ((x & 0x7) << 13)
- +#define OP_CLASS7(x) ((x & 0x3f) << 10)
- +
- +#define OP_CLASS0_1_MASK OP_CLASS0_1(0x3ff)
- +#define OP_CLASS0_2_MASK OP_CLASS0_2(0xff)
- +#define OP_CLASS1_MASK OP_CLASS1(0xff)
- +#define OP_CLASS2_MASK OP_CLASS2(0x3f)
- +#define OP_CLASS3_MASK OP_CLASS3(0x3f)
- +#define OP_CLASS4_1_MASK OP_CLASS4_1(0xff)
- +#define OP_CLASS4_2_MASK OP_CLASS4_2(0xff)
- +#define OP_CLASS5_MASK OP_CLASS5(0xff)
- +#define OP_CLASS6_MASK OP_CLASS6(0x7)
- +#define OP_CLASS7_MASK OP_CLASS7(0x3f)
- +
- +
- +#if 0
- +/* The functions used to insert and extract complicated operands. */
- +
- +/* Note: There is a conspiracy between these functions and
- + v850_insert_operand() in gas/config/tc-v850.c. Error messages
- + containing the string 'out of range' will be ignored unless a
- + specific command line option is given to GAS. */
- +
- +static const char * not_valid = N_ ("displacement value is not in range and is not aligned");
- +static const char * out_of_range = N_ ("displacement value is out of range");
- +static const char * not_aligned = N_ ("displacement value is not aligned");
- +
- +static const char * immediate_out_of_range = N_ ("immediate value is out of range");
- +
- +static unsigned long
- +insert_d5_4 (insn, value, errmsg)
- + unsigned long insn;
- + long value;
- + const char ** errmsg;
- +{
- + if (value > 0x1f || value < 0)
- + {
- + if (value & 1)
- + * errmsg = _(not_valid);
- + else
- + *errmsg = _(out_of_range);
- + }
- + else if (value & 1)
- + * errmsg = _(not_aligned);
- +
- + value >>= 1;
- +
- + return (insn | (value & 0x0f));
- +}
- +
- +static unsigned long
- +extract_d5_4 (insn, invalid)
- + unsigned long insn;
- + int * invalid;
- +{
- + unsigned long ret = (insn & 0x0f);
- +
- + return ret << 1;
- +}
- +#endif
- +
- +
- +/* Warning: code in gas/config/tc-v850.c examines the contents of this array.
- + If you change any of the values here, be sure to look for side effects in
- + that code. */
- +const struct c33_operand c33_operands[] =
- +{
- +#define UNUSED 0
- + { 0, 0, NULL, NULL, 0, 0 },
- +
- +#define SP 1
- + { 0, 0, NULL, NULL, C33_OPERAND_SP, 0},
- +
- +#define RD 2
- + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0},
- +
- +#define RS 3
- + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0 },
- +
- +#define RS2 4
- + { 4, 4, NULL, NULL, C33_OPERAND_REG, 0},
- +
- +#define SD 5
- + { 4, 0, NULL, NULL, C33_OPERAND_SREG, 0},
- +
- +#define SS 6
- + { 4, 4, NULL, NULL, C33_OPERAND_SREG, 0},
- +
- +#define RB0 7
- + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0},
- +
- +#define RB 8
- + { 4, 4, NULL, NULL, C33_OPERAND_RB, 0},
- +
- +#define MEM_IMM13 9 /* sld,sbit */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM, 13},
- +
- +#define MEM_IMM26 10 /* xld,xbit */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM, 26},
- +
- +#define REGINC 11
- + { 4, 4, NULL, NULL, C33_OPERAND_REGINC, 0},
- +
- +#define SIGN6 12
- + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED, 6},
- +
- +#define SIGN8 13
- + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED, 8},
- +
- +#define SIGN32 14
- + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED, 32},
- +
- +#define IMM2 15
- + { 2, 0, NULL, NULL, C33_OPERAND_IMM, 2},
- +
- +#define IMM3 16
- + { 3, 0, NULL, NULL, C33_OPERAND_IMM, 3},
- +
- +#define IMM4 17
- + { 4, 4, NULL, NULL, C33_OPERAND_IMM, 4},
- +
- +#define IMM5 18
- + { 4, 4, NULL, NULL, C33_OPERAND_IMM, 5},
- +
- +#define IMM6 19
- + { 6, 4, NULL, NULL, C33_OPERAND_IMM, 6},
- +
- +#define IMM10 20
- + { 10, 0, NULL, NULL, C33_OPERAND_IMM, 10},
- +
- +#define IMM32 21
- + { 6, 4, NULL, NULL, C33_OPERAND_IMM, 32},
- +
- +#define SPIMM6 22
- + { 6, 4, NULL, NULL, C33_OPERAND_SPMEM, 6},
- +
- +#define SPIMM32 23 /* xld,sld,xbit,sbit */
- + { 6, 4, NULL, NULL, C33_OPERAND_SPMEM, 32},
- +
- +#define IMM13_LABEL 24
- +// { 13, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_LABEL, 13}, /* ext */
- + { 13, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL, 13}, /* ext */ /* change 2005/04/07 T.Tazaki */
- +
- +#define SIGN32_LABELIMM32 25
- + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 32}, /* jp,call */
- +
- +#define SIGN32_SYMBOLIMM32 26
- + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_SYMBOL, 32}, /* xld.w*/
- +
- +#define SIGN6_SYMBOLIMM6 27
- + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_SYMBOL, 6}, /* ld.w */
- +
- +#define SYMBOLIMM19 28
- + { 6, 4, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_SYMBOL, 19}, /* sld.w */
- +
- +#define SIGN8_LABELIMM8 29
- + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 8}, /* jp,call */
- +
- +#define SIGN32_LABELIMM22 30
- + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 22}, /* scall,sjp,sjrxx */
- +
- +#define RD01 31
- + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
- +
- +#define RS01 32
- + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0 }, /* Advanced macro class0 */
- +
- +#define SS01 33
- + { 4, 0, NULL, NULL, C33_OPERAND_SREG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
- +
- +#define SD01 34
- + { 4, 0, NULL, NULL, C33_OPERAND_SREG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
- +
- +#define RB01 35
- + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
- +
- +#define IMM4_01 36
- + { 4, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_01, 5}, /* Advanced macro class0 */
- +
- +#define IMM5_2 37
- + { 4, 0, NULL, NULL, C33_OPERAND_IMM, 5}, /* Advanced macro : loop */
- +
- +#define IMM6_OP3 38
- + { 6, 0, NULL, NULL, C33_OPERAND_IMM, 6},
- +
- +#define IMM5_OP3_01 39
- + { 5, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_OP3_01, 5}, /* Advanced macro : psrset */
- +
- +#define IMM5_OP3_10 40
- + { 5, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_OP3_10, 5}, /* Advanced macro : psrclr */
- +
- +#define DPIMM6 41
- + { 6, 4, NULL, NULL, C33_OPERAND_DPMEM, 6}, /* Advanced macro : ld.x [%dp+imm6] */
- +
- +#define DPIMM32 42
- + { 6, 4, NULL, NULL, C33_OPERAND_DPMEM, 32}, /* Advanced macro : xld.x [%dp+imm32] */
- +
- +#define DP_SYMBOL19 43
- + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DP_SYMBOL, 19}, /* Advanced macro : ald.w [symbol+imm] */
- +
- +#define DP_SYMBOL32 44
- + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DP_SYMBOL, 32}, /* Advanced macro : xld.w [symbol+imm] */
- +
- +#define DP 45
- + { 4, 0, NULL, NULL, C33_OPERAND_DP | C33_OPERAND_01, 0}, /* Advanced macro : add %rd,%dp */
- +
- +#define DP_OFF_SYMBOL6 46
- + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DPSYMBOL6, 6}, /* Advanced macro : ld.x [%dp+dpoff_l(symbol)] */
- +
- +#define DP_OFF_SYMBOL6_2 47
- + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DPSYMBOL6_2, 6}, /* Advanced macro : ld.x [%dp+dpoff_l(symbol)] */
- +
- +#define COND 48
- + { 4, 4, NULL, NULL, C33_OPERAND_COND, 6}, /* Advanced macro : ext condition */
- +
- +#define OP_SHIFT 49
- + { 2, 2, NULL, NULL, C33_OPERAND_OP_SHIFT, 0}, /* Advanced macro : ext condition */
- +
- +#define IMM5_LABEL 50
- + { 4, 4, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_LABEL, 5}, /* Advanced macro : loop */
- +
- +#define SD_LD 51
- + { 4, 0, NULL, NULL, C33_OPERAND_LD_SREG, 0}, /* Advanced macro,PE : ld.w %sd */
- +
- +#define SS02 52
- + { 4, 0, NULL, NULL, C33_OPERAND_PUSHS_SREG | C33_OPERAND_01, 0}, /* Advanced macro,PE : pushs */
- +
- +#define SD02 53
- + { 4, 0, NULL, NULL, C33_OPERAND_PUSHS_SREG | C33_OPERAND_01, 0}, /* Advanced macro,PE : pops */
- +
- +/* add T.Tazaki 2004/07/23 >>> */
- +#define XLDB_RD_MEM_IMM26 54 /* xld.b %rd,[symbol+imm32] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_RD, 26},
- +#define XLDB_WR_MEM_IMM26 55 /* xld.b [symbol+imm32],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_WR, 26},
- +#define XLDH_RD_MEM_IMM26 56 /* xld.h %rd,[symbol+imm32] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_RD, 26},
- +#define XLDH_WR_MEM_IMM26 57 /* xld.h [symbol+imm32],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_WR, 26},
- +#define XLDW_RD_MEM_IMM26 58 /* xld.w %rd,[symbol+imm32] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_RD, 26},
- +#define XLDW_WR_MEM_IMM26 59 /* xld.w [symbol+imm32],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_WR, 26},
- +#define XLDUB_RD_MEM_IMM26 60 /* xld.ub %rd,[symbol+imm32] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUB_RD, 26},
- +#define XLDUH_RD_MEM_IMM26 61 /* xld.uh %rd,[symbol+imm32] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUH_RD, 26},
- +#define XBTST_MEM_IMM26 62 /* xbtst [symbol+imm32],imm3 */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBTST, 26},
- +#define XBCLR_MEM_IMM26 63 /* xbclr [symbol+imm32],imm3 */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBCLR, 26},
- +#define XBSET_MEM_IMM26 64 /* xbset [symbol+imm32],imm3 */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBSET, 26},
- +#define XBNOT_MEM_IMM26 65 /* xbnot [symbol+imm32],imm3 */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBNOT, 26},
- +
- +#define ALDB_RD_MEM_IMM19 66 /* ald.b %rd,[symbol+imm19] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_RD, 19},
- +#define ALDB_WR_MEM_IMM19 67 /* ald.b [symbol+imm19],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_WR, 19},
- +#define ALDH_RD_MEM_IMM19 68 /* ald.h %rd,[symbol+imm19] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_RD, 19},
- +#define ALDH_WR_MEM_IMM19 69 /* ald.h [symbol+imm19],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_WR, 19},
- +#define ALDW_RD_MEM_IMM19 70 /* ald.w %rd,[symbol+imm19] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_RD, 19},
- +#define ALDW_WR_MEM_IMM19 71 /* ald.w [symbol+imm19],%rs */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_WR, 19},
- +#define ALDUB_RD_MEM_IMM19 72 /* ald.ub %rd,[symbol+imm19] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUB_RD, 19},
- +#define ALDUH_RD_MEM_IMM19 73 /* ald.uh %rd,[symbol+imm19] */
- + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUH_RD, 19},
- +#define RB_IMM26 74
- + { 4, 4, NULL, NULL, C33_OPERAND_RB | C33_OPERAND_26, 0}, /* xld.x [%rb+imm26] */
- +
- +/* add T.Tazaki 2004/07/23 <<< */
- +
- +};
- +
- +
- +/* The opcode table. < STANDARD MACRO >
- +
- + The format of the opcode table is:
- +
- + NAME OPCODE MASK { OPERANDS } MEMOP
- +
- + NAME is the name of the instruction.
- + OPCODE is the instruction opcode.
- + MASK is the opcode mask; this is used to tell the disassembler
- + which bits in the actual opcode must match OPCODE.
- + OPERANDS is the list of operands.
- + MEMOP specifies which operand (if any) is a memory operand.
- + PROCESSORS specifies which CPU(s) support the opcode.
- +
- + The disassembler reads the table in order and prints the first
- + instruction which matches, so this table is sorted to put more
- + specific instructions before more general instructions. It is also
- + sorted by major opcode.
- +
- + The table is also sorted by name. This is used by the assembler.
- + When parsing an instruction the assembler finds the first occurance
- + of the name of the instruciton in this table and then attempts to
- + match the instruction's arguments with description of the operands
- + associated with the entry it has just found in this table. If the
- + match fails the assembler looks at the next entry in this table.
- + If that entry has the same name as the previous entry, then it
- + tries to match the instruction against that entry and so on. This
- + is how the assembler copes with multiple, different formats of the
- + same instruction. */
- +
- +/* It is necessary to put in order and describe the same command. */
- +/* It is meaningful in the order of the row of a command.
- + REGINC is bad if there is nothing before RB. */
- +/* The operand in which a symbol is possible will not become,
- +if it gets used after the operand for which a symbol is improper. */
- +/*************************************************************************************************/
- +/* NO use default data area mode */
- +/*************************************************************************************************/
- +const struct c33_opcode c33_opcodes32[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +
- +/* class 6 */
- +
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +/* The opcode table. < ADVANCED MACRO > */
- +
- +const struct c33_opcode c33_advance_opcodes32[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
- +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* Adv */
- +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* Adv */
- +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* Adv */
- +{ "mac.w", OP_CLASS0_1(0x04), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "mac.hw", OP_CLASS0_1(0x05), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "macclr", OP_CLASS0_1(0x06), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
- +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
- +{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "repeat", OP_CLASS0_1(0x0a), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "repeat", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {IMM4_01}, 0, 0}, /* Adv */
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retm", OP_CLASS0_1(0x1b), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},/* Adv */ /* 2002/10/01 */
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +
- +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
- +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 1}, /* Adv */
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +//{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +//{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +
- +{ "xld.ub", OP_CLASS2(0x39), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +//{ "xld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +
- +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
- +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 2}, /* Adv */
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +//{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +//{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +
- +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +//{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 4}, /* Adv */
- +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 4}, /* Adv */
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +//{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +//{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +
- +//{ "ald.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +//{ "ald.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +//{ "ald.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +//{ "ald.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +//{ "ald.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +//{ "ald.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +//{ "ald.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +//{ "ald.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +
- +{ "ald.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDB_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDB_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDUB_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDH_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDH_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDUH_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDW_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +{ "ald.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDW_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
- +
- +
- +{ "add", OP_CLASS0_1(0x0d), OP_CLASS0_1_MASK, {RD01,DP}, 0, 0}, /* Adv */
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS1_MASK, {RD,DP_OFF_SYMBOL6_2},0,0}, /* Adv */
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},/* Adv */
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +
- +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.b", OP_CLASS4_2(0x9e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.ub", OP_CLASS4_2(0x9f), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.hw", OP_CLASS5(0xa3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +{ "mac1.h", OP_CLASS5(0xa7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mac1.hw",OP_CLASS5(0xab), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mac1.w", OP_CLASS5(0xb3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* Adv */
- +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* Adv */
- +{ "sat.h", OP_CLASS5(0xb6), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.uh", OP_CLASS5(0xb7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xb9), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xba), OP_CLASS5_MASK, {RD,IMM5_LABEL}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xbb), OP_CLASS5_MASK, {IMM5_2,IMM5_LABEL},0, 0}, /* Adv */
- +{ "sat.w", OP_CLASS5(0xbd), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.uw", OP_CLASS5(0xbe), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* Adv */
- +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* Adv */
- +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* Adv */
- +
- +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2,OP_SHIFT,IMM2},0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {COND}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {OP_SHIFT,IMM2}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +const struct c33_opcode c33_ext_opcodes[] =
- +{
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +{ 0, 0, 0, {0}, 0, 0 }
- +
- +} ;
- +
- +
- +/* Advanced Macro Opecode name class0 - bit5,4 = 0,1 */
- +const char *c33_adv_opcodes[] =
- +{
- + "push",
- + "pop",
- + "pushs",
- + "pops",
- + "mac.w",
- + "mac.hw",
- + "macclr",
- + "ld.cf",
- + "div.w",
- + "divu.w",
- + "repeat",
- + "add",
- + 0
- +};
- +
- +/* Advanced Macro Opecode name class5 - bit12_8 = 111:11 */
- +const char *c33_adv_class5_opcodes[] =
- +{
- + "do.c",
- + "psrset",
- + "psrclr",
- + 0
- +};
- +
- +#if 0 /* 下へ移動 T.Tazaki 2004/07/30 */
- +const int c33_num_opcodes =
- + sizeof (c33_opcodes) / sizeof (c33_opcodes[0]);
- +#endif
- +
- +
- +/* The opcode table. < PE MACRO > */
- +
- +const struct c33_opcode c33_pe_opcodes32[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
- +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* PE */
- +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* PE */
- +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* PE */
- +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* PE */
- +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10}, /* PE */ /* add 2004/07/07 T.Tazaki */
- +//{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
- +//{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0}, /* PE ld %sd,%rs */
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0},/* change 2004/07/23 T.Tazaki */
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* PE */
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +//{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
- +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* PE */
- +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* PE */
- +
- +/* class 6 */
- +
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +/*************************************************************************************************/
- +/* Use default data area mode */
- +/*************************************************************************************************/
- +const struct c33_opcode c33_opcodes[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
- +
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +
- +/* class 6 */
- +
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +/* The opcode table. < ADVANCED MACRO > */
- +
- +const struct c33_opcode c33_advance_opcodes[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
- +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* Adv */
- +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* Adv */
- +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* Adv */
- +{ "mac.w", OP_CLASS0_1(0x04), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "mac.hw", OP_CLASS0_1(0x05), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
- +{ "macclr", OP_CLASS0_1(0x06), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
- +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
- +{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "repeat", OP_CLASS0_1(0x0a), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
- +{ "repeat", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {IMM4_01}, 0, 0}, /* Adv */
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retm", OP_CLASS0_1(0x1b), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},/* Adv */ /* 2002/10/01 */
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +
- +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
- +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 1}, /* Adv */
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +
- +{ "xld.ub", OP_CLASS2(0x39), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +
- +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
- +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 2}, /* Adv */
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +
- +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 4}, /* Adv */
- +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 4}, /* Adv */
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
- +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ald.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +{ "ald.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +
- +{ "ald.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +
- +{ "ald.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +{ "ald.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +
- +{ "ald.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +
- +{ "ald.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
- +{ "ald.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
- +
- +{ "add", OP_CLASS0_1(0x0d), OP_CLASS0_1_MASK, {RD01,DP}, 0, 0}, /* Adv */
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS1_MASK, {RD,DP_OFF_SYMBOL6_2},0,0}, /* Adv */
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},/* Adv */
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +
- +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.b", OP_CLASS4_2(0x9e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.ub", OP_CLASS4_2(0x9f), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.hw", OP_CLASS5(0xa3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +{ "mac1.h", OP_CLASS5(0xa7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mac1.hw",OP_CLASS5(0xab), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "mac1.w", OP_CLASS5(0xb3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* Adv */
- +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* Adv */
- +{ "sat.h", OP_CLASS5(0xb6), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.uh", OP_CLASS5(0xb7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xb9), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xba), OP_CLASS5_MASK, {RD,IMM5_LABEL}, 0, 0}, /* Adv */
- +{ "loop", OP_CLASS5(0xbb), OP_CLASS5_MASK, {IMM5_2,IMM5_LABEL},0, 0}, /* Adv */
- +{ "sat.w", OP_CLASS5(0xbd), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "sat.uw", OP_CLASS5(0xbe), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
- +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* Adv */
- +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* Adv */
- +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* Adv */
- +
- +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2,OP_SHIFT,IMM2},0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {COND}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {OP_SHIFT,IMM2}, 0, 0}, /* Adv */
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +
- +/* The opcode table. < PE MACRO > */
- +
- +const struct c33_opcode c33_pe_opcodes[] =
- +{
- +/* class 0 */
- +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
- +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
- +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
- +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
- +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
- +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* PE */
- +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* PE */
- +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* PE */
- +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* PE */
- +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10}, /* PE */ /* add 2004/07/07 T.Tazaki */
- +//{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
- +//{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
- +
- +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
- +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
- +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
- +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
- +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
- +
- +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
- +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
- +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
- +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +
- +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +
- +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
- +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +
- +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
- +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
- +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0}, /* PE ld %sd,%rs */
- +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
- +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
- +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
- +
- +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
- +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
- +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
- +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
- +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
- +
- +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
- +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
- +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
- +
- +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
- +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
- +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
- +
- +/* class 4 */
- +
- +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
- +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
- +
- +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* PE */
- +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
- +//{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
- +//{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
- +
- +/* class 5 */
- +
- +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
- +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
- +
- +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
- +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
- +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
- +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* PE */
- +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* PE */
- +
- +/* class 6 */
- +
- +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
- +
- +{ 0, 0, 0, {0}, 0, 0 },
- +
- +} ;
- +
- +/* 上から移動 T.Tazaki 2004/07/30 */
- +const int c33_num_opcodes =
- + sizeof (c33_opcodes) / sizeof (c33_opcodes[0]);
- diff --git a/opcodes/configure b/opcodes/configure
- index 72c9726..946b73f 100755
- --- a/opcodes/configure
- +++ b/opcodes/configure
- @@ -3948,6 +3948,7 @@ if test x${all_targets} = xfalse ; then
- bfd_tahoe_arch) ;;
- bfd_tic30_arch) ta="$ta tic30-dis.lo" ;;
- bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;;
- + bfd_c33_arch) ta="$ta c33-opc.lo c33-dis.lo" ;;
- bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- diff --git a/opcodes/configure.in b/opcodes/configure.in
- index 6ef461f..2efc16f 100644
- --- a/opcodes/configure.in
- +++ b/opcodes/configure.in
- @@ -163,6 +163,7 @@ if test x${all_targets} = xfalse ; then
- bfd_tahoe_arch) ;;
- bfd_tic30_arch) ta="$ta tic30-dis.lo" ;;
- bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;;
- + bfd_c33_arch) ta="$ta c33-opc.lo c33-dis.lo" ;;
- bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
- diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
- index 373b652..8784007 100644
- --- a/opcodes/disassemble.c
- +++ b/opcodes/disassemble.c
- @@ -55,6 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
- #define ARCH_z8k
- #endif
-
- +#define ARCH_c33 /* 追加 2001.1.15 ide */
-
- disassembler_ftype
- disassembler (abfd)
- @@ -259,6 +260,14 @@ disassembler (abfd)
- disassemble = print_insn_vax;
- break;
- #endif
- +
- +#ifdef ARCH_c33 /* add */
- + case bfd_arch_c33:
- + disassemble = print_insn_c33;
- + break;
- +#endif
- +
- +
- default:
- return 0;
- }
- --
- 1.5.4.3
|