0001-binutils-EPSON-changes-to-binutils.patch 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396
  1. From 4e548b6827ab9d2e8a82e0e8b0e5ab5cd891f54b Mon Sep 17 00:00:00 2001
  2. From: Holger Freyther <ich@tamarin.(none)>
  3. Date: Thu, 11 Sep 2008 14:55:33 +0200
  4. Subject: [PATCH] [binutils] EPSON changes to binutils
  5. ---
  6. MAKE.sh | 161 ++
  7. bfd/Makefile.am | 8 +
  8. bfd/Makefile.in | 8 +
  9. bfd/archures.c | 2 +
  10. bfd/bfd-in2.h | 60 +-
  11. bfd/config.bfd | 5 +
  12. bfd/configure | 1 +
  13. bfd/cpu-c33.c | 109 +
  14. bfd/elf.c | 7 +
  15. bfd/elf32-c33.c | 2730 +++++++++++++++++++++
  16. bfd/syms.c | 11 +
  17. bfd/targets.c | 1 +
  18. binutils/Makefile.am | 1 +
  19. binutils/Makefile.in | 1 +
  20. binutils/objdump.c | 95 +-
  21. binutils/stabs.c | 7 +
  22. binutils/version.c | 7 +
  23. config.sub | 4 +-
  24. configure.in | 3 +
  25. gas/Makefile.am | 24 +-
  26. gas/Makefile.in | 31 +-
  27. gas/as.c | 851 +++++---
  28. gas/config/gas/config/tc-c33.c | 4382 ++++++++++++++++++++++++++++++++++
  29. gas/config/tc-c33.c | 5098 ++++++++++++++++++++++++++++++++++++++++
  30. gas/config/tc-c33.h | 78 +
  31. gas/configure | 3 +
  32. gas/configure.in | 1 +
  33. gas/doc/Makefile.am | 1 +
  34. gas/ext_remove.c | 2014 ++++++++++++++++
  35. gas/ext_remove.h | 176 ++
  36. gas/input-scrub.c | 31 +-
  37. gas/read.c | 3438 +++++++++++++++-------------
  38. gas/stabs.c | 171 +-
  39. gas/write.c | 2283 +++++++++---------
  40. include/dis-asm.h | 4 +
  41. include/elf/c33.h | 128 +
  42. include/elf/common.h | 6 +
  43. include/opcode/c33.h | 205 ++
  44. ld/Makefile.am | 3 +
  45. ld/Makefile.in | 3 +
  46. ld/configure.tgt | 1 +
  47. ld/emulparams/c33.sh | 10 +
  48. ld/emultempl/c33.em | 128 +
  49. ld/ldlang.c | 2986 ++++++++++++-----------
  50. ld/ldmain.c | 711 +++---
  51. ld/ldver.c | 18 +-
  52. ld/lexsup.c | 1335 ++++++-----
  53. ld/scripttempl/c33.sc | 98 +
  54. opcodes/Makefile.am | 8 +
  55. opcodes/Makefile.in | 8 +
  56. opcodes/c33-dis.c | 2824 ++++++++++++++++++++++
  57. opcodes/c33-opc.c | 2146 +++++++++++++++++
  58. opcodes/configure | 1 +
  59. opcodes/configure.in | 1 +
  60. opcodes/disassemble.c | 9 +
  61. 55 files changed, 26899 insertions(+), 5537 deletions(-)
  62. create mode 100755 MAKE.sh
  63. create mode 100644 bfd/cpu-c33.c
  64. create mode 100644 bfd/elf32-c33.c
  65. create mode 100644 gas/config/gas/config/tc-c33.c
  66. create mode 100644 gas/config/tc-c33.c
  67. create mode 100644 gas/config/tc-c33.h
  68. create mode 100644 gas/ext_remove.c
  69. create mode 100644 gas/ext_remove.h
  70. create mode 100644 include/elf/c33.h
  71. create mode 100644 include/opcode/c33.h
  72. create mode 100644 ld/emulparams/c33.sh
  73. create mode 100644 ld/emultempl/c33.em
  74. create mode 100644 ld/scripttempl/c33.sc
  75. create mode 100644 opcodes/c33-dis.c
  76. create mode 100644 opcodes/c33-opc.c
  77. diff --git a/MAKE.sh b/MAKE.sh
  78. new file mode 100755
  79. index 0000000..09c88de
  80. --- /dev/null
  81. +++ b/MAKE.sh
  82. @@ -0,0 +1,161 @@
  83. +#!/bin/sh
  84. +
  85. +echo "@@@@@ START: `date`"
  86. +
  87. +CROSS_TARGET=c33-epson-elf
  88. +INSTDIR=/usr/local/c33
  89. +PREFIX=c33-epson-elf-
  90. +TARGETS="ld as objdump"
  91. +TARGETS=$TARGETS" ar ranlib objcopy nm strip size strings"
  92. +TARGETS=$TARGETS" readelf addr2line cxxfilt"
  93. +WORKDIR=c33-binutils
  94. +ARCHIVE_DIR=$WORKDIR/archive
  95. +ARCHIVE_DATE=`date +%y%m%d`
  96. +
  97. +SRCDIR=binutils-2.10.1
  98. +
  99. +
  100. +case `uname -s` in
  101. +CYGWIN*)
  102. + EXE=.exe
  103. + ;;
  104. +Linux*)
  105. + EXE=
  106. + ;;
  107. +*)
  108. + EXE=
  109. + ;;
  110. +esac
  111. +LANG=C
  112. +
  113. +clean=no
  114. +config=no
  115. +build=no
  116. +install=no
  117. +tags=no
  118. +archive=no
  119. +
  120. +if [ $# -eq 0 ]; then
  121. + clean=yes
  122. + config=yes
  123. + build=yes
  124. + install=yes
  125. + tags=yes
  126. +fi
  127. +
  128. +while [ $# -gt 0 ]; do
  129. + case $1 in
  130. + all)
  131. + clean=yes
  132. + config=yes
  133. + build=yes
  134. + install=yes
  135. + tags=yes
  136. + ;;
  137. + clean)
  138. + clean=yes
  139. + ;;
  140. + config)
  141. + config=yes
  142. + ;;
  143. + build)
  144. + build=yes
  145. + ;;
  146. + install)
  147. + install=yes
  148. + ;;
  149. + tags)
  150. + tags=yes
  151. + ;;
  152. + archive)
  153. + archive=yes
  154. + ;;
  155. + esac
  156. +
  157. + shift
  158. +done
  159. +
  160. +if [ "$clean" = "yes" ]; then
  161. + echo "@@@@@ CLEAN: `date`"
  162. +
  163. + if [ -e $$WORKDIR ]; then
  164. + mv $WORKDIR $WORKDIR-gomi
  165. + rm -rf $WORKDIR-gomi
  166. + fi
  167. +fi
  168. +
  169. +if [ "$config" = "yes" ]; then
  170. + echo "@@@@@ CONFIG: `date`"
  171. +
  172. + mkdir $WORKDIR
  173. + (cd $WORKDIR; \
  174. + ../$SRCDIR/configure \
  175. + --target=$CROSS_TARGET \
  176. + --prefix=$INSTDIR ) || exit 1
  177. +fi
  178. +
  179. +if [ "$build" = "yes" ]; then
  180. + echo "@@@@@ BUILD: `date`"
  181. +
  182. +# (cd $WORKDIR; make) || exit 1
  183. + (cd $WORKDIR; make clean all) || exit 1
  184. +
  185. + cp $WORKDIR/ld/ld-new$EXE c33-ld$EXE
  186. + cp $WORKDIR/gas/as-new$EXE c33-as$EXE
  187. + cp $WORKDIR/binutils/objdump$EXE c33-objdump$EXE
  188. +
  189. + cp $WORKDIR/binutils/addr2line$EXE c33-addr2line$EXE
  190. + cp $WORKDIR/binutils/ar$EXE c33-ar$EXE
  191. + cp $WORKDIR/binutils/cxxfilt$EXE c33-cxxfilt$EXE
  192. + cp $WORKDIR/binutils/nm-new$EXE c33-nm$EXE
  193. + cp $WORKDIR/binutils/objcopy$EXE c33-objcopy$EXE
  194. + cp $WORKDIR/binutils/ranlib$EXE c33-ranlib$EXE
  195. + cp $WORKDIR/binutils/readelf$EXE c33-readelf$EXE
  196. + cp $WORKDIR/binutils/size$EXE c33-size$EXE
  197. + cp $WORKDIR/binutils/strings$EXE c33-strings$EXE
  198. + cp $WORKDIR/binutils/strip-new$EXE c33-strip$EXE
  199. +
  200. +
  201. + for i in $TARGETS; do
  202. + strip c33-$i$EXE
  203. + done
  204. +
  205. + cp c33-as$EXE as_org$EXE
  206. + cp c33-ld$EXE ld$EXE
  207. + cp c33-objdump$EXE objdump$EXE
  208. +
  209. +fi
  210. +
  211. +if [ "$install" = "yes" ]; then
  212. + echo "@@@@@ INSTALL: `date`"
  213. +
  214. + mkdir -p $INSTDIR/bin
  215. + for i in $TARGETS; do
  216. + cp -p c33-$i$EXE $INSTDIR/bin/$PREFIX$i$EXE
  217. + done
  218. +fi
  219. +
  220. +if [ "$tags" = "yes" ]; then
  221. + echo "@@@@@ TAGS: `date`"
  222. +
  223. + rm -rf tags
  224. + ctags -R $SRCDIR
  225. +fi
  226. +
  227. +if [ "$archive" = "yes" ]; then
  228. + echo "@@@@@ ARCHIVE: `date`"
  229. + mkdir -p $ARCHIVE_DIR
  230. +
  231. + echo "Archive to '$ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz'"
  232. + if [ -f $ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz ]; then
  233. + echo -n "This file is exist. Really over write? "
  234. + read x
  235. + fi
  236. + tar cfz $ARCHIVE_DIR/$SRCDIR-$ARCHIVE_DATE.tgz \
  237. + MAKE.sh \
  238. + $SRCDIR
  239. +fi
  240. +
  241. +echo "@@@@@ DONE: `date`"
  242. +
  243. +exit 0
  244. diff --git a/bfd/Makefile.am b/bfd/Makefile.am
  245. index 2d38959..116cf71 100644
  246. --- a/bfd/Makefile.am
  247. +++ b/bfd/Makefile.am
  248. @@ -68,6 +68,7 @@ ALL_MACHINES = \
  249. cpu-tic30.lo \
  250. cpu-tic80.lo \
  251. cpu-v850.lo \
  252. + cpu-c33.lo \
  253. cpu-vax.lo \
  254. cpu-we32k.lo \
  255. cpu-w65.lo \
  256. @@ -105,6 +106,7 @@ ALL_MACHINES_CFILES = \
  257. cpu-tic30.c \
  258. cpu-tic80.c \
  259. cpu-v850.c \
  260. + cpu-c33.c \
  261. cpu-vax.c \
  262. cpu-we32k.c \
  263. cpu-w65.c \
  264. @@ -180,6 +182,7 @@ BFD32_BACKENDS = \
  265. elf32-sh.lo \
  266. elf32-sparc.lo \
  267. elf32-v850.lo \
  268. + elf32-c33.lo \
  269. elf32.lo \
  270. elflink.lo \
  271. epoc-pe-arm.lo \
  272. @@ -310,6 +313,7 @@ BFD32_BACKENDS_CFILES = \
  273. elf32-sh.c \
  274. elf32-sparc.c \
  275. elf32-v850.c \
  276. + elf32-c33.c \
  277. elf32.c \
  278. elflink.c \
  279. epoc-pe-arm.c \
  280. @@ -716,6 +720,7 @@ cpu-sparc.lo: cpu-sparc.c
  281. cpu-tic30.lo: cpu-tic30.c
  282. cpu-tic80.lo: cpu-tic80.c
  283. cpu-v850.lo: cpu-v850.c
  284. +cpu-c33.lo: cpu-c33.c
  285. cpu-vax.lo: cpu-vax.c
  286. cpu-we32k.lo: cpu-we32k.c
  287. cpu-w65.lo: cpu-w65.c
  288. @@ -918,6 +923,9 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \
  289. elf32-v850.lo: elf32-v850.c $(INCDIR)/bfdlink.h elf-bfd.h \
  290. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  291. $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
  292. +elf32-c33.lo: elf32-c33.c $(INCDIR)/bfdlink.h elf-bfd.h \
  293. + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  294. + $(INCDIR)/elf/c33.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
  295. elf32.lo: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
  296. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  297. elfcore.h elflink.h
  298. diff --git a/bfd/Makefile.in b/bfd/Makefile.in
  299. index bb8e06c..39992f4 100644
  300. --- a/bfd/Makefile.in
  301. +++ b/bfd/Makefile.in
  302. @@ -183,6 +183,7 @@ ALL_MACHINES = \
  303. cpu-tic30.lo \
  304. cpu-tic80.lo \
  305. cpu-v850.lo \
  306. + cpu-c33.lo \
  307. cpu-vax.lo \
  308. cpu-we32k.lo \
  309. cpu-w65.lo \
  310. @@ -221,6 +222,7 @@ ALL_MACHINES_CFILES = \
  311. cpu-tic30.c \
  312. cpu-tic80.c \
  313. cpu-v850.c \
  314. + cpu-c33.c \
  315. cpu-vax.c \
  316. cpu-we32k.c \
  317. cpu-w65.c \
  318. @@ -297,6 +299,7 @@ BFD32_BACKENDS = \
  319. elf32-sh.lo \
  320. elf32-sparc.lo \
  321. elf32-v850.lo \
  322. + elf32-c33.lo \
  323. elf32.lo \
  324. elflink.lo \
  325. epoc-pe-arm.lo \
  326. @@ -428,6 +431,7 @@ BFD32_BACKENDS_CFILES = \
  327. elf32-sh.c \
  328. elf32-sparc.c \
  329. elf32-v850.c \
  330. + elf32-c33.c \
  331. elf32.c \
  332. elflink.c \
  333. epoc-pe-arm.c \
  334. @@ -1244,6 +1248,7 @@ cpu-sparc.lo: cpu-sparc.c
  335. cpu-tic30.lo: cpu-tic30.c
  336. cpu-tic80.lo: cpu-tic80.c
  337. cpu-v850.lo: cpu-v850.c
  338. +cpu-c33.lo: cpu-c33.c
  339. cpu-vax.lo: cpu-vax.c
  340. cpu-we32k.lo: cpu-we32k.c
  341. cpu-w65.lo: cpu-w65.c
  342. @@ -1446,6 +1451,9 @@ elf32-sparc.lo: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \
  343. elf32-v850.lo: elf32-v850.c $(INCDIR)/bfdlink.h elf-bfd.h \
  344. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  345. $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
  346. +elf32-c33.lo: elf32-c33.c $(INCDIR)/bfdlink.h elf-bfd.h \
  347. + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  348. + $(INCDIR)/elf/c33.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
  349. elf32.lo: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
  350. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  351. elfcore.h elflink.h
  352. diff --git a/bfd/archures.c b/bfd/archures.c
  353. index 7462592..9bb6a1c 100644
  354. --- a/bfd/archures.c
  355. +++ b/bfd/archures.c
  356. @@ -274,6 +274,7 @@ extern const bfd_arch_info_type bfd_z8k_arch;
  357. extern const bfd_arch_info_type bfd_ns32k_arch;
  358. extern const bfd_arch_info_type bfd_w65_arch;
  359. extern const bfd_arch_info_type bfd_v850_arch;
  360. +extern const bfd_arch_info_type bfd_c33_arch;
  361. extern const bfd_arch_info_type bfd_fr30_arch;
  362. extern const bfd_arch_info_type bfd_mcore_arch;
  363. extern const bfd_arch_info_type bfd_avr_arch;
  364. @@ -314,6 +315,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
  365. &bfd_ns32k_arch,
  366. &bfd_w65_arch,
  367. &bfd_v850_arch,
  368. + &bfd_c33_arch,
  369. &bfd_fr30_arch,
  370. &bfd_mcore_arch,
  371. &bfd_avr_arch,
  372. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
  373. index 4c3eea0..6988b50 100644
  374. --- a/bfd/bfd-in2.h
  375. +++ b/bfd/bfd-in2.h
  376. @@ -1420,6 +1420,8 @@ enum bfd_architecture
  377. #define bfd_mach_avr2 2
  378. #define bfd_mach_avr3 3
  379. #define bfd_mach_avr4 4
  380. + bfd_arch_c33, /* 追加 2001.2.19 ide */
  381. +#define bfd_mach_c33 0 /* 追加 2001.2.19 ide */
  382. bfd_arch_last
  383. };
  384. @@ -1515,11 +1517,32 @@ typedef enum bfd_reloc_status
  385. /* The symbol to relocate against was undefined. */
  386. bfd_reloc_undefined,
  387. +/* add tazaki 2001.11.20 >>>>> */
  388. + bfd_reloc_over_doff_globalpointer,
  389. + bfd_reloc_over_goff_globalpointer,
  390. + bfd_reloc_over_soff_globalpointer,
  391. + bfd_reloc_over_toff_globalpointer,
  392. + bfd_reloc_over_zoff_globalpointer,
  393. + bfd_reloc_doff_over_64mb,
  394. + bfd_reloc_doff_over_8kb,
  395. + bfd_reloc_goff_over_8kb,
  396. + bfd_reloc_soff_over_64mb,
  397. + bfd_reloc_soff_over_8kb,
  398. + bfd_reloc_toff_over_64mb,
  399. + bfd_reloc_toff_over_8kb,
  400. + bfd_reloc_zoff_over_64mb,
  401. + bfd_reloc_zoff_over_8kb,
  402. + bfd_reloc_dpoff_over_512kb,
  403. + bfd_reloc_dpoff_over_64b,
  404. +/* add tazaki 2001.11.20 <<<<< */
  405. +
  406. /* The relocation was performed, but may not be ok - presently
  407. generated only when linking i960 coff files with i960 b.out
  408. symbols. If this type is returned, the error_message argument
  409. to bfd_perform_relocation will be set. */
  410. bfd_reloc_dangerous
  411. +
  412. +
  413. }
  414. bfd_reloc_status_type;
  415. @@ -2376,6 +2399,39 @@ value of SUBI insn. */
  416. into 22 bits. */
  417. BFD_RELOC_AVR_CALL,
  418. +
  419. + /* cc33 relocations */
  420. + BFD_RELOC_C33_AH,
  421. + BFD_RELOC_C33_AL,
  422. + BFD_RELOC_C33_RH,
  423. + BFD_RELOC_C33_RM,
  424. + BFD_RELOC_C33_RL,
  425. + BFD_RELOC_C33_S_RH, /* add tazaki 2002.05.02 */
  426. + BFD_RELOC_C33_S_RM, /* add tazaki 2002.05.02 */
  427. + BFD_RELOC_C33_S_RL, /* add tazaki 2002.05.02 */
  428. + BFD_RELOC_C33_JP, /* add tazaki 2002.04.22 */
  429. + BFD_RELOC_C33_H,
  430. + BFD_RELOC_C33_M,
  431. + BFD_RELOC_C33_L,
  432. + BFD_RELOC_C33_DH, /* add tazaki 2002.01.11 */
  433. + BFD_RELOC_C33_DL, /* add tazaki 2002.01.11 */
  434. + BFD_RELOC_C33_GL, /* add tazaki 2001.07.13 */
  435. + BFD_RELOC_C33_SH, /* add tazaki 2001.11.07 */
  436. + BFD_RELOC_C33_SL, /* add tazaki 2001.07.13 */
  437. + BFD_RELOC_C33_TH, /* add tazaki 2001.11.07 */
  438. + BFD_RELOC_C33_TL, /* add tazaki 2001.07.13 */
  439. + BFD_RELOC_C33_ZH, /* add tazaki 2001.11.07 */
  440. + BFD_RELOC_C33_ZL, /* add tazaki 2001.07.13 */
  441. + BFD_RELOC_C33_DPH,/* add tazaki 2001.11.08 */
  442. + BFD_RELOC_C33_DPM,/* add tazaki 2001.11.08 */
  443. + BFD_RELOC_C33_DPL,/* add tazaki 2001.11.08 */
  444. + BFD_RELOC_C33_LOOP,/* add tazaki 2002.03.05 */
  445. + BFD_RELOC_C33_PUSHN_R0, /* add tazaki 2004/08/19 */
  446. + BFD_RELOC_C33_PUSHN_R1, /* add tazaki 2004/08/19 */
  447. + BFD_RELOC_C33_PUSH_R1, /* add tazaki 2004/08/19 */
  448. +
  449. +
  450. +
  451. /* These two relocations are used by the linker to determine which of
  452. the entries in a C++ virtual function table are actually used. When
  453. the --gc-sections option is given, the linker will zero out the entries
  454. @@ -2395,7 +2451,9 @@ is stored in the reloc's addend. For Rel hosts, we are forced to put
  455. this offset in the reloc's section offset. */
  456. BFD_RELOC_VTABLE_INHERIT,
  457. BFD_RELOC_VTABLE_ENTRY,
  458. - BFD_RELOC_UNUSED };
  459. + BFD_RELOC_UNUSED,
  460. +
  461. + };
  462. typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
  463. reloc_howto_type *
  464. diff --git a/bfd/config.bfd b/bfd/config.bfd
  465. index 3adc5ae..b5f041f 100755
  466. --- a/bfd/config.bfd
  467. +++ b/bfd/config.bfd
  468. @@ -44,6 +44,7 @@ powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
  469. rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
  470. sparc*) targ_archs=bfd_sparc_arch ;;
  471. v850*) targ_archs=bfd_v850_arch ;;
  472. +c33*) targ_archs=bfd_c33_arch ;;
  473. z8k*) targ_archs=bfd_z8k_arch ;;
  474. *) targ_archs=bfd_${targ_cpu}_arch ;;
  475. esac
  476. @@ -767,6 +768,10 @@ case "${targ}" in
  477. ;;
  478. + c33-*-*)
  479. + targ_defvec=bfd_elf32_c33_vec
  480. + ;;
  481. +
  482. v850-*-*)
  483. targ_defvec=bfd_elf32_v850_vec
  484. ;;
  485. diff --git a/bfd/configure b/bfd/configure
  486. index 89f979e..1bd4958 100755
  487. --- a/bfd/configure
  488. +++ b/bfd/configure
  489. @@ -5111,6 +5111,7 @@ do
  490. bfd_elf32_shl_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
  491. bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
  492. bfd_elf32_v850_vec) tb="$tb elf32-v850.lo elf32.lo $elf" ;;
  493. + bfd_elf32_c33_vec) tb="$tb elf32-c33.lo elf32.lo $elf" ;;
  494. bfd_elf64_big_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
  495. target64=true ;;
  496. bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"
  497. diff --git a/bfd/cpu-c33.c b/bfd/cpu-c33.c
  498. new file mode 100644
  499. index 0000000..384f51c
  500. --- /dev/null
  501. +++ b/bfd/cpu-c33.c
  502. @@ -0,0 +1,109 @@
  503. +/* BFD support for the NEC V850 processor
  504. + Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
  505. +
  506. +This file is part of BFD, the Binary File Descriptor library.
  507. +
  508. +This program is free software; you can redistribute it and/or modify
  509. +it under the terms of the GNU General Public License as published by
  510. +the Free Software Foundation; either version 2 of the License, or
  511. +(at your option) any later version.
  512. +
  513. +This program is distributed in the hope that it will be useful,
  514. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  515. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  516. +GNU General Public License for more details.
  517. +
  518. +You should have received a copy of the GNU General Public License
  519. +along with this program; if not, write to the Free Software
  520. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  521. +
  522. +#include "bfd.h"
  523. +#include "sysdep.h"
  524. +#include "libbfd.h"
  525. +
  526. +#include <ctype.h>
  527. +
  528. +static boolean
  529. +scan (info, string)
  530. + const struct bfd_arch_info * info;
  531. + const char * string;
  532. +{
  533. + const char *ptr_src;
  534. + const char *ptr_tst;
  535. + unsigned long number;
  536. + enum bfd_architecture arch;
  537. +
  538. + /* First test for an exact match */
  539. + if (strcasecmp (string, info->printable_name) == 0)
  540. + return true;
  541. +
  542. + /* See how much of the supplied string matches with the
  543. + architecture, eg the string m68k:68020 would match the m68k entry
  544. + up to the :, then we get left with the machine number */
  545. +
  546. + for (ptr_src = string, ptr_tst = info->arch_name;
  547. + *ptr_src && *ptr_tst;
  548. + ptr_src++, ptr_tst++)
  549. + {
  550. + if (*ptr_src != *ptr_tst) break;
  551. + }
  552. +
  553. + /* Chewed up as much of the architecture as will match, skip any
  554. + colons */
  555. + if (*ptr_src == ':')
  556. + ptr_src++;
  557. +
  558. + if (*ptr_src == 0)
  559. + {
  560. + /* nothing more, then only keep this one if it is the default
  561. + machine for this architecture */
  562. + return info->the_default;
  563. + }
  564. +
  565. + number = 0;
  566. + while (isdigit ((unsigned char) *ptr_src))
  567. + {
  568. + number = number * 10 + * ptr_src - '0';
  569. + ptr_src++;
  570. + }
  571. +
  572. + switch (number)
  573. + {
  574. +#if 0
  575. + case bfd_mach_v850e: arch = bfd_arch_v850; break;
  576. + case bfd_mach_v850ea: arch = bfd_arch_v850; break;
  577. +#endif
  578. + default:
  579. + return false;
  580. + }
  581. +
  582. + if (arch != info->arch)
  583. + return false;
  584. +
  585. + if (number != info->mach)
  586. + return false;
  587. +
  588. + return true;
  589. +}
  590. +
  591. +#define N(number, print, default, next) \
  592. +{ 32, 32, 8, bfd_arch_c33, number, "c33", print, 2, default, \
  593. + bfd_default_compatible, scan, next }
  594. +
  595. +#define NEXT NULL
  596. +#if 0
  597. +static const bfd_arch_info_type arch_info_struct[] =
  598. +{
  599. + N (bfd_mach_v850e, "v850e", false, &arch_info_struct[1]),
  600. + N (bfd_mach_v850ea, "v850ea", false, NULL)
  601. +};
  602. +#undef NEXT
  603. +#define NEXT &arch_info_struct[0]
  604. +
  605. +const bfd_arch_info_type bfd_c33_arch =
  606. + N (bfd_mach_c33, "c33", true, NEXT);
  607. +#endif
  608. +
  609. +
  610. +const bfd_arch_info_type bfd_c33_arch =
  611. + N (0, "c33", true, NULL);
  612. diff --git a/bfd/elf.c b/bfd/elf.c
  613. index e8e7e37..b591ee4 100644
  614. --- a/bfd/elf.c
  615. +++ b/bfd/elf.c
  616. @@ -392,6 +392,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
  617. The symbols will be defined as weak, so that multiple definitions
  618. are permitted. The GNU linker extension is to actually discard
  619. all but one of the sections. */
  620. +
  621. if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
  622. flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
  623. @@ -3306,6 +3307,12 @@ prep_headers (abfd)
  624. case bfd_arch_pj:
  625. i_ehdrp->e_machine = EM_PJ;
  626. break;
  627. +/* >>>>> ADDED D.Fujimoto 2007/10/15 Seiko Epson processor (S1C33) */
  628. + // this flag will be written in o and elf files
  629. + case bfd_arch_c33:
  630. + i_ehdrp->e_machine = EM_SE_C33;
  631. + break;
  632. +/* <<<<< ADDED D.Fujimoto 2007/10/15 Seiko Epson processor (S1C33) */
  633. /* also note that EM_M32, AT&T WE32100 is unknown to bfd */
  634. default:
  635. i_ehdrp->e_machine = EM_NONE;
  636. diff --git a/bfd/elf32-c33.c b/bfd/elf32-c33.c
  637. new file mode 100644
  638. index 0000000..ba5d1c8
  639. --- /dev/null
  640. +++ b/bfd/elf32-c33.c
  641. @@ -0,0 +1,2730 @@
  642. +/* c33-specific support for 32-bit ELF
  643. + Copyright (C) 1996, 1997, 1998, 1999,2001 Free Software Foundation, Inc.
  644. +
  645. +This file is part of BFD, the Binary File Descriptor library.
  646. +
  647. +This program is free software; you can redistribute it and/or modify
  648. +it under the terms of the GNU General Public License as published by
  649. +the Free Software Foundation; either version 2 of the License, or
  650. +(at your option) any later version.
  651. +
  652. +This program is distributed in the hope that it will be useful,
  653. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  654. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  655. +GNU General Public License for more details.
  656. +
  657. +You should have received a copy of the GNU General Public License
  658. +along with this program; if not, write to the Free Software
  659. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  660. +
  661. +
  662. +
  663. +/* XXX FIXME: This code is littered with 32bit int, 16bit short, 8bit char
  664. + dependencies. As is the gas & simulator code or the c33. */
  665. +
  666. +
  667. +#include "bfd.h"
  668. +#include "sysdep.h"
  669. +#include "bfdlink.h"
  670. +#include "libbfd.h"
  671. +#include "elf-bfd.h"
  672. +#include "elf/c33.h"
  673. +#include "libiberty.h" // ADDED D.Fujimoto 2007/10/02
  674. +
  675. +/* sign-extend a 24-bit number */
  676. +#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
  677. +
  678. +static reloc_howto_type *c33_elf_reloc_type_lookup
  679. + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
  680. +static void c33_elf_info_to_howto_rel
  681. + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
  682. +static void c33_elf_info_to_howto_rela
  683. + PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
  684. +static bfd_reloc_status_type c33_elf_reloc
  685. + PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
  686. +static boolean c33_elf_is_local_label_name
  687. + PARAMS ((bfd *, const char *));
  688. +static boolean c33_elf_relocate_section
  689. + PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
  690. + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
  691. +static bfd_reloc_status_type c33_elf_perform_relocation
  692. + PARAMS ((bfd *, int, bfd_vma, bfd_byte *,unsigned long));
  693. +static boolean c33_elf_check_relocs
  694. + PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
  695. +
  696. +#if 0
  697. +static void remember_ah_reloc
  698. + PARAMS ((bfd *, bfd_vma, bfd_byte *));
  699. +static bfd_byte * find_remembered_ah_reloc
  700. + PARAMS ((bfd_vma,bfd_byte*));
  701. +#endif
  702. +
  703. +static bfd_reloc_status_type c33_elf_final_link_relocate
  704. + PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *, bfd_vma,
  705. + bfd_vma, bfd_vma, struct bfd_link_info *, asection *, int));
  706. +#if 0
  707. +static boolean c33_elf_object_p
  708. + PARAMS ((bfd *));
  709. +#endif
  710. +static boolean c33_elf_fake_sections
  711. + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
  712. +#if 0
  713. +static void c33_elf_final_write_processing
  714. + PARAMS ((bfd *, boolean));
  715. +#endif
  716. +static boolean c33_elf_set_private_flags
  717. + PARAMS ((bfd *, flagword));
  718. +static boolean c33_elf_copy_private_bfd_data
  719. + PARAMS ((bfd *, bfd *));
  720. +static const char* c33_elf_get_mode_string
  721. + PARAMS ((char mode_flag));
  722. +static boolean c33_elf_merge_private_bfd_data
  723. + PARAMS ((bfd *, bfd *));
  724. +static boolean c33_elf_print_private_bfd_data
  725. + PARAMS ((bfd *, PTR));
  726. +static boolean c33_elf_section_from_bfd_section
  727. + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *));
  728. +static void c33_elf_symbol_processing
  729. + PARAMS ((bfd *, asymbol *));
  730. +static boolean c33_elf_add_symbol_hook
  731. + PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
  732. + const char **, flagword *, asection **, bfd_vma *));
  733. +static boolean c33_elf_link_output_symbol_hook
  734. + PARAMS ((bfd *, struct bfd_link_info *, const char *,
  735. + Elf_Internal_Sym *, asection *));
  736. +static boolean c33_elf_section_from_shdr
  737. + PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
  738. +
  739. +/* シンボルのリロケーション情報 */
  740. +/* Note: It is REQUIRED that the 'type' value of each entry in this array
  741. + match the index of the entry in the array. */
  742. +static reloc_howto_type c33_elf_howto_table[] =
  743. +{
  744. + /* This reloc does nothing. */
  745. + HOWTO (R_C33_NONE, /* type */
  746. + 0, /* rightshift */
  747. + 2, /* size (0 = byte, 1 = short, 2 = long) */
  748. + 32, /* bitsize */
  749. + false, /* pc_relative */
  750. + 0, /* bitpos */
  751. + complain_overflow_bitfield, /* complain_on_overflow */
  752. + bfd_elf_generic_reloc, /* special_function */
  753. + "R_C33_NONE", /* name */
  754. + false, /* partial_inplace */
  755. + 0, /* src_mask */
  756. + 0, /* dst_mask */
  757. + false), /* pcrel_offset */
  758. +
  759. + /* Simple 32bit reloc. */
  760. + HOWTO (R_C33_32, /* type */
  761. + 0, /* rightshift */
  762. + 2, /* size (0 = byte, 1 = short, 2 = long) */
  763. + 32, /* bitsize */
  764. + false, /* pc_relative */
  765. + 0, /* bitpos */
  766. + complain_overflow_dont, /* complain_on_overflow */
  767. + bfd_elf_generic_reloc, /* special_function */
  768. + "R_C33_32", /* name */
  769. + false, /* partial_inplace */
  770. + 0xffffffff, /* src_mask */
  771. + 0xffffffff, /* dst_mask */
  772. + false), /* pcrel_offset */
  773. +
  774. + /* Simple 16bit reloc. */
  775. + HOWTO (R_C33_16, /* type */
  776. + 0, /* rightshift */
  777. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  778. + 16, /* bitsize */
  779. + false, /* pc_relative */
  780. + 0, /* bitpos */
  781. + complain_overflow_dont, /* complain_on_overflow */
  782. + bfd_elf_generic_reloc, /* special_function */
  783. + "R_C33_16", /* name */
  784. + false, /* partial_inplace */
  785. + 0xffff, /* src_mask */
  786. + 0xffff, /* dst_mask */
  787. + false), /* pcrel_offset */
  788. +
  789. + /* Simple 8bit reloc. */
  790. + HOWTO (R_C33_8, /* type */
  791. + 0, /* rightshift */
  792. + 0, /* size (0 = byte, 1 = short, 2 = long) */
  793. + 8, /* bitsize */
  794. + false, /* pc_relative */
  795. + 0, /* bitpos */
  796. + complain_overflow_dont, /* complain_on_overflow */
  797. + bfd_elf_generic_reloc, /* special_function */
  798. + "R_C33_8", /* name */
  799. + false, /* partial_inplace */
  800. + 0xff, /* src_mask */
  801. + 0xff, /* dst_mask */
  802. + false), /* pcrel_offset */
  803. +
  804. + /* @ah LABEL(25:13) */
  805. + HOWTO (R_C33_AH, /* type */
  806. + 0, /* rightshift */
  807. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  808. + 13, /* bitsize */
  809. + false, /* pc_relative */
  810. + 0, /* bitpos */
  811. + complain_overflow_dont, /* complain_on_overflow */
  812. + c33_elf_reloc, /* special_function */
  813. + "R_C33_AH", /* name */
  814. + false, /* partial_inplace */
  815. + 0xffff, /* src_mask */
  816. + 0xffff, /* dst_mask */
  817. + false), /* pcrel_offset */
  818. +
  819. + /* @al LABEL(12:0) */
  820. + HOWTO (R_C33_AL, /* type */
  821. + 0, /* rightshift */
  822. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  823. + 13, /* bitsize */
  824. + false, /* pc_relative */
  825. + 0, /* bitpos */
  826. + complain_overflow_dont, /* complain_on_overflow */
  827. + c33_elf_reloc, /* special_function */
  828. + "R_C33_AL", /* name */
  829. + false, /* partial_inplace */
  830. + 0xffff, /* src_mask */
  831. + 0xffff, /* dst_mask */
  832. + false), /* pcrel_offset */
  833. +
  834. + /* @rh <LABEL-PC>(31:22) */
  835. + HOWTO (R_C33_RH, /* type */
  836. + 0, /* rightshift */
  837. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  838. + 13, /* bitsize */
  839. + true, /* pc_relative */
  840. + 0, /* bitpos */
  841. + complain_overflow_dont, /* complain_on_overflow */
  842. + c33_elf_reloc, /* special_function */
  843. + "R_C33_RH", /* name */
  844. + false, /* partial_inplace */
  845. + 0xffff, /* src_mask */
  846. + 0xffff, /* dst_mask */
  847. + false), /* pcrel_offset */
  848. +
  849. + /* @rm <LABEL-PC>(21:9) */
  850. + HOWTO (R_C33_RM, /* type */
  851. + 0, /* rightshift */
  852. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  853. + 13, /* bitsize */
  854. + true, /* pc_relative */
  855. + 0, /* bitpos */
  856. + complain_overflow_dont, /* complain_on_overflow */
  857. + c33_elf_reloc, /* special_function */
  858. + "R_C33_RM", /* name */
  859. + false, /* partial_inplace */
  860. + 0xffff, /* src_mask */
  861. + 0xffff, /* dst_mask */
  862. + false), /* pcrel_offset */
  863. +
  864. + /* @rl <LABEL-PC>(8:0) */
  865. + HOWTO (R_C33_RL, /* type */
  866. + 0, /* rightshift */
  867. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  868. + 13, /* bitsize */
  869. + true, /* pc_relative */
  870. + 0, /* bitpos */
  871. + complain_overflow_dont, /* complain_on_overflow */
  872. + c33_elf_reloc, /* special_function */
  873. + "R_C33_RL", /* name */
  874. + false, /* partial_inplace */
  875. + 0xffff, /* src_mask */
  876. + 0xffff, /* dst_mask */
  877. + false), /* pcrel_offset */
  878. +
  879. + /* @h LABEL(31:19) */
  880. + HOWTO (R_C33_H, /* type */
  881. + 0, /* rightshift */
  882. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  883. + 13, /* bitsize */
  884. + false, /* pc_relative */
  885. + 0, /* bitpos */
  886. + complain_overflow_dont, /* complain_on_overflow */
  887. + c33_elf_reloc, /* special_function */
  888. + "R_C33_H", /* name */
  889. + false, /* partial_inplace */
  890. + 0xffff, /* src_mask */
  891. + 0xffff, /* dst_mask */
  892. + false), /* pcrel_offset */
  893. +
  894. + /* @m LABEL(18:6) */
  895. + HOWTO (R_C33_M, /* type */
  896. + 0, /* rightshift */
  897. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  898. + 13, /* bitsize */
  899. + false, /* pc_relative */
  900. + 0, /* bitpos */
  901. + complain_overflow_dont, /* complain_on_overflow */
  902. + c33_elf_reloc, /* special_function */
  903. + "R_C33_M", /* name */
  904. + false, /* partial_inplace */
  905. + 0xffff, /* src_mask */
  906. + 0xffff, /* dst_mask */
  907. + false), /* pcrel_offset */
  908. +
  909. + /* @l LABEL(5:0) */
  910. + HOWTO (R_C33_L, /* type */
  911. + 0, /* rightshift */
  912. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  913. + 6, /* bitsize */
  914. + false, /* pc_relative */
  915. + 0, /* bitpos */
  916. + complain_overflow_dont, /* complain_on_overflow */
  917. + c33_elf_reloc, /* special_function */
  918. + "R_C33_L", /* name */
  919. + false, /* partial_inplace */
  920. + 0xffff, /* src_mask */
  921. + 0xffff, /* dst_mask */
  922. + false), /* pcrel_offset */
  923. +
  924. + /* doff_hi(LABEL(25:13)) */ /* add tazaki 2002.01.11 */
  925. + HOWTO (R_C33_DH, /* type */
  926. + 0, /* rightshift */
  927. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  928. + 13, /* bitsize */
  929. + false, /* pc_relative */
  930. + 0, /* bitpos */
  931. + complain_overflow_dont, /* complain_on_overflow */
  932. + c33_elf_reloc, /* special_function */
  933. + "R_C33_DH", /* name */
  934. + false, /* partial_inplace */
  935. + 0xffff, /* src_mask */
  936. + 0xffff, /* dst_mask */
  937. + false), /* pcrel_offset */
  938. +
  939. + /* doff_lo(LABEL(12:0)) */ /* add tazaki 2002.01.11 */
  940. + HOWTO (R_C33_DL, /* type */
  941. + 0, /* rightshift */
  942. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  943. + 13, /* bitsize */
  944. + false, /* pc_relative */
  945. + 0, /* bitpos */
  946. + complain_overflow_dont, /* complain_on_overflow */
  947. + c33_elf_reloc, /* special_function */
  948. + "R_C33_DL", /* name */
  949. + false, /* partial_inplace */
  950. + 0xffff, /* src_mask */
  951. + 0xffff, /* dst_mask */
  952. + false), /* pcrel_offset */
  953. +
  954. + /* goff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
  955. + HOWTO (R_C33_GL, /* type */
  956. + 0, /* rightshift */
  957. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  958. + 13, /* bitsize */
  959. + false, /* pc_relative */
  960. + 0, /* bitpos */
  961. + complain_overflow_dont, /* complain_on_overflow */
  962. + c33_elf_reloc, /* special_function */
  963. + "R_C33_GL", /* name */
  964. + false, /* partial_inplace */
  965. + 0xffff, /* src_mask */
  966. + 0xffff, /* dst_mask */
  967. + false), /* pcrel_offset */
  968. +
  969. + /* soff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
  970. + HOWTO (R_C33_SH, /* type */
  971. + 0, /* rightshift */
  972. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  973. + 13, /* bitsize */
  974. + false, /* pc_relative */
  975. + 0, /* bitpos */
  976. + complain_overflow_dont, /* complain_on_overflow */
  977. + c33_elf_reloc, /* special_function */
  978. + "R_C33_SH", /* name */
  979. + false, /* partial_inplace */
  980. + 0xffff, /* src_mask */
  981. + 0xffff, /* dst_mask */
  982. + false), /* pcrel_offset */
  983. +
  984. + /* soff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
  985. + HOWTO (R_C33_SL, /* type */
  986. + 0, /* rightshift */
  987. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  988. + 13, /* bitsize */
  989. + false, /* pc_relative */
  990. + 0, /* bitpos */
  991. + complain_overflow_dont, /* complain_on_overflow */
  992. + c33_elf_reloc, /* special_function */
  993. + "R_C33_SL", /* name */
  994. + false, /* partial_inplace */
  995. + 0xffff, /* src_mask */
  996. + 0xffff, /* dst_mask */
  997. + false), /* pcrel_offset */
  998. +
  999. + /* toff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
  1000. + HOWTO (R_C33_TH, /* type */
  1001. + 0, /* rightshift */
  1002. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1003. + 13, /* bitsize */
  1004. + false, /* pc_relative */
  1005. + 0, /* bitpos */
  1006. + complain_overflow_dont, /* complain_on_overflow */
  1007. + c33_elf_reloc, /* special_function */
  1008. + "R_C33_TH", /* name */
  1009. + false, /* partial_inplace */
  1010. + 0xffff, /* src_mask */
  1011. + 0xffff, /* dst_mask */
  1012. + false), /* pcrel_offset */
  1013. +
  1014. + /* toff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
  1015. + HOWTO (R_C33_TL, /* type */
  1016. + 0, /* rightshift */
  1017. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1018. + 13, /* bitsize */
  1019. + false, /* pc_relative */
  1020. + 0, /* bitpos */
  1021. + complain_overflow_dont, /* complain_on_overflow */
  1022. + c33_elf_reloc, /* special_function */
  1023. + "R_C33_TL", /* name */
  1024. + false, /* partial_inplace */
  1025. + 0xffff, /* src_mask */
  1026. + 0xffff, /* dst_mask */
  1027. + false), /* pcrel_offset */
  1028. +
  1029. + /* toff_hi(LABEL(25:13)) */ /* add tazaki 2001.11.07 */
  1030. + HOWTO (R_C33_ZH, /* type */
  1031. + 0, /* rightshift */
  1032. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1033. + 13, /* bitsize */
  1034. + false, /* pc_relative */
  1035. + 0, /* bitpos */
  1036. + complain_overflow_dont, /* complain_on_overflow */
  1037. + c33_elf_reloc, /* special_function */
  1038. + "R_C33_ZH", /* name */
  1039. + false, /* partial_inplace */
  1040. + 0xffff, /* src_mask */
  1041. + 0xffff, /* dst_mask */
  1042. + false), /* pcrel_offset */
  1043. +
  1044. + /* zoff_lo(LABEL(12:0)) */ /* add tazaki 2001.07.24 */
  1045. + HOWTO (R_C33_ZL, /* type */
  1046. + 0, /* rightshift */
  1047. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1048. + 13, /* bitsize */
  1049. + false, /* pc_relative */
  1050. + 0, /* bitpos */
  1051. + complain_overflow_dont, /* complain_on_overflow */
  1052. + c33_elf_reloc, /* special_function */
  1053. + "R_C33_ZL", /* name */
  1054. + false, /* partial_inplace */
  1055. + 0xffff, /* src_mask */
  1056. + 0xffff, /* dst_mask */
  1057. + false), /* pcrel_offset */
  1058. +
  1059. + /* (symbol+imm - dp)@31:19 */
  1060. + HOWTO (R_C33_DPH, /* type */
  1061. + 0, /* rightshift */
  1062. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1063. + 13, /* bitsize */
  1064. + false, /* pc_relative */
  1065. + 0, /* bitpos */
  1066. + complain_overflow_dont, /* complain_on_overflow */
  1067. + c33_elf_reloc, /* special_function */
  1068. + "R_C33_DPH", /* name */
  1069. + false, /* partial_inplace */
  1070. + 0xffff, /* src_mask */
  1071. + 0xffff, /* dst_mask */
  1072. + false), /* pcrel_offset */
  1073. +
  1074. + /* (symbol+imm - dp)@18:6 */
  1075. + HOWTO (R_C33_DPM, /* type */
  1076. + 0, /* rightshift */
  1077. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1078. + 13, /* bitsize */
  1079. + false, /* pc_relative */
  1080. + 0, /* bitpos */
  1081. + complain_overflow_dont, /* complain_on_overflow */
  1082. + c33_elf_reloc, /* special_function */
  1083. + "R_C33DP_DPM", /* name */
  1084. + false, /* partial_inplace */
  1085. + 0xffff, /* src_mask */
  1086. + 0xffff, /* dst_mask */
  1087. + false), /* pcrel_offset */
  1088. +
  1089. + /* (symbol+imm - dp)@5:0 */
  1090. + HOWTO (R_C33_DPL, /* type */
  1091. + 0, /* rightshift */
  1092. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1093. + 6, /* bitsize */
  1094. + false, /* pc_relative */
  1095. + 0, /* bitpos */
  1096. + complain_overflow_dont, /* complain_on_overflow */
  1097. + c33_elf_reloc, /* special_function */
  1098. + "R_C33_DPL", /* name */
  1099. + false, /* partial_inplace */
  1100. + 0xffff, /* src_mask */
  1101. + 0xffff, /* dst_mask */
  1102. + false), /* pcrel_offset */
  1103. +
  1104. + /* loop <LABEL-PC>(4:0) */
  1105. + HOWTO (R_C33_LOOP, /* type */
  1106. + 0, /* rightshift */
  1107. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1108. + 4, /* bitsize */
  1109. + true, /* pc_relative */
  1110. + 0, /* bitpos */
  1111. + complain_overflow_dont, /* complain_on_overflow */
  1112. + c33_elf_reloc, /* special_function */
  1113. + "R_C33_LOOP", /* name */
  1114. + false, /* partial_inplace */
  1115. + 0xffff, /* src_mask */
  1116. + 0xffff, /* dst_mask */
  1117. + false), /* pcrel_offset */
  1118. +
  1119. + /* l <LABEL-PC>(8:0) */
  1120. + HOWTO (R_C33_JP, /* type */
  1121. + 0, /* rightshift */
  1122. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1123. + 13, /* bitsize */
  1124. + true, /* pc_relative */
  1125. + 0, /* bitpos */
  1126. + complain_overflow_dont, /* complain_on_overflow */
  1127. + c33_elf_reloc, /* special_function */
  1128. + "R_C33_JP", /* name */
  1129. + false, /* partial_inplace */
  1130. + 0xffff, /* src_mask */
  1131. + 0xffff, /* dst_mask */
  1132. + false), /* pcrel_offset */
  1133. +
  1134. +/* add T.Tazaki 2002.05.02 sjp,scall,xjp,xcall symbol mask >>> */
  1135. +
  1136. + /* @rh <LABEL-PC>(31:22) */
  1137. + HOWTO (R_C33_S_RH, /* type */
  1138. + 0, /* rightshift */
  1139. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1140. + 13, /* bitsize */
  1141. + true, /* pc_relative */
  1142. + 0, /* bitpos */
  1143. + complain_overflow_dont, /* complain_on_overflow */
  1144. + c33_elf_reloc, /* special_function */
  1145. + "R_C33_S_RH", /* name */
  1146. + false, /* partial_inplace */
  1147. + 0xffff, /* src_mask */
  1148. + 0xffff, /* dst_mask */
  1149. + false), /* pcrel_offset */
  1150. +
  1151. + /* @rm <LABEL-PC>(21:9) */
  1152. + HOWTO (R_C33_S_RM, /* type */
  1153. + 0, /* rightshift */
  1154. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1155. + 13, /* bitsize */
  1156. + true, /* pc_relative */
  1157. + 0, /* bitpos */
  1158. + complain_overflow_dont, /* complain_on_overflow */
  1159. + c33_elf_reloc, /* special_function */
  1160. + "R_C33_S_RM", /* name */
  1161. + false, /* partial_inplace */
  1162. + 0xffff, /* src_mask */
  1163. + 0xffff, /* dst_mask */
  1164. + false), /* pcrel_offset */
  1165. +
  1166. + /* @rl <LABEL-PC>(8:0) */
  1167. + HOWTO (R_C33_S_RL, /* type */
  1168. + 0, /* rightshift */
  1169. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1170. + 13, /* bitsize */
  1171. + true, /* pc_relative */
  1172. + 0, /* bitpos */
  1173. + complain_overflow_dont, /* complain_on_overflow */
  1174. + c33_elf_reloc, /* special_function */
  1175. + "R_C33_S_RL", /* name */
  1176. + false, /* partial_inplace */
  1177. + 0xffff, /* src_mask */
  1178. + 0xffff, /* dst_mask */
  1179. + false), /* pcrel_offset */
  1180. +
  1181. +/* add T.Tazaki 2002.05.02 sjp,scall,xjp,xcall symbol mask <<< */
  1182. +
  1183. + /* pushn %r0 */ /* add tazaki 2004/08/19 */
  1184. + HOWTO (R_C33_PUSHN_R0, /* type */
  1185. + 0, /* rightshift */
  1186. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1187. + 13, /* bitsize */
  1188. + false, /* pc_relative */
  1189. + 0, /* bitpos */
  1190. + complain_overflow_dont, /* complain_on_overflow */
  1191. + c33_elf_reloc, /* special_function */
  1192. + "R_C33_PUSHN_R0", /* name */
  1193. + false, /* partial_inplace */
  1194. + 0xffff, /* src_mask */
  1195. + 0xffff, /* dst_mask */
  1196. + false), /* pcrel_offset */
  1197. +
  1198. + /* pushn %r1 */ /* add tazaki 2004/08/19 */
  1199. + HOWTO (R_C33_PUSHN_R1, /* type */
  1200. + 0, /* rightshift */
  1201. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1202. + 13, /* bitsize */
  1203. + false, /* pc_relative */
  1204. + 0, /* bitpos */
  1205. + complain_overflow_dont, /* complain_on_overflow */
  1206. + c33_elf_reloc, /* special_function */
  1207. + "R_C33_PUSHN_R1", /* name */
  1208. + false, /* partial_inplace */
  1209. + 0xffff, /* src_mask */
  1210. + 0xffff, /* dst_mask */
  1211. + false), /* pcrel_offset */
  1212. +
  1213. + /* push %r1 */ /* add tazaki 2004/08/19 */
  1214. + HOWTO (R_C33_PUSH_R1, /* type */
  1215. + 0, /* rightshift */
  1216. + 1, /* size (0 = byte, 1 = short, 2 = long) */
  1217. + 13, /* bitsize */
  1218. + false, /* pc_relative */
  1219. + 0, /* bitpos */
  1220. + complain_overflow_dont, /* complain_on_overflow */
  1221. + c33_elf_reloc, /* special_function */
  1222. + "R_C33_PUSH_R1", /* name */
  1223. + false, /* partial_inplace */
  1224. + 0xffff, /* src_mask */
  1225. + 0xffff, /* dst_mask */
  1226. + false) /* pcrel_offset */
  1227. +
  1228. +};
  1229. +
  1230. +/* Map BFD reloc types to c33 ELF reloc types. */
  1231. +
  1232. +struct c33_elf_reloc_map
  1233. +{
  1234. + /* BFD_RELOC_C33_CALLT_16_16_OFFSET is 258, which will not fix in an
  1235. + unsigned char. */
  1236. + bfd_reloc_code_real_type bfd_reloc_val;
  1237. + unsigned char elf_reloc_val;
  1238. +};
  1239. +
  1240. +static const struct c33_elf_reloc_map c33_elf_reloc_map[] =
  1241. +{
  1242. + { BFD_RELOC_NONE, R_C33_NONE },
  1243. + { BFD_RELOC_32, R_C33_32 },
  1244. + { BFD_RELOC_16, R_C33_16 },
  1245. + { BFD_RELOC_8, R_C33_8 },
  1246. + { BFD_RELOC_C33_AH, R_C33_AH },
  1247. + { BFD_RELOC_C33_AL, R_C33_AL },
  1248. + { BFD_RELOC_C33_RH, R_C33_RH },
  1249. + { BFD_RELOC_C33_RM, R_C33_RM },
  1250. + { BFD_RELOC_C33_RL, R_C33_RL },
  1251. + { BFD_RELOC_C33_S_RH, R_C33_S_RH }, /* add tazaki 2002.05.02 */
  1252. + { BFD_RELOC_C33_S_RM, R_C33_S_RM }, /* add tazaki 2002.05.02 */
  1253. + { BFD_RELOC_C33_S_RL, R_C33_S_RL }, /* add tazaki 2002.05.02 */
  1254. + { BFD_RELOC_C33_JP, R_C33_JP }, /* add tazaki 2002.05.02 */
  1255. + { BFD_RELOC_C33_H, R_C33_H },
  1256. + { BFD_RELOC_C33_M, R_C33_M },
  1257. + { BFD_RELOC_C33_L, R_C33_L },
  1258. + { BFD_RELOC_C33_DH, R_C33_DH }, /* add tazaki 2002.01.11 */
  1259. + { BFD_RELOC_C33_DL, R_C33_DL }, /* add tazaki 2002.01.11 */
  1260. + { BFD_RELOC_C33_GL, R_C33_GL }, /* add tazaki 2001.07.13 */
  1261. + { BFD_RELOC_C33_SH, R_C33_SH }, /* add tazaki 2001.11.07 */
  1262. + { BFD_RELOC_C33_SL, R_C33_SL }, /* add tazaki 2001.07.13 */
  1263. + { BFD_RELOC_C33_TH, R_C33_TH }, /* add tazaki 2001.11.07 */
  1264. + { BFD_RELOC_C33_TL, R_C33_TL }, /* add tazaki 2001.07.13 */
  1265. + { BFD_RELOC_C33_ZH, R_C33_ZH }, /* add tazaki 2001.11.07 */
  1266. + { BFD_RELOC_C33_ZL, R_C33_ZL }, /* add tazaki 2001.07.13 */
  1267. + { BFD_RELOC_C33_DPH, R_C33_DPH },/* add tazaki 2001.11.08 */
  1268. + { BFD_RELOC_C33_DPM, R_C33_DPM },/* add tazaki 2001.11.08 */
  1269. + { BFD_RELOC_C33_DPL, R_C33_DPL }, /* add tazaki 2001.11.08 */
  1270. + { BFD_RELOC_C33_LOOP, R_C33_LOOP }, /* add tazaki 2002.03.05 */
  1271. + { BFD_RELOC_C33_PUSHN_R0, R_C33_PUSHN_R0 }, /* add tazaki 2004/08/19 */
  1272. + { BFD_RELOC_C33_PUSHN_R1, R_C33_PUSHN_R1 }, /* add tazaki 2004/08/19 */
  1273. + { BFD_RELOC_C33_PUSH_R1, R_C33_PUSH_R1 } /* add tazaki 2004/08/19 */
  1274. +};
  1275. +
  1276. +
  1277. +/* Map a bfd relocation into the appropriate howto structure */
  1278. +static reloc_howto_type *
  1279. +c33_elf_reloc_type_lookup (abfd, code)
  1280. + bfd * abfd ATTRIBUTE_UNUSED;
  1281. + bfd_reloc_code_real_type code;
  1282. +{
  1283. + unsigned int i;
  1284. +
  1285. + for (i = 0;
  1286. + i < sizeof (c33_elf_reloc_map) / sizeof (struct c33_elf_reloc_map);
  1287. + i++)
  1288. + {
  1289. + if (c33_elf_reloc_map[i].bfd_reloc_val == code)
  1290. + {
  1291. + BFD_ASSERT (c33_elf_howto_table[c33_elf_reloc_map[i].elf_reloc_val].type == c33_elf_reloc_map[i].elf_reloc_val);
  1292. +
  1293. + return & c33_elf_howto_table[c33_elf_reloc_map[i].elf_reloc_val];
  1294. + }
  1295. + }
  1296. +
  1297. + return NULL;
  1298. +}
  1299. +
  1300. +
  1301. +/* Set the howto pointer for an c33 ELF reloc. */
  1302. +static void
  1303. +c33_elf_info_to_howto_rel (abfd, cache_ptr, dst)
  1304. + bfd * abfd ATTRIBUTE_UNUSED;
  1305. + arelent * cache_ptr;
  1306. + Elf32_Internal_Rel * dst;
  1307. +{
  1308. + unsigned int r_type;
  1309. +
  1310. + r_type = ELF32_R_TYPE (dst->r_info);
  1311. + BFD_ASSERT (r_type < (unsigned int) R_C33_max);
  1312. + cache_ptr->howto = &c33_elf_howto_table[r_type];
  1313. +}
  1314. +
  1315. +/* Set the howto pointer for a C33 ELF reloc (type RELA). */
  1316. +static void
  1317. +c33_elf_info_to_howto_rela (abfd, cache_ptr, dst)
  1318. + bfd * abfd ATTRIBUTE_UNUSED;
  1319. + arelent * cache_ptr;
  1320. + Elf32_Internal_Rela *dst;
  1321. +{
  1322. + unsigned int r_type;
  1323. +
  1324. + r_type = ELF32_R_TYPE (dst->r_info);
  1325. + BFD_ASSERT (r_type < (unsigned int) R_C33_max);
  1326. + cache_ptr->howto = &c33_elf_howto_table[r_type];
  1327. +}
  1328. +
  1329. +
  1330. +/* Look through the relocs for a section during the first phase, and
  1331. + allocate space in the global offset table or procedure linkage
  1332. + table. */
  1333. +
  1334. +static boolean
  1335. +c33_elf_check_relocs (abfd, info, sec, relocs)
  1336. + bfd * abfd;
  1337. + struct bfd_link_info * info;
  1338. + asection * sec;
  1339. + const Elf_Internal_Rela * relocs;
  1340. +{
  1341. + boolean ret = true;
  1342. + bfd *dynobj;
  1343. + Elf_Internal_Shdr *symtab_hdr;
  1344. + struct elf_link_hash_entry **sym_hashes;
  1345. + const Elf_Internal_Rela *rel;
  1346. + const Elf_Internal_Rela *rel_end;
  1347. + asection *sreloc;
  1348. + enum c33_reloc_type r_type;
  1349. +
  1350. +
  1351. +
  1352. + if (info->relocateable)
  1353. + return true;
  1354. +
  1355. +#ifdef DEBUG
  1356. + fprintf (stderr, "c33_elf_check_relocs called for section %s in %s\n",
  1357. + bfd_get_section_name (abfd, sec),
  1358. + bfd_get_filename (abfd));
  1359. +#endif
  1360. +
  1361. + dynobj = elf_hash_table (info)->dynobj;
  1362. + symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
  1363. + sym_hashes = elf_sym_hashes (abfd);
  1364. + sreloc = NULL;
  1365. +
  1366. + rel_end = relocs + sec->reloc_count;
  1367. + for (rel = relocs; rel < rel_end; rel++)
  1368. + {
  1369. + unsigned long r_symndx;
  1370. + struct elf_link_hash_entry *h;
  1371. +
  1372. + r_symndx = ELF32_R_SYM (rel->r_info);
  1373. + if (r_symndx < symtab_hdr->sh_info)
  1374. + h = NULL;
  1375. + else
  1376. + h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  1377. +
  1378. + r_type = (enum c33_reloc_type) ELF32_R_TYPE (rel->r_info);
  1379. + switch (r_type)
  1380. + {
  1381. + default:
  1382. + case R_C33_NONE:
  1383. + case R_C33_32:
  1384. + case R_C33_16:
  1385. + case R_C33_8:
  1386. + case R_C33_AH:
  1387. + case R_C33_AL:
  1388. + case R_C33_RH:
  1389. + case R_C33_RM:
  1390. + case R_C33_RL:
  1391. + case R_C33_S_RH: /* add tazaki 2002.05.02 */
  1392. + case R_C33_S_RM: /* add tazaki 2002.05.02 */
  1393. + case R_C33_S_RL: /* add tazaki 2002.05.02 */
  1394. + case R_C33_JP: /* add tazaki 2002.04.22 */
  1395. + case R_C33_H:
  1396. + case R_C33_M:
  1397. + case R_C33_L:
  1398. + /* >>>>> add tazaki 2002.03.05 */
  1399. + case R_C33_DH:
  1400. + case R_C33_DL:
  1401. + case R_C33_GL:
  1402. + case R_C33_SH:
  1403. + case R_C33_SL:
  1404. + case R_C33_TH:
  1405. + case R_C33_TL:
  1406. + case R_C33_ZH:
  1407. + case R_C33_ZL:
  1408. + case R_C33_DPH:
  1409. + case R_C33_DPM:
  1410. + case R_C33_DPL:
  1411. + case R_C33_LOOP:
  1412. + /* <<<<< add tazaki 2002.03.05 */
  1413. + case R_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
  1414. + case R_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
  1415. + case R_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
  1416. + break;
  1417. +
  1418. + }
  1419. + }
  1420. +
  1421. + return ret;
  1422. +}
  1423. +
  1424. +/*
  1425. + * In the old version, when an entry was checked out from the table,
  1426. + * it was deleted. This produced an error if the entry was needed
  1427. + * more than once, as the second attempted retry failed.
  1428. + *
  1429. + * In the current version, the entry is not deleted, instead we set
  1430. + * the field 'found' to true. If a second lookup matches the same
  1431. + * entry, then we know that the ah reloc has already been updated
  1432. + * and does not need to be updated a second time.
  1433. + *
  1434. + * TODO - TOFIX: If it is possible that we need to restore 2 different
  1435. + * addresses from the same table entry, where the first generates an
  1436. + * overflow, whilst the second do not, then this code will fail.
  1437. + */
  1438. +
  1439. +typedef struct ah_location
  1440. +{
  1441. + bfd_vma addend;
  1442. + bfd_byte * address;
  1443. + unsigned long counter;
  1444. + boolean found;
  1445. + struct ah_location * next;
  1446. +}
  1447. +ah_location;
  1448. +
  1449. +static ah_location * previous_ah;
  1450. +static ah_location * free_ah;
  1451. +static unsigned long ah_counter;
  1452. +
  1453. +#if 0
  1454. +static void
  1455. +remember_ah_reloc (abfd, addend, address)
  1456. + bfd * abfd;
  1457. + bfd_vma addend;
  1458. + bfd_byte * address;
  1459. +{
  1460. + ah_location * entry = NULL;
  1461. +
  1462. + /* Find a free structure. */
  1463. + if (free_ah == NULL)
  1464. + free_ah = (ah_location *) bfd_zalloc (abfd, sizeof (* free_ah));
  1465. +
  1466. + entry = free_ah;
  1467. + free_ah = free_ah->next;
  1468. +
  1469. + entry->addend = addend;
  1470. + entry->address = address;
  1471. + entry->counter = ah_counter ++;
  1472. + entry->found = false;
  1473. + entry->next = previous_ah;
  1474. + previous_ah = entry;
  1475. +
  1476. + /* Cope with wrap around of our counter. */
  1477. + if (ah_counter == 0)
  1478. + {
  1479. + /* XXX - Assume that all counter entries differ only in their low 16 bits. */
  1480. + for (entry = previous_ah; entry != NULL; entry = entry->next)
  1481. + entry->counter &= 0xffff;
  1482. +
  1483. + ah_counter = 0x10000;
  1484. + }
  1485. +
  1486. + return;
  1487. +}
  1488. +
  1489. +static bfd_byte *
  1490. +find_remembered_ah_reloc (addend,address)
  1491. + bfd_vma addend;
  1492. + bfd_byte * address;
  1493. +{
  1494. + ah_location * entry;
  1495. +
  1496. + if( previous_ah == NULL ){ /* add tazaki 2001.11.01 */
  1497. + return NULL;
  1498. + }
  1499. +
  1500. + /* Search the table. Record the most recent entry that matches. */
  1501. + entry = previous_ah;
  1502. +
  1503. + /* 直前にext @ahが存在するか */
  1504. + if ((entry->addend == addend) && (entry->address == address-2))
  1505. + {
  1506. + return entry->address;
  1507. + }
  1508. + else {
  1509. + return NULL;
  1510. + }
  1511. +}
  1512. +
  1513. +#endif
  1514. +
  1515. +/* >>>>>>>>>> add tazaki 2002.03.04 */
  1516. +bfd_byte * g_doff_hi_address = NULL;
  1517. +bfd_byte * g_soff_hi_address = NULL;
  1518. +bfd_byte * g_toff_hi_address = NULL;
  1519. +bfd_byte * g_zoff_hi_address = NULL;
  1520. +bfd_byte * g_symbol_mask_ah_address = NULL;
  1521. +bfd_byte * g_symbol_mask_rh_address = NULL;
  1522. +bfd_byte * g_symbol_mask_rm_address = NULL;
  1523. +bfd_byte * g_dpoff_h_address = NULL;
  1524. +bfd_byte * g_dpoff_m_address = NULL;
  1525. +/* <<<<<<<<<< add tazaki 2002.03.04 */
  1526. +
  1527. +
  1528. +/* 未解決のシンボルを確定する */
  1529. +/* FIXME: The code here probably ought to be removed and the code in reloc.c
  1530. + allowed to do its stuff instead. At least for most of the relocs, anwyay. */
  1531. +static bfd_reloc_status_type
  1532. +c33_elf_perform_relocation (abfd, r_type, addend, address,gp)
  1533. + bfd * abfd;
  1534. + int r_type;
  1535. + bfd_vma addend;
  1536. + bfd_byte * address;
  1537. + unsigned long gp; /* DA,SDA,TDA,ZDA */
  1538. +
  1539. +{
  1540. + unsigned long insn;
  1541. + bfd_signed_vma saddend = (bfd_signed_vma) addend;
  1542. +
  1543. + switch (r_type)
  1544. + {
  1545. + case R_C33_32:
  1546. + bfd_put_32 (abfd, addend, address);
  1547. + return bfd_reloc_ok;
  1548. +
  1549. + case R_C33_16:
  1550. + addend += bfd_get_16 (abfd, address);
  1551. + saddend = (bfd_signed_vma) addend;
  1552. + if (saddend > 0x7fff || saddend < -0x8000)
  1553. + return bfd_reloc_overflow;
  1554. + insn = addend;
  1555. + break;
  1556. +
  1557. + case R_C33_8:
  1558. + addend += (char) bfd_get_8 (abfd, address);
  1559. +
  1560. + saddend = (bfd_signed_vma) addend;
  1561. + if (saddend > 0x7f || saddend < -0x80)
  1562. + return bfd_reloc_overflow;
  1563. +
  1564. + bfd_put_8 (abfd, addend, address);
  1565. + return bfd_reloc_ok;
  1566. +
  1567. + case R_C33_AH: /* @ah (25:13) */
  1568. + /* Remember where this relocation took place. */
  1569. + g_symbol_mask_ah_address = address;
  1570. +
  1571. + /* Get Instruction code */
  1572. + insn = bfd_get_16(abfd, address);
  1573. + /* over 26bit ? */
  1574. + if ( addend > 0x3ffffff )
  1575. + return bfd_reloc_outofrange;
  1576. +
  1577. + /* add symbol25:13 to insn */
  1578. + insn += ((addend >> 13) & 0x1fff);
  1579. + break;
  1580. +
  1581. + case R_C33_AL: /* @al (12:0) */
  1582. + insn = bfd_get_16(abfd, address);
  1583. +
  1584. + if (g_symbol_mask_ah_address != (address - 2)){
  1585. + /* over 13bit ? */
  1586. + if (addend > 0x1fff)
  1587. + return bfd_reloc_outofrange;
  1588. + }
  1589. +
  1590. + insn += (addend & 0x1fff);
  1591. + break;
  1592. +
  1593. + case R_C33_RH: /* LABEL-PC(31:22) */
  1594. + case R_C33_S_RH: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
  1595. + /* Remember where this relocation took place. */
  1596. + g_symbol_mask_rh_address = address;
  1597. +
  1598. + insn = bfd_get_16(abfd, address);
  1599. + insn += (((addend - 4) >> 19) & 0x1ff8);
  1600. + break;
  1601. +
  1602. + case R_C33_RM: /* LABEL-PC(21:9) */
  1603. + case R_C33_S_RM: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
  1604. + /* Remember where this relocation took place. */
  1605. + g_symbol_mask_rm_address = address;
  1606. +
  1607. + insn = bfd_get_16(abfd, address);
  1608. +
  1609. + /* if exist @rh before ext ? */
  1610. + if (g_symbol_mask_rh_address != (address - 2)){
  1611. + saddend = (bfd_signed_vma) addend;
  1612. + /* over signed 22bit ? */
  1613. + if ((saddend - 2) > 0x1ffffe || (saddend - 2 ) < -0x200000 ) /* tazaki 2002.04.24 */
  1614. + return bfd_reloc_outofrange;
  1615. + }
  1616. + insn += (((addend - 2) >> 9) & 0x1fff);
  1617. + break;
  1618. +
  1619. + case R_C33_JP: /* LABEL-PC(8:0) */
  1620. + case R_C33_RL: /* LABEL-PC(8:0) */
  1621. + case R_C33_S_RL: /* LABEL-PC(31:22) */ /* add T.Tazaki 2002.05.02 */
  1622. + /* sign8=sign32(8:1) sign32(0)=0 */
  1623. + insn = bfd_get_16(abfd, address);
  1624. +
  1625. + /* if exist @rm before ext ? */
  1626. + if (g_symbol_mask_rm_address != (address - 2)){
  1627. +
  1628. + saddend = (bfd_signed_vma) addend;
  1629. + /* over signed 8bit ? */
  1630. + if (saddend > 254 || saddend < -256)
  1631. + return bfd_reloc_outofrange;
  1632. + }
  1633. +
  1634. + insn += ((addend >> 1) & 0xff);
  1635. + break;
  1636. +
  1637. + case R_C33_H: /* LABEL(31:19) */
  1638. + insn = bfd_get_16(abfd, address);
  1639. + insn += ((addend >> 19) & 0x1fff);
  1640. + break;
  1641. +
  1642. + case R_C33_M: /* LABEL(18:6) */
  1643. + insn = bfd_get_16(abfd, address);
  1644. + insn += ((addend >> 6) & 0x1fff);
  1645. + break;
  1646. +
  1647. + case R_C33_L: /* LABEL(5:0) */
  1648. + /* ld.w %rd,LABEL@l */
  1649. + insn = bfd_get_16(abfd, address);
  1650. + insn += (addend & 0x3f) << 4;
  1651. + break;
  1652. +
  1653. + case R_C33_DH: /* doff_hi(LABEL) (25:13) */
  1654. + /* default=0x0 & Warning display */
  1655. +
  1656. + /* Remember where this relocation took place. */
  1657. + g_doff_hi_address = address;
  1658. +
  1659. + /* Get Instruction code */
  1660. + insn = bfd_get_16(abfd, address);
  1661. +
  1662. + if (addend >= gp)
  1663. + addend -= gp;
  1664. + else
  1665. + return bfd_reloc_over_doff_globalpointer;
  1666. +
  1667. + /* over 26bit ? */
  1668. + if (addend > 0x3ffffff)
  1669. + return bfd_reloc_doff_over_64mb;
  1670. +
  1671. + /* add symbol25:13 to insn */
  1672. + insn += ((addend >> 13) & 0x1fff);
  1673. + break;
  1674. +
  1675. + case R_C33_DL: /* doff_lo(LABEL) (12:0) */
  1676. + insn = bfd_get_16(abfd, address);
  1677. +
  1678. + if (addend >= gp)
  1679. + addend -= gp;
  1680. + else{
  1681. + return bfd_reloc_over_doff_globalpointer;
  1682. + }
  1683. +
  1684. + /* over 13bit ? */
  1685. + if (addend > 0x1fff){
  1686. + /* if exist doff_hi() before ext ? */
  1687. + if (g_doff_hi_address != (address - 2)){
  1688. + return bfd_reloc_doff_over_8kb;
  1689. + }
  1690. + }
  1691. +
  1692. + insn += (addend & 0x1fff);
  1693. + break;
  1694. +
  1695. +
  1696. + case R_C33_GL: /* goff_lo(LABEL) (12:0) */
  1697. + insn = bfd_get_16(abfd, address);
  1698. +
  1699. + if (addend >= gp)
  1700. + addend -= gp;
  1701. + else{
  1702. + return bfd_reloc_over_goff_globalpointer;
  1703. + }
  1704. +
  1705. + /* over 13bit ? */
  1706. + if (addend > 0x1fff){
  1707. + return bfd_reloc_goff_over_8kb;
  1708. + }
  1709. +
  1710. + insn += (addend & 0x1fff);
  1711. + break;
  1712. +
  1713. + case R_C33_SH: /* soff_hi(LABEL) (25:13) */
  1714. +
  1715. + /* Remember where this relocation took place. */
  1716. + g_soff_hi_address = address;
  1717. +
  1718. + /* Get Instruction code */
  1719. + insn = bfd_get_16(abfd, address);
  1720. +
  1721. + if (addend >= gp)
  1722. + addend -= gp;
  1723. + else
  1724. + return bfd_reloc_over_soff_globalpointer;
  1725. +
  1726. + /* over 26bit ? */
  1727. + if (addend > 0x3ffffff)
  1728. + return bfd_reloc_soff_over_64mb;
  1729. +
  1730. + /* add symbol25:13 to insn */
  1731. + insn += ((addend >> 13) & 0x1fff);
  1732. + break;
  1733. +
  1734. + case R_C33_SL: /* soff_lo(LABEL) (12:0) */
  1735. +
  1736. + insn = bfd_get_16(abfd, address);
  1737. +
  1738. + if (addend >= gp)
  1739. + addend -= gp;
  1740. + else
  1741. + return bfd_reloc_over_soff_globalpointer;
  1742. +
  1743. + if (addend > 0x1fff){
  1744. + /* if exist soff_hi() before ext ? */
  1745. + if (g_soff_hi_address != (address - 2)){
  1746. + return bfd_reloc_soff_over_8kb;
  1747. + }
  1748. + }
  1749. +
  1750. + insn += (addend & 0x1fff);
  1751. + break;
  1752. +
  1753. + case R_C33_TH: /* toff_hi(LABEL) (25:13) */
  1754. +
  1755. + /* Remember where this relocation took place. */
  1756. + g_toff_hi_address = address;
  1757. +
  1758. + /* Get Instruction code */
  1759. + insn = bfd_get_16(abfd, address);
  1760. +
  1761. + if (addend >= gp)
  1762. + addend -= gp;
  1763. + else
  1764. + return bfd_reloc_over_toff_globalpointer;
  1765. +
  1766. + /* over 26bit ? */
  1767. + if (addend > 0x3ffffff)
  1768. + return bfd_reloc_toff_over_64mb;
  1769. +
  1770. + /* add symbol25:13 to insn */
  1771. + insn += ((addend >> 13) & 0x1fff);
  1772. + break;
  1773. +
  1774. + case R_C33_TL: /* toff_lo(LABEL) (12:0) */
  1775. +
  1776. + /* Get Instruction code */
  1777. + insn = bfd_get_16(abfd, address);
  1778. +
  1779. + if (addend >= gp)
  1780. + addend -= gp;
  1781. + else
  1782. + return bfd_reloc_over_toff_globalpointer;
  1783. +
  1784. + /* over 13bit ? */
  1785. + if (addend > 0x1fff){
  1786. + /* if exist toff_hi() before ext ? */
  1787. + if (g_toff_hi_address != (address - 2)){
  1788. + return bfd_reloc_toff_over_8kb;
  1789. + }
  1790. + }
  1791. +
  1792. + insn += (addend & 0x1fff);
  1793. + break;
  1794. +
  1795. + case R_C33_ZH: /* zoff_hi(LABEL) (25:13) */
  1796. +
  1797. + /* Remember where this relocation took place. */
  1798. + g_zoff_hi_address = address;
  1799. +
  1800. + /* Get Instruction code */
  1801. + insn = bfd_get_16(abfd, address);
  1802. +
  1803. + if (addend >= gp)
  1804. + addend -= gp;
  1805. + else
  1806. + return bfd_reloc_over_zoff_globalpointer;
  1807. +
  1808. + /* over 26bit ? */
  1809. + if (addend > 0x3ffffff)
  1810. + return bfd_reloc_zoff_over_64mb;
  1811. +
  1812. + /* add symbol25:13 to insn */
  1813. + insn += ((addend >> 13) & 0x1fff);
  1814. + break;
  1815. +
  1816. + case R_C33_ZL: /* zoff_lo(LABEL) (12:0) */
  1817. +
  1818. + insn = bfd_get_16(abfd, address);
  1819. +
  1820. + if (addend >= gp)
  1821. + addend -= gp;
  1822. + else
  1823. + return bfd_reloc_over_zoff_globalpointer;
  1824. +
  1825. + /* over 13bit ? */
  1826. + if (addend > 0x1fff){
  1827. + /* if exist zoff_hi() before ext ? */
  1828. + if (g_zoff_hi_address != (address - 2)){
  1829. + return bfd_reloc_zoff_over_8kb;
  1830. + }
  1831. + }
  1832. +
  1833. + insn += (addend & 0x1fff);
  1834. + break;
  1835. +
  1836. + case R_C33_DPH: /* (symbol+imm - %dp)@31:19 */
  1837. +
  1838. + /* Remember where this relocation took place. */
  1839. + g_dpoff_h_address = address;
  1840. +
  1841. + if (addend >= gp)
  1842. + addend -= gp;
  1843. + else
  1844. + return bfd_reloc_over_doff_globalpointer;
  1845. +
  1846. + /* Get Instruction code */
  1847. + insn = bfd_get_16(abfd, address);
  1848. + insn += ((addend >> 19) & 0x1fff);
  1849. + break;
  1850. +
  1851. + case R_C33_DPM: /* (symbol+imm - %dp)@18:6 */
  1852. + /* Remember where this relocation took place. */
  1853. + g_dpoff_m_address = address;
  1854. +
  1855. + if (addend >= gp)
  1856. + addend -= gp;
  1857. + else
  1858. + return bfd_reloc_over_doff_globalpointer;
  1859. +
  1860. + /* over 19bit ? */
  1861. + if (addend > 0x7ffff){
  1862. + /* if exist dpoff_h() before ext ? */
  1863. + if (g_dpoff_h_address != (address - 2)){
  1864. + return bfd_reloc_dpoff_over_512kb;
  1865. + }
  1866. + }
  1867. +
  1868. + insn = bfd_get_16(abfd, address);
  1869. + insn += ((addend >> 6) & 0x1fff);
  1870. + break;
  1871. +
  1872. + case R_C33_DPL: /* (symbol+imm - %dp)@5:0 */
  1873. + if (addend >= gp)
  1874. + addend -= gp;
  1875. + else
  1876. + return bfd_reloc_over_doff_globalpointer;
  1877. +
  1878. + /* over 6bit ? */
  1879. + if (addend > 0x3f){
  1880. + /* if exist dpoff_m() before ext ? */
  1881. + if (g_dpoff_m_address != (address - 2)){
  1882. + return bfd_reloc_dpoff_over_64b;
  1883. + }
  1884. + }
  1885. +
  1886. + insn = bfd_get_16(abfd, address);
  1887. + insn += (addend & 0x3f) << 4;
  1888. + break;
  1889. +
  1890. + case R_C33_LOOP: /* LABEL-PC(4:0) */
  1891. + /* imm5=imm4(4:1) */
  1892. + insn = bfd_get_16(abfd, address);
  1893. +
  1894. + saddend = (bfd_signed_vma)(addend - *address);
  1895. + /* over imm4bit ? */
  1896. + if (saddend > 30 || saddend < 0)
  1897. + return bfd_reloc_outofrange;
  1898. +
  1899. + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
  1900. + /* " nop " */
  1901. + /* " nop " */
  1902. + /* "Label: " */
  1903. +
  1904. +// insn += (((addend - *address) & 0x1e) << 3);
  1905. + insn += ((((addend - *address)-1) & 0x1e) << 3);
  1906. +
  1907. + /* add T.Tazaki 2004/09/22 <<< */
  1908. + break;
  1909. +
  1910. + /* add T.Tazaki 2004/08/19 >>> */
  1911. + case R_C33_PUSHN_R0: /* xld,xbtst 展開後の最初の "pushn %r0 */
  1912. + insn = bfd_get_16(abfd, address);
  1913. +
  1914. + insn = 0x0200; /* pushn %r0 */
  1915. + break;
  1916. + case R_C33_PUSHN_R1: /* xld,xbtst 展開後の最初の "pushn %r1 */
  1917. + insn = bfd_get_16(abfd, address);
  1918. +
  1919. + insn = 0x0201; /* pushn %r1 */
  1920. + break;
  1921. + case R_C33_PUSH_R1: /* ADV or PE xld,xbtst 展開後の最初の "push %r1 */
  1922. + insn = bfd_get_16(abfd, address);
  1923. +
  1924. + insn = 0x0011; /* push %r1 */
  1925. + break;
  1926. + /* add T.Tazaki 2004/08/19 <<< */
  1927. +
  1928. +
  1929. + default:
  1930. + /* fprintf (stderr, "reloc type %d not SUPPORTED\n", r_type ); */
  1931. + return bfd_reloc_notsupported;
  1932. +
  1933. + }
  1934. +
  1935. + bfd_put_16 (abfd, insn, address);
  1936. + return bfd_reloc_ok;
  1937. +}
  1938. +
  1939. +
  1940. +
  1941. +/* Insert the addend into the instruction. */
  1942. +static bfd_reloc_status_type
  1943. +c33_elf_reloc (abfd, reloc, symbol, data, isection, obfd, err)
  1944. + bfd * abfd ATTRIBUTE_UNUSED;
  1945. + arelent * reloc;
  1946. + asymbol * symbol;
  1947. + PTR data ATTRIBUTE_UNUSED;
  1948. + asection * isection;
  1949. + bfd * obfd;
  1950. + char ** err ATTRIBUTE_UNUSED;
  1951. +{
  1952. + long relocation;
  1953. +
  1954. + /* If there is an output BFD,
  1955. + and the symbol is not a section name (which is only defined at final link time),
  1956. + and either we are not putting the addend into the instruction
  1957. + or the addend is zero, so there is nothing to add into the instruction
  1958. + then just fixup the address and return. */
  1959. + if (obfd != (bfd *) NULL
  1960. + && (symbol->flags & BSF_SECTION_SYM) == 0
  1961. + && (! reloc->howto->partial_inplace
  1962. + || reloc->addend == 0))
  1963. + {
  1964. + reloc->address += isection->output_offset;
  1965. + return bfd_reloc_ok;
  1966. + }
  1967. +#if 0
  1968. + else if (obfd != NULL)
  1969. + {
  1970. + return bfd_reloc_continue;
  1971. + }
  1972. +#endif
  1973. +
  1974. + /* Catch relocs involving undefined symbols. */
  1975. + if (bfd_is_und_section (symbol->section)
  1976. + && (symbol->flags & BSF_WEAK) == 0
  1977. + && obfd == NULL)
  1978. + return bfd_reloc_undefined;
  1979. +
  1980. + /* We handle final linking of some relocs ourselves. */
  1981. +
  1982. + /* Is the address of the relocation really within the section? */
  1983. + if (reloc->address > isection->_cooked_size)
  1984. + return bfd_reloc_outofrange;
  1985. +
  1986. + /* Work out which section the relocation is targetted at and the
  1987. + initial relocation command value. */
  1988. +
  1989. + /* Get symbol value. (Common symbols are special.) */
  1990. + if (bfd_is_com_section (symbol->section))
  1991. + relocation = 0;
  1992. + else
  1993. + relocation = symbol->value;
  1994. +
  1995. + /* Convert input-section-relative symbol value to absolute + addend. */
  1996. + relocation += symbol->section->output_section->vma;
  1997. + relocation += symbol->section->output_offset;
  1998. + relocation += reloc->addend;
  1999. +
  2000. + if (reloc->howto->pc_relative == true)
  2001. + {
  2002. + /* Here the variable relocation holds the final address of the
  2003. + symbol we are relocating against, plus any addend. */
  2004. + relocation -= isection->output_section->vma + isection->output_offset;
  2005. +
  2006. + /* Deal with pcrel_offset */
  2007. + relocation -= reloc->address;
  2008. + }
  2009. +
  2010. + reloc->addend = relocation;
  2011. + return bfd_reloc_ok;
  2012. +}
  2013. +
  2014. +
  2015. +/* Check local label name */
  2016. +/*ARGSUSED*/
  2017. +static boolean
  2018. +c33_elf_is_local_label_name (abfd, name)
  2019. + bfd * abfd ATTRIBUTE_UNUSED;
  2020. + const char * name;
  2021. +{
  2022. + return ((name[0] == '_' && name[1] == '_' && name[2] == 'L'));
  2023. +}
  2024. +
  2025. +
  2026. +/* The symbol changed by relocation at the time of a link is solved. */
  2027. +
  2028. +int i_dp_warn_flag = 0; /* add tazaki 2002.01.11 */
  2029. +int i_gdp_warn_flag = 0; /* add tazaki 2002.01.11 */
  2030. +int i_sdp_warn_flag = 0; /* add tazaki 2002.01.11 */
  2031. +int i_tdp_warn_flag = 0; /* add tazaki 2002.01.11 */
  2032. +int i_zdp_warn_flag = 0; /* add tazaki 2002.01.11 */
  2033. +
  2034. +/* Perform a relocation as part of a final link. */
  2035. +static bfd_reloc_status_type
  2036. +c33_elf_final_link_relocate (howto, input_bfd, output_bfd,
  2037. + input_section, contents, offset, value,
  2038. + addend, info, sym_sec, is_local)
  2039. + reloc_howto_type * howto;
  2040. + bfd * input_bfd;
  2041. + bfd * output_bfd ATTRIBUTE_UNUSED;
  2042. + asection * input_section;
  2043. + bfd_byte * contents;
  2044. + bfd_vma offset;
  2045. + bfd_vma value;
  2046. + bfd_vma addend;
  2047. + struct bfd_link_info * info;
  2048. + asection * sym_sec;
  2049. + int is_local ATTRIBUTE_UNUSED;
  2050. +{
  2051. + unsigned long r_type = howto->type;
  2052. + bfd_byte * hit_data = contents + offset;
  2053. + unsigned long gp = 0;
  2054. + struct bfd_link_hash_entry * h;
  2055. +
  2056. + /* Adjust the value according to the relocation. */
  2057. + switch (r_type)
  2058. + {
  2059. + case R_C33_16:
  2060. + case R_C33_32:
  2061. + case R_C33_8:
  2062. + case R_C33_H:
  2063. + case R_C33_M:
  2064. + case R_C33_L:
  2065. + case R_C33_AH:
  2066. + case R_C33_AL:
  2067. + break;
  2068. +
  2069. + case R_C33_RH:
  2070. + case R_C33_RM:
  2071. + case R_C33_RL:
  2072. + case R_C33_S_RH:
  2073. + case R_C33_S_RM:
  2074. + case R_C33_S_RL:
  2075. + case R_C33_JP:
  2076. + case R_C33_LOOP:
  2077. + /* set PC relative value */
  2078. + value -= (input_section->output_section->vma
  2079. + + input_section->output_offset);
  2080. + value -= offset;
  2081. + break;
  2082. +
  2083. + case R_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
  2084. + case R_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
  2085. + case R_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
  2086. + case R_C33_NONE:
  2087. + return bfd_reloc_ok;
  2088. +
  2089. + /* add tazaki 2001.08.02 >>>>> */
  2090. +
  2091. + case R_C33_DH:
  2092. + case R_C33_DL:
  2093. +
  2094. + /* Get the value of __dp. */
  2095. + h = bfd_link_hash_lookup (info->hash, "__dp", false, false, true);
  2096. + if (h == (struct bfd_link_hash_entry *) NULL
  2097. + || h->type != bfd_link_hash_defined)
  2098. + {
  2099. + gp = 0;
  2100. + if( i_dp_warn_flag == 0 ){
  2101. + fprintf( stderr,"Warning: __dp symbol cannot be refered to.\n" );
  2102. + i_dp_warn_flag = 1;
  2103. + }
  2104. + }
  2105. + else {
  2106. + gp = (h->u.def.value
  2107. + + h->u.def.section->output_section->vma
  2108. + + h->u.def.section->output_offset);
  2109. + }
  2110. +
  2111. + break;
  2112. +
  2113. + case R_C33_GL:
  2114. +
  2115. + /* Get the value of __gdp. */
  2116. + h = bfd_link_hash_lookup (info->hash, "__gdp", false, false, true);
  2117. + if (h == (struct bfd_link_hash_entry *) NULL
  2118. + || h->type != bfd_link_hash_defined)
  2119. + {
  2120. + gp = 0;
  2121. + if( i_gdp_warn_flag == 0 ){
  2122. + fprintf( stderr,"Warning: __gdp symbol cannot be refered to.\n" );
  2123. + i_gdp_warn_flag = 1;
  2124. + }
  2125. + }
  2126. + else {
  2127. + gp = (h->u.def.value
  2128. + + h->u.def.section->output_section->vma
  2129. + + h->u.def.section->output_offset);
  2130. + }
  2131. +
  2132. + break;
  2133. +
  2134. + case R_C33_SH:
  2135. + case R_C33_SL:
  2136. + /* Get the value of __sdp. */
  2137. + h = bfd_link_hash_lookup (info->hash, "__sdp", false, false, true);
  2138. + if (h == (struct bfd_link_hash_entry *) NULL
  2139. + || h->type != bfd_link_hash_defined)
  2140. + {
  2141. + gp = 0;
  2142. + if( i_sdp_warn_flag == 0 ){
  2143. + fprintf( stderr,"Warning: __sdp symbol cannot be refered to.\n" );
  2144. + i_sdp_warn_flag = 1;
  2145. + }
  2146. + }else{
  2147. + gp = (h->u.def.value
  2148. + + h->u.def.section->output_section->vma
  2149. + + h->u.def.section->output_offset);
  2150. + }
  2151. + break;
  2152. +
  2153. + case R_C33_TH:
  2154. + case R_C33_TL:
  2155. + /* Get the value of __tdp. */
  2156. + h = bfd_link_hash_lookup (info->hash, "__tdp", false, false, true);
  2157. + if (h == (struct bfd_link_hash_entry *) NULL
  2158. + || h->type != bfd_link_hash_defined)
  2159. + {
  2160. + gp = 0;
  2161. + if( i_tdp_warn_flag == 0 ){
  2162. + fprintf( stderr,"Warning: __tdp symbol cannot be refered to.\n" );
  2163. + i_tdp_warn_flag = 1;
  2164. + }
  2165. + }else{
  2166. + gp = (h->u.def.value
  2167. + + h->u.def.section->output_section->vma
  2168. + + h->u.def.section->output_offset);
  2169. + }
  2170. + break;
  2171. +
  2172. + case R_C33_ZH:
  2173. + case R_C33_ZL:
  2174. + /* Get the value of __zdp. */
  2175. + h = bfd_link_hash_lookup (info->hash, "__zdp", false, false, true);
  2176. + if (h == (struct bfd_link_hash_entry *) NULL
  2177. + || h->type != bfd_link_hash_defined)
  2178. + {
  2179. + gp = 0;
  2180. + if( i_zdp_warn_flag == 0 ){
  2181. + fprintf( stderr,"Warning: __zdp symbol cannot be refered to.\n" );
  2182. + i_zdp_warn_flag = 1;
  2183. + }
  2184. + }else{
  2185. + gp = (h->u.def.value
  2186. + + h->u.def.section->output_section->vma
  2187. + + h->u.def.section->output_offset);
  2188. + }
  2189. + break;
  2190. +
  2191. + case R_C33_DPH:
  2192. + case R_C33_DPM:
  2193. + case R_C33_DPL:
  2194. +
  2195. + /* Get the value of __dp. */
  2196. + h = bfd_link_hash_lookup (info->hash, "__dp", false, false, true);
  2197. + if (h == (struct bfd_link_hash_entry *) NULL
  2198. + || h->type != bfd_link_hash_defined)
  2199. + {
  2200. + gp = 0;
  2201. + if( i_dp_warn_flag == 0 ){
  2202. + fprintf( stderr,"Warning: __dp symbol cannot be refered to.\n" );
  2203. + i_dp_warn_flag = 1;
  2204. + }
  2205. + }
  2206. + else {
  2207. + gp = (h->u.def.value
  2208. + + h->u.def.section->output_section->vma
  2209. + + h->u.def.section->output_offset);
  2210. + }
  2211. +
  2212. + break;
  2213. +
  2214. + default:
  2215. + return bfd_reloc_notsupported;
  2216. + }
  2217. +
  2218. +
  2219. + /* add tazaki 2001.08.02 <<<<< */
  2220. +
  2221. + /* Perform the relocation. */
  2222. + return c33_elf_perform_relocation (input_bfd, r_type, value + addend, hit_data,gp);
  2223. +}
  2224. +
  2225. +
  2226. +/* Relocate an C33 ELF section. */
  2227. +static boolean
  2228. +c33_elf_relocate_section (output_bfd, info, input_bfd, input_section,
  2229. + contents, relocs, local_syms, local_sections)
  2230. + bfd * output_bfd;
  2231. + struct bfd_link_info * info;
  2232. + bfd * input_bfd;
  2233. + asection * input_section;
  2234. + bfd_byte * contents;
  2235. + Elf_Internal_Rela * relocs;
  2236. + Elf_Internal_Sym * local_syms;
  2237. + asection ** local_sections;
  2238. +{
  2239. + Elf_Internal_Shdr * symtab_hdr;
  2240. + struct elf_link_hash_entry ** sym_hashes;
  2241. + Elf_Internal_Rela * rel;
  2242. + Elf_Internal_Rela * relend;
  2243. +
  2244. + symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
  2245. + sym_hashes = elf_sym_hashes (input_bfd);
  2246. +
  2247. + if (sym_hashes == NULL)
  2248. + {
  2249. + info->callbacks->warning
  2250. + (info, "no hash table available", NULL, input_bfd, input_section, 0);
  2251. +
  2252. + return false;
  2253. + }
  2254. +
  2255. + /* Reset the list of remembered HI16S relocs to empty. */
  2256. + free_ah = previous_ah;
  2257. + previous_ah = NULL;
  2258. + ah_counter = 0;
  2259. +
  2260. +
  2261. + rel = relocs;
  2262. + relend = relocs + input_section->reloc_count;
  2263. + for (; rel < relend; rel++)
  2264. + {
  2265. + int r_type;
  2266. + reloc_howto_type * howto;
  2267. + unsigned long r_symndx;
  2268. + Elf_Internal_Sym * sym;
  2269. + asection * sec;
  2270. + struct elf_link_hash_entry * h;
  2271. + bfd_vma relocation;
  2272. + bfd_reloc_status_type r;
  2273. +
  2274. + r_symndx = ELF32_R_SYM (rel->r_info);
  2275. + r_type = ELF32_R_TYPE (rel->r_info);
  2276. + howto = c33_elf_howto_table + r_type;
  2277. +
  2278. + if (info->relocateable)
  2279. + {
  2280. + /* This is a relocateable link. We don't have to change
  2281. + anything, unless the reloc is against a section symbol,
  2282. + in which case we have to adjust according to where the
  2283. + section symbol winds up in the output section. */
  2284. + if (r_symndx < symtab_hdr->sh_info)
  2285. + {
  2286. + sym = local_syms + r_symndx;
  2287. + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
  2288. + {
  2289. + sec = local_sections[r_symndx];
  2290. + rel->r_addend += sec->output_offset + sym->st_value;
  2291. + }
  2292. + }
  2293. +
  2294. + continue;
  2295. + }
  2296. +
  2297. + /* This is a final link. */
  2298. + h = NULL;
  2299. + sym = NULL;
  2300. + sec = NULL;
  2301. + if (r_symndx < symtab_hdr->sh_info)
  2302. + {
  2303. + sym = local_syms + r_symndx;
  2304. + sec = local_sections[r_symndx];
  2305. + relocation = (sec->output_section->vma
  2306. + + sec->output_offset
  2307. + + sym->st_value);
  2308. +#if 0
  2309. + {
  2310. + char * name;
  2311. + name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name);
  2312. + name = (name == NULL) ? "<none>" : name;
  2313. +fprintf (stderr, "local: sec: %s, sym: %s (%d), value: %x + %x + %x addend %x\n",
  2314. + sec->name, name, sym->st_name,
  2315. + sec->output_section->vma, sec->output_offset, sym->st_value, rel->r_addend);
  2316. + }
  2317. +#endif
  2318. + }
  2319. + else
  2320. + {
  2321. + h = sym_hashes[r_symndx - symtab_hdr->sh_info];
  2322. +
  2323. + while (h->root.type == bfd_link_hash_indirect
  2324. + || h->root.type == bfd_link_hash_warning)
  2325. + h = (struct elf_link_hash_entry *) h->root.u.i.link;
  2326. +
  2327. + if (h->root.type == bfd_link_hash_defined
  2328. + || h->root.type == bfd_link_hash_defweak)
  2329. + {
  2330. + sec = h->root.u.def.section;
  2331. + relocation = (h->root.u.def.value
  2332. + + sec->output_section->vma
  2333. + + sec->output_offset);
  2334. +#if 0
  2335. +fprintf (stderr, "defined: sec: %s, name: %s, value: %x + %x + %x gives: %x\n",
  2336. + sec->name, h->root.root.string, h->root.u.def.value, sec->output_section->vma, sec->output_offset, relocation);
  2337. +#endif
  2338. + }
  2339. + else if (h->root.type == bfd_link_hash_undefweak)
  2340. + {
  2341. +#if 0
  2342. +fprintf (stderr, "undefined: sec: %s, name: %s\n",
  2343. + sec->name, h->root.root.string);
  2344. +#endif
  2345. + relocation = 0;
  2346. + }
  2347. + else
  2348. + {
  2349. + if (! ((*info->callbacks->undefined_symbol)
  2350. + (info, h->root.root.string, input_bfd,
  2351. + input_section, rel->r_offset, true)))
  2352. + return false;
  2353. +#if 0
  2354. +fprintf (stderr, "unknown: name: %s\n", h->root.root.string);
  2355. +#endif
  2356. + relocation = 0;
  2357. + }
  2358. + }
  2359. +
  2360. + /* FIXME: We should use the addend, but the COFF relocations
  2361. + don't. */
  2362. + r = c33_elf_final_link_relocate (howto, input_bfd, output_bfd,
  2363. + input_section,
  2364. + contents, rel->r_offset,
  2365. + relocation, rel->r_addend,
  2366. + info, sec, h == NULL);
  2367. +
  2368. + if (r != bfd_reloc_ok)
  2369. + {
  2370. + const char * name;
  2371. + const char * msg = (const char *)0;
  2372. +
  2373. + if (h != NULL)
  2374. + name = h->root.root.string;
  2375. + else
  2376. + {
  2377. + name = (bfd_elf_string_from_elf_section
  2378. + (input_bfd, symtab_hdr->sh_link, sym->st_name));
  2379. + if (name == NULL || *name == '\0')
  2380. + name = bfd_section_name (input_bfd, sec);
  2381. + }
  2382. +
  2383. + switch (r)
  2384. + {
  2385. + case bfd_reloc_overflow:
  2386. + if (! ((*info->callbacks->reloc_overflow)
  2387. + (info, name, howto->name, (bfd_vma) 0,
  2388. + input_bfd, input_section, rel->r_offset)))
  2389. + return false;
  2390. + break;
  2391. +
  2392. + case bfd_reloc_undefined:
  2393. + if (! ((*info->callbacks->undefined_symbol)
  2394. + (info, name, input_bfd, input_section,
  2395. + rel->r_offset, true)))
  2396. + return false;
  2397. + break;
  2398. +
  2399. + case bfd_reloc_outofrange:
  2400. +// msg = _("internal error: out of range error"); /* Change T.Tazaki 2003/11/18 */
  2401. + msg = _("out of range error"); /* Change T.Tazaki 2003/11/18 */
  2402. + goto common_error;
  2403. +
  2404. + case bfd_reloc_notsupported:
  2405. + msg = _("internal error: unsupported relocation error");
  2406. + goto common_error;
  2407. +
  2408. + case bfd_reloc_dangerous:
  2409. + msg = _("internal error: dangerous relocation");
  2410. + goto common_error;
  2411. +
  2412. + case bfd_reloc_other:
  2413. + msg = _("could not locate special linker symbol __gp");
  2414. + goto common_error;
  2415. +
  2416. + case bfd_reloc_continue:
  2417. + msg = _("could not locate special linker symbol __ep");
  2418. + goto common_error;
  2419. +
  2420. + case (bfd_reloc_dangerous + 1):
  2421. + msg = _("could not locate special linker symbol __ctbp");
  2422. + goto common_error;
  2423. +
  2424. +/* add tazaki 2002.01.11 >>>>> */
  2425. + case bfd_reloc_over_doff_globalpointer:
  2426. + msg = _("Default Data area pointer value is larger than symbol address value.");
  2427. + goto common_error;
  2428. +
  2429. + case bfd_reloc_over_goff_globalpointer:
  2430. + msg = _("G Data area pointer value is larger than symbol address value.");
  2431. + goto common_error;
  2432. +
  2433. + case bfd_reloc_over_soff_globalpointer:
  2434. + msg = _("S Data area pointer value is larger than symbol address value.");
  2435. + goto common_error;
  2436. +
  2437. + case bfd_reloc_over_toff_globalpointer:
  2438. + msg = _("T Data area pointer value is larger than symbol address value.");
  2439. + goto common_error;
  2440. +
  2441. + case bfd_reloc_over_zoff_globalpointer:
  2442. + msg = _("Z Data area pointer value is larger than symbol address value.");
  2443. + goto common_error;
  2444. +
  2445. + case bfd_reloc_doff_over_64mb:
  2446. + msg = _("The offset value of a symbol is over 64MB.(default data area)");
  2447. + goto common_error;
  2448. +
  2449. + case bfd_reloc_doff_over_8kb:
  2450. + msg = _("The offset value of a symbol is over 8KB.(default data area)");
  2451. + goto common_error;
  2452. +
  2453. + case bfd_reloc_goff_over_8kb:
  2454. + msg = _("The offset value of a symbol is over 8KB.(G data area)");
  2455. + goto common_error;
  2456. +
  2457. + case bfd_reloc_soff_over_64mb:
  2458. + msg = _("The offset value of a symbol is over 64MB.(S data area)");
  2459. + goto common_error;
  2460. +
  2461. + case bfd_reloc_soff_over_8kb:
  2462. + msg = _("The offset value of a symbol is over 8KB.(S data area)");
  2463. + goto common_error;
  2464. +
  2465. + case bfd_reloc_toff_over_64mb:
  2466. + msg = _("The offset value of a symbol is over 64MB.(T data area)");
  2467. + goto common_error;
  2468. +
  2469. + case bfd_reloc_toff_over_8kb:
  2470. + msg = _("The offset value of a symbol is over 8KB.(T data area)");
  2471. + goto common_error;
  2472. +
  2473. + case bfd_reloc_zoff_over_64mb:
  2474. + msg = _("The offset value of a symbol is over 64MB.(Z data area)");
  2475. + goto common_error;
  2476. +
  2477. + case bfd_reloc_zoff_over_8kb:
  2478. + msg = _("The offset value of a symbol is over 8KB.(Z data area)");
  2479. + goto common_error;
  2480. +
  2481. + case bfd_reloc_dpoff_over_512kb:
  2482. + msg = _("The offset value of a symbol is over 512KB.(default data area)");
  2483. + goto common_error;
  2484. +
  2485. + case bfd_reloc_dpoff_over_64b:
  2486. + msg = _("The offset value of a symbol is over 64byte.(default data area)");
  2487. + goto common_error;
  2488. +
  2489. +/* add tazaki 2002.01.11 <<<<< */
  2490. +
  2491. + default:
  2492. + msg = _("internal error: unknown error");
  2493. + /* fall through */
  2494. +
  2495. + common_error:
  2496. + if (!((*info->callbacks->warning)
  2497. + (info, msg, name, input_bfd, input_section,
  2498. + rel->r_offset)))
  2499. + return false;
  2500. + break;
  2501. + }
  2502. + }
  2503. + }
  2504. +
  2505. + return true;
  2506. +}
  2507. +
  2508. +static boolean
  2509. +c33_elf_gc_sweep_hook (abfd, info, sec, relocs)
  2510. + bfd *abfd ATTRIBUTE_UNUSED;
  2511. + struct bfd_link_info *info ATTRIBUTE_UNUSED;
  2512. + asection *sec ATTRIBUTE_UNUSED;
  2513. + const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
  2514. +{
  2515. + /* No got and plt entries for c33-elf */
  2516. + return true;
  2517. +}
  2518. +
  2519. +static asection *
  2520. +c33_elf_gc_mark_hook (abfd, info, rel, h, sym)
  2521. + bfd *abfd;
  2522. + struct bfd_link_info *info ATTRIBUTE_UNUSED;
  2523. + Elf_Internal_Rela *rel;
  2524. + struct elf_link_hash_entry *h;
  2525. + Elf_Internal_Sym *sym;
  2526. +{
  2527. + if (h != NULL)
  2528. + {
  2529. + switch (ELF32_R_TYPE (rel->r_info))
  2530. + {
  2531. + default:
  2532. + switch (h->root.type)
  2533. + {
  2534. + case bfd_link_hash_defined:
  2535. + case bfd_link_hash_defweak:
  2536. + return h->root.u.def.section;
  2537. +
  2538. + case bfd_link_hash_common:
  2539. + return h->root.u.c.p->section;
  2540. +
  2541. + default:
  2542. + break;
  2543. + }
  2544. + }
  2545. + }
  2546. + else
  2547. + {
  2548. + if (!(elf_bad_symtab (abfd)
  2549. + && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
  2550. + && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
  2551. + && sym->st_shndx != SHN_COMMON))
  2552. + {
  2553. + return bfd_section_from_elf_index (abfd, sym->st_shndx);
  2554. + }
  2555. + }
  2556. + return NULL;
  2557. +}
  2558. +
  2559. +/* Store the machine number in the flags field. */
  2560. +/* Function to keep C33 specific file flags. */
  2561. +static boolean
  2562. +c33_elf_set_private_flags (abfd, flags)
  2563. + bfd * abfd;
  2564. + flagword flags;
  2565. +{
  2566. + BFD_ASSERT (!elf_flags_init (abfd)
  2567. + || elf_elfheader (abfd)->e_flags == flags);
  2568. +
  2569. + elf_elfheader (abfd)->e_flags = flags;
  2570. + elf_flags_init (abfd) = true;
  2571. +
  2572. + return true;
  2573. +}
  2574. +
  2575. +/* Copy backend specific data from one object module to another */
  2576. +static boolean
  2577. +c33_elf_copy_private_bfd_data (ibfd, obfd)
  2578. + bfd * ibfd;
  2579. + bfd * obfd;
  2580. +{
  2581. + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
  2582. + || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
  2583. + return true;
  2584. +
  2585. + BFD_ASSERT (!elf_flags_init (obfd)
  2586. + || (elf_elfheader (obfd)->e_flags
  2587. + == elf_elfheader (ibfd)->e_flags));
  2588. +
  2589. + elf_gp (obfd) = elf_gp (ibfd);
  2590. + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
  2591. + elf_flags_init (obfd) = true;
  2592. + return true;
  2593. +}
  2594. +
  2595. +
  2596. +/* >>>>> ADDED D.Fujimoto 2007/10/01 */
  2597. +static const char* c33_elf_get_mode_string(char mode_flag)
  2598. +{
  2599. + switch (mode_flag) {
  2600. + case 'A': return "ADV";
  2601. + case 'P': return "PE";
  2602. + default : return "STD";
  2603. + }
  2604. +}
  2605. +/* <<<<< ADDED D.Fujimoto 2007/10/01 */
  2606. +
  2607. +/* Merge backend specific data from an object file to the output
  2608. + object file when linking. */
  2609. +static boolean
  2610. +c33_elf_merge_private_bfd_data (ibfd, obfd)
  2611. + bfd * ibfd;
  2612. + bfd * obfd;
  2613. +{
  2614. + flagword out_flags;
  2615. + flagword in_flags;
  2616. +
  2617. +/* >>>>> ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
  2618. + unsigned char mode_flag = 0; // STD=0x0, PE='P', ADV='A'
  2619. + static unsigned char initial_mode_flag;
  2620. + static char initial_object_filename[512];
  2621. + static boolean done_once = false;
  2622. +/* <<<<< ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
  2623. +
  2624. + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
  2625. + || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
  2626. + return true;
  2627. +
  2628. + in_flags = elf_elfheader (ibfd)->e_flags;
  2629. + out_flags = elf_elfheader (obfd)->e_flags;
  2630. +
  2631. +/* >>>>> ADDED D.Fujimoto 2007/10/15 link error when input object files are not for C33 */
  2632. + if (elf_elfheader(ibfd)->e_machine != 0) { // 0 will not be checked because of compatibility
  2633. + if (elf_elfheader(ibfd)->e_machine != EM_SE_C33) {
  2634. + fprintf (stderr, "Error: Input object file %s ", bfd_get_filename(ibfd));
  2635. + if (bfd_my_archive(ibfd) != NULL) {
  2636. + fprintf(stderr, "included from %s ", bfd_my_archive(ibfd)->filename);
  2637. + }
  2638. + fprintf(stderr, "is not for C33.\n");
  2639. +
  2640. + xexit(1);
  2641. + }
  2642. + }
  2643. +/* <<<<< ADDED D.Fujimoto 2007/10/15 link error when input object files are not for C33 */
  2644. +
  2645. +/* >>>>> ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
  2646. + // get the flag from the object file
  2647. + mode_flag = (unsigned char) (elf_elfheader(ibfd)->e_flags >> 24);
  2648. +
  2649. + // get initial mode
  2650. + if (!done_once) {
  2651. + initial_mode_flag = mode_flag;
  2652. + strncpy(initial_object_filename, bfd_get_filename(ibfd), 512);
  2653. + done_once = true;
  2654. + }
  2655. +
  2656. + // check mode
  2657. + if (mode_flag != initial_mode_flag) {
  2658. +
  2659. + // show an error and exit without creating executable
  2660. + fprintf(stderr, "Error: Cannot link %s object %s ", c33_elf_get_mode_string(mode_flag), bfd_get_filename(ibfd));
  2661. + if (bfd_my_archive(ibfd) != NULL) {
  2662. + fprintf(stderr, "included from %s ", bfd_my_archive(ibfd)->filename);
  2663. + }
  2664. + fprintf(stderr, "with %s object %s\n", c33_elf_get_mode_string(initial_mode_flag), initial_object_filename);
  2665. + xexit(1);
  2666. +
  2667. + }
  2668. +
  2669. + // set ELF e_flags bit31-28 (e_machine is set in elf.c)
  2670. + elf_elfheader(obfd)->e_flags = initial_mode_flag << 24;
  2671. +/* <<<<< ADDED D.Fujimoto 2007/10/01 link error for mixing core object files */
  2672. +
  2673. + if (! elf_flags_init (obfd))
  2674. + {
  2675. + /* If the input is the default architecture then do not
  2676. + bother setting the flags for the output architecture,
  2677. + instead allow future merges to do this. If no future
  2678. + merges ever set these flags then they will retain their
  2679. + unitialised values, which surprise surprise, correspond
  2680. + to the default values. */
  2681. + if (bfd_get_arch_info (ibfd)->the_default)
  2682. + return true;
  2683. +
  2684. + elf_flags_init (obfd) = true;
  2685. + elf_elfheader (obfd)->e_flags = in_flags;
  2686. +
  2687. + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
  2688. + && bfd_get_arch_info (obfd)->the_default)
  2689. + {
  2690. + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), bfd_get_mach (ibfd));
  2691. + }
  2692. +
  2693. + return true;
  2694. + }
  2695. +
  2696. + /* Check flag compatibility. */
  2697. + if (in_flags == out_flags)
  2698. + return true;
  2699. + return true;
  2700. +}
  2701. +/* Display the flags field */
  2702. +
  2703. +static boolean
  2704. +c33_elf_print_private_bfd_data (abfd, ptr)
  2705. + bfd * abfd;
  2706. + PTR ptr;
  2707. +{
  2708. +
  2709. +
  2710. + BFD_ASSERT (abfd != NULL && ptr != NULL);
  2711. +
  2712. + _bfd_elf_print_private_bfd_data (abfd, ptr);
  2713. + return true;
  2714. +}
  2715. +
  2716. +/* C33 ELF uses four common sections. One is the usual one, and the
  2717. + others are for (small) objects in one of the special data areas:
  2718. + small, tiny and zero. All the objects are kept together, and then
  2719. + referenced via the gp register, the ep register or the r0 register
  2720. + respectively, which yields smaller, faster assembler code. This
  2721. + approach is copied from elf32-mips.c. */
  2722. +/* del tazaki
  2723. +static asection c33_elf_scomm_section;
  2724. +static asymbol c33_elf_scomm_symbol;
  2725. +static asymbol * c33_elf_scomm_symbol_ptr;
  2726. +static asection c33_elf_comm_section;
  2727. +static asymbol c33_elf_comm_symbol;
  2728. +static asymbol * c33_elf_comm_symbol_ptr;
  2729. +static asection c33_elf_lcomm_section;
  2730. +static asymbol c33_elf_lcomm_symbol;
  2731. +static asymbol * c33_elf_lcomm_symbol_ptr;
  2732. +*/
  2733. +static asection c33_elf_comm_section;
  2734. +static asymbol c33_elf_comm_symbol;
  2735. +static asymbol * c33_elf_comm_symbol_ptr;
  2736. +static asection c33_elf_gcomm_section;
  2737. +static asymbol c33_elf_gcomm_symbol;
  2738. +static asymbol * c33_elf_gcomm_symbol_ptr;
  2739. +static asection c33_elf_scomm_section;
  2740. +static asymbol c33_elf_scomm_symbol;
  2741. +static asymbol * c33_elf_scomm_symbol_ptr;
  2742. +static asection c33_elf_tcomm_section;
  2743. +static asymbol c33_elf_tcomm_symbol;
  2744. +static asymbol * c33_elf_tcomm_symbol_ptr;
  2745. +static asection c33_elf_zcomm_section;
  2746. +static asymbol c33_elf_zcomm_symbol;
  2747. +static asymbol * c33_elf_zcomm_symbol_ptr;
  2748. +
  2749. +/* del 2002/07/17 T.Tazaki >>> */
  2750. +#if 0
  2751. +static asection c33_elf_gbss_section;
  2752. +static asymbol c33_elf_gbss_symbol;
  2753. +static asymbol * c33_elf_gbss_symbol_ptr;
  2754. +static asection c33_elf_sbss_section;
  2755. +static asymbol c33_elf_sbss_symbol;
  2756. +static asymbol * c33_elf_sbss_symbol_ptr;
  2757. +static asection c33_elf_tbss_section;
  2758. +static asymbol c33_elf_tbss_symbol;
  2759. +static asymbol * c33_elf_tbss_symbol_ptr;
  2760. +static asection c33_elf_zbss_section;
  2761. +static asymbol c33_elf_zbss_symbol;
  2762. +static asymbol * c33_elf_zbss_symbol_ptr;
  2763. +#endif
  2764. +
  2765. +/* Given a BFD section, try to locate the corresponding ELF section
  2766. + index. */
  2767. +
  2768. +static boolean
  2769. +c33_elf_section_from_bfd_section (abfd, hdr, sec, retval)
  2770. + bfd * abfd ATTRIBUTE_UNUSED;
  2771. + Elf32_Internal_Shdr * hdr ATTRIBUTE_UNUSED;
  2772. + asection * sec;
  2773. + int * retval;
  2774. +{
  2775. + if (strcmp (bfd_get_section_name (abfd, sec), ".comm") == 0)
  2776. + *retval = SHN_C33_COMM;
  2777. + else if (strcmp (bfd_get_section_name (abfd, sec), ".gcomm") == 0)
  2778. + *retval = SHN_C33_GCOMM;
  2779. + else if (strcmp (bfd_get_section_name (abfd, sec), ".scomm") == 0)
  2780. + *retval = SHN_C33_SCOMM;
  2781. + else if (strcmp (bfd_get_section_name (abfd, sec), ".tcomm") == 0)
  2782. + *retval = SHN_C33_TCOMM;
  2783. + else if (strcmp (bfd_get_section_name (abfd, sec), ".zcomm") == 0)
  2784. + *retval = SHN_C33_ZCOMM;
  2785. +/* del 2002/07/17 T.Tazaki >>> */
  2786. +#if 0
  2787. + else if (strcmp (bfd_get_section_name (abfd, sec), ".gbss") == 0)
  2788. + *retval = SHN_C33_GBSS;
  2789. + else if (strcmp (bfd_get_section_name (abfd, sec), ".sbss") == 0)
  2790. + *retval = SHN_C33_SBSS;
  2791. + else if (strcmp (bfd_get_section_name (abfd, sec), ".tbss") == 0)
  2792. + *retval = SHN_C33_TBSS;
  2793. + else if (strcmp (bfd_get_section_name (abfd, sec), ".zbss") == 0)
  2794. + *retval = SHN_C33_ZBSS;
  2795. +#endif
  2796. + else
  2797. + return false;
  2798. +
  2799. +
  2800. + return true;
  2801. +}
  2802. +
  2803. +/* Handle the special c33 section numbers that a symbol may use. */
  2804. +
  2805. +static void
  2806. +c33_elf_symbol_processing (abfd, asym)
  2807. + bfd * abfd;
  2808. + asymbol * asym;
  2809. +{
  2810. + elf_symbol_type * elfsym = (elf_symbol_type *) asym;
  2811. + unsigned short index;
  2812. +
  2813. + index = elfsym->internal_elf_sym.st_shndx;
  2814. +
  2815. + /* If the section index is an "ordinary" index, then it may
  2816. + refer to a c33 specific section created by the assembler.
  2817. + Check the section's type and change the index it matches.
  2818. +
  2819. + FIXME: Should we alter the st_shndx field as well ? */
  2820. + /* Modify tazaki 2001.07.25 */
  2821. +
  2822. + if (index < elf_elfheader(abfd)[0].e_shnum)
  2823. + switch (elf_elfsections(abfd)[index]->sh_type)
  2824. + {
  2825. + case SHT_C33_COMM:
  2826. + index = SHN_C33_COMM;
  2827. + break;
  2828. + case SHT_C33_GCOMM:
  2829. + index = SHN_C33_GCOMM;
  2830. + break;
  2831. + case SHT_C33_SCOMM:
  2832. + index = SHN_C33_SCOMM;
  2833. + break;
  2834. + case SHT_C33_TCOMM:
  2835. + index = SHN_C33_TCOMM;
  2836. + break;
  2837. + case SHT_C33_ZCOMM:
  2838. + index = SHN_C33_ZCOMM;
  2839. + break;
  2840. +/* del 2002/07/17 T.Tazaki >>> */
  2841. +#if 0
  2842. + case SHT_C33_GBSS:
  2843. + index = SHN_C33_GBSS;
  2844. + break;
  2845. + case SHT_C33_SBSS:
  2846. + index = SHN_C33_SBSS;
  2847. + break;
  2848. + case SHT_C33_TBSS:
  2849. + index = SHN_C33_TBSS;
  2850. + break;
  2851. + case SHT_C33_ZBSS:
  2852. + index = SHN_C33_ZBSS;
  2853. + break;
  2854. +#endif
  2855. + default:
  2856. + break;
  2857. + }
  2858. +
  2859. + switch (index)
  2860. + {
  2861. + case SHN_C33_COMM:
  2862. + if (c33_elf_comm_section.name == NULL)
  2863. + {
  2864. + /* Initialize the small common section. */
  2865. + c33_elf_comm_section.name = ".comm";
  2866. + c33_elf_comm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2867. + c33_elf_comm_section.output_section = & c33_elf_comm_section;
  2868. + c33_elf_comm_section.symbol = & c33_elf_comm_symbol;
  2869. + c33_elf_comm_section.symbol_ptr_ptr = & c33_elf_comm_symbol_ptr;
  2870. + c33_elf_comm_symbol.name = ".comm";
  2871. + c33_elf_comm_symbol.flags = BSF_SECTION_SYM;
  2872. + c33_elf_comm_symbol.section = & c33_elf_comm_section;
  2873. + c33_elf_comm_symbol_ptr = & c33_elf_comm_symbol;
  2874. + }
  2875. + asym->section = & c33_elf_comm_section;
  2876. + asym->value = elfsym->internal_elf_sym.st_size;
  2877. + break;
  2878. +
  2879. + case SHN_C33_GCOMM:
  2880. + if (c33_elf_gcomm_section.name == NULL)
  2881. + {
  2882. + /* Initialize the G common section. */
  2883. + c33_elf_gcomm_section.name = ".gcomm";
  2884. + c33_elf_gcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2885. + c33_elf_gcomm_section.output_section = & c33_elf_gcomm_section;
  2886. + c33_elf_gcomm_section.symbol = & c33_elf_gcomm_symbol;
  2887. + c33_elf_gcomm_section.symbol_ptr_ptr = & c33_elf_gcomm_symbol_ptr;
  2888. + c33_elf_gcomm_symbol.name = ".gcomm";
  2889. + c33_elf_gcomm_symbol.flags = BSF_SECTION_SYM;
  2890. + c33_elf_gcomm_symbol.section = & c33_elf_gcomm_section;
  2891. + c33_elf_gcomm_symbol_ptr = & c33_elf_gcomm_symbol;
  2892. + }
  2893. + asym->section = & c33_elf_gcomm_section;
  2894. + asym->value = elfsym->internal_elf_sym.st_size;
  2895. + break;
  2896. +
  2897. + case SHN_C33_SCOMM:
  2898. + if (c33_elf_scomm_section.name == NULL)
  2899. + {
  2900. + /* Initialize S common section. */
  2901. + c33_elf_scomm_section.name = ".scomm";
  2902. + c33_elf_scomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2903. + c33_elf_scomm_section.output_section = & c33_elf_scomm_section;
  2904. + c33_elf_scomm_section.symbol = & c33_elf_scomm_symbol;
  2905. + c33_elf_scomm_section.symbol_ptr_ptr = & c33_elf_scomm_symbol_ptr;
  2906. + c33_elf_scomm_symbol.name = ".scomm";
  2907. + c33_elf_scomm_symbol.flags = BSF_SECTION_SYM;
  2908. + c33_elf_scomm_symbol.section = & c33_elf_scomm_section;
  2909. + c33_elf_scomm_symbol_ptr = & c33_elf_scomm_symbol;
  2910. + }
  2911. + asym->section = & c33_elf_scomm_section;
  2912. + asym->value = elfsym->internal_elf_sym.st_size;
  2913. + break;
  2914. +
  2915. + case SHN_C33_TCOMM:
  2916. + if (c33_elf_tcomm_section.name == NULL)
  2917. + {
  2918. + /* Initialize the T common section. */
  2919. + c33_elf_tcomm_section.name = ".tcomm";
  2920. + c33_elf_tcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2921. + c33_elf_tcomm_section.output_section = & c33_elf_tcomm_section;
  2922. + c33_elf_tcomm_section.symbol = & c33_elf_tcomm_symbol;
  2923. + c33_elf_tcomm_section.symbol_ptr_ptr = & c33_elf_tcomm_symbol_ptr;
  2924. + c33_elf_tcomm_symbol.name = ".tcomm";
  2925. + c33_elf_tcomm_symbol.flags = BSF_SECTION_SYM;
  2926. + c33_elf_tcomm_symbol.section = & c33_elf_tcomm_section;
  2927. + c33_elf_tcomm_symbol_ptr = & c33_elf_tcomm_symbol;
  2928. + }
  2929. + asym->section = & c33_elf_tcomm_section;
  2930. + asym->value = elfsym->internal_elf_sym.st_size;
  2931. + break;
  2932. +
  2933. + case SHN_C33_ZCOMM:
  2934. + if (c33_elf_zcomm_section.name == NULL)
  2935. + {
  2936. + /* Initialize the Z common section. */
  2937. + c33_elf_zcomm_section.name = ".zcomm";
  2938. + c33_elf_zcomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2939. + c33_elf_zcomm_section.output_section = & c33_elf_zcomm_section;
  2940. + c33_elf_zcomm_section.symbol = & c33_elf_zcomm_symbol;
  2941. + c33_elf_zcomm_section.symbol_ptr_ptr = & c33_elf_zcomm_symbol_ptr;
  2942. + c33_elf_zcomm_symbol.name = ".zcomm";
  2943. + c33_elf_zcomm_symbol.flags = BSF_SECTION_SYM;
  2944. + c33_elf_zcomm_symbol.section = & c33_elf_zcomm_section;
  2945. + c33_elf_zcomm_symbol_ptr = & c33_elf_zcomm_symbol;
  2946. + }
  2947. + asym->section = & c33_elf_zcomm_section;
  2948. + asym->value = elfsym->internal_elf_sym.st_size;
  2949. + break;
  2950. +/* del 2002/07/17 T.Tazaki >>> */
  2951. +#if 0
  2952. + case SHN_C33_GBSS:
  2953. + if (c33_elf_gbss_section.name == NULL)
  2954. + {
  2955. + /* Initialize the Local G common section. */
  2956. + c33_elf_gbss_section.name = ".gbss";
  2957. + c33_elf_gbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2958. + c33_elf_gbss_section.output_section = & c33_elf_gbss_section;
  2959. + c33_elf_gbss_section.symbol = & c33_elf_gbss_symbol;
  2960. + c33_elf_gbss_section.symbol_ptr_ptr = & c33_elf_gbss_symbol_ptr;
  2961. + c33_elf_gbss_symbol.name = ".gbss";
  2962. + c33_elf_gbss_symbol.flags = BSF_SECTION_SYM;
  2963. + c33_elf_gbss_symbol.section = & c33_elf_gbss_section;
  2964. + c33_elf_gbss_symbol_ptr = & c33_elf_gbss_symbol;
  2965. + }
  2966. + asym->section = & c33_elf_gbss_section;
  2967. + asym->value = elfsym->internal_elf_sym.st_size;
  2968. + break;
  2969. +
  2970. + case SHN_C33_SBSS:
  2971. + if (c33_elf_sbss_section.name == NULL)
  2972. + {
  2973. + /* Initialize the Local S common section. */
  2974. + c33_elf_sbss_section.name = ".sbss";
  2975. + c33_elf_sbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2976. + c33_elf_sbss_section.output_section = & c33_elf_sbss_section;
  2977. + c33_elf_sbss_section.symbol = & c33_elf_sbss_symbol;
  2978. + c33_elf_sbss_section.symbol_ptr_ptr = & c33_elf_sbss_symbol_ptr;
  2979. + c33_elf_sbss_symbol.name = ".sbss";
  2980. + c33_elf_sbss_symbol.flags = BSF_SECTION_SYM;
  2981. + c33_elf_sbss_symbol.section = & c33_elf_sbss_section;
  2982. + c33_elf_sbss_symbol_ptr = & c33_elf_sbss_symbol;
  2983. + }
  2984. + asym->section = & c33_elf_sbss_section;
  2985. + asym->value = elfsym->internal_elf_sym.st_size;
  2986. + break;
  2987. +
  2988. + case SHN_C33_TBSS:
  2989. + if (c33_elf_tbss_section.name == NULL)
  2990. + {
  2991. + /* Initialize the Local T common section. */
  2992. + c33_elf_tbss_section.name = ".tbss";
  2993. + c33_elf_tbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  2994. + c33_elf_tbss_section.output_section = & c33_elf_tbss_section;
  2995. + c33_elf_tbss_section.symbol = & c33_elf_tbss_symbol;
  2996. + c33_elf_tbss_section.symbol_ptr_ptr = & c33_elf_tbss_symbol_ptr;
  2997. + c33_elf_tbss_symbol.name = ".tbss";
  2998. + c33_elf_tbss_symbol.flags = BSF_SECTION_SYM;
  2999. + c33_elf_tbss_symbol.section = & c33_elf_tbss_section;
  3000. + c33_elf_tbss_symbol_ptr = & c33_elf_tbss_symbol;
  3001. + }
  3002. + asym->section = & c33_elf_tbss_section;
  3003. + asym->value = elfsym->internal_elf_sym.st_size;
  3004. + break;
  3005. +
  3006. + case SHN_C33_ZBSS:
  3007. + if (c33_elf_zbss_section.name == NULL)
  3008. + {
  3009. + /* Initialize the Local Z common section. */
  3010. + c33_elf_zbss_section.name = ".zbss";
  3011. + c33_elf_zbss_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  3012. + c33_elf_zbss_section.output_section = & c33_elf_zbss_section;
  3013. + c33_elf_zbss_section.symbol = & c33_elf_zbss_symbol;
  3014. + c33_elf_zbss_section.symbol_ptr_ptr = & c33_elf_zbss_symbol_ptr;
  3015. + c33_elf_zbss_symbol.name = ".zbss";
  3016. + c33_elf_zbss_symbol.flags = BSF_SECTION_SYM;
  3017. + c33_elf_zbss_symbol.section = & c33_elf_zbss_section;
  3018. + c33_elf_zbss_symbol_ptr = & c33_elf_zbss_symbol;
  3019. + }
  3020. + asym->section = & c33_elf_zbss_section;
  3021. + asym->value = elfsym->internal_elf_sym.st_size;
  3022. + break;
  3023. +#endif
  3024. +
  3025. +/* gp参照用に必要? */
  3026. +/*
  3027. + case SHN_C33_SCOMMON:
  3028. + if (c33_elf_scomm_section.name == NULL)
  3029. + {
  3030. + c33_elf_scomm_section.name = ".scommon";
  3031. + c33_elf_scomm_section.flags = SEC_IS_COMMON | SEC_ALLOC | SEC_DATA;
  3032. + c33_elf_scomm_section.output_section = & c33_elf_scomm_section;
  3033. + c33_elf_scomm_section.symbol = & c33_elf_scomm_symbol;
  3034. + c33_elf_scomm_section.symbol_ptr_ptr = & c33_elf_scomm_symbol_ptr;
  3035. + c33_elf_scomm_symbol.name = ".scommon";
  3036. + c33_elf_scomm_symbol.flags = BSF_SECTION_SYM;
  3037. + c33_elf_scomm_symbol.section = & c33_elf_scomm_section;
  3038. + c33_elf_scomm_symbol_ptr = & c33_elf_scomm_symbol;
  3039. + }
  3040. + asym->section = & c33_elf_scomm_section;
  3041. + asym->value = elfsym->internal_elf_sym.st_size;
  3042. + break;
  3043. +*/
  3044. + }
  3045. +}
  3046. +
  3047. +/* Hook called by the linker routine which adds symbols from an object
  3048. + file. We must handle the special c33 section numbers here. */
  3049. +
  3050. +/*ARGSUSED*/
  3051. +/* Modify tazaki 2001.07.25 */
  3052. +static boolean
  3053. +c33_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
  3054. + bfd * abfd;
  3055. + struct bfd_link_info * info ATTRIBUTE_UNUSED;
  3056. + const Elf_Internal_Sym * sym;
  3057. + const char ** namep ATTRIBUTE_UNUSED;
  3058. + flagword * flagsp ATTRIBUTE_UNUSED;
  3059. + asection ** secp;
  3060. + bfd_vma * valp;
  3061. +{
  3062. + int index = sym->st_shndx;
  3063. +
  3064. + /* If the section index is an "ordinary" index, then it may
  3065. + refer to a c33 specific section created by the assembler.
  3066. + Check the section's type and change the index it matches.
  3067. +
  3068. + FIXME: Should we alter the st_shndx field as well ? */
  3069. +
  3070. + if (index < elf_elfheader(abfd)[0].e_shnum)
  3071. + switch (elf_elfsections(abfd)[index]->sh_type)
  3072. + {
  3073. + /* del tazaki 2001.07.25
  3074. + case SHT_C33_SCOMMON:
  3075. + index = SHN_C33_SCOMMON;
  3076. + break;
  3077. + */
  3078. +/* add tazaki 2001.11.19 >>>>> */
  3079. + case SHT_C33_COMM:
  3080. + index = SHN_C33_COMM;
  3081. + break;
  3082. + case SHT_C33_GCOMM:
  3083. + index = SHN_C33_GCOMM;
  3084. + break;
  3085. + case SHT_C33_SCOMM:
  3086. + index = SHN_C33_SCOMM;
  3087. + break;
  3088. + case SHT_C33_TCOMM:
  3089. + index = SHN_C33_TCOMM;
  3090. + break;
  3091. + case SHT_C33_ZCOMM:
  3092. + index = SHN_C33_ZCOMM;
  3093. + break;
  3094. +/* del 2002/07/17 T.Tazaki >>> */
  3095. +#if 0
  3096. + case SHT_C33_GBSS:
  3097. + index = SHN_C33_GBSS;
  3098. + break;
  3099. + case SHT_C33_SBSS:
  3100. + index = SHN_C33_SBSS;
  3101. + break;
  3102. + case SHT_C33_TBSS:
  3103. + index = SHN_C33_TBSS;
  3104. + break;
  3105. + case SHT_C33_ZBSS:
  3106. + index = SHN_C33_ZBSS;
  3107. + break;
  3108. +#endif
  3109. +/* add tazaki 2001.11.19 <<<<< */
  3110. +
  3111. + default:
  3112. + break;
  3113. + }
  3114. +
  3115. + switch (index)
  3116. + {
  3117. +/* del tazaki 2001.07.25
  3118. + case SHN_C33_SCOMMON:
  3119. + *secp = bfd_make_section_old_way (abfd, ".scommon");
  3120. + (*secp)->flags |= SEC_IS_COMMON;
  3121. + *valp = sym->st_size;
  3122. + break;
  3123. +*/
  3124. +/* add tazaki 2001.11.19 >>>>> */
  3125. + case SHN_C33_COMM:
  3126. + *secp = bfd_make_section_old_way (abfd, ".comm");
  3127. + (*secp)->flags |= SEC_IS_COMMON;
  3128. + *valp = sym->st_size;
  3129. + break;
  3130. +
  3131. + case SHN_C33_GCOMM:
  3132. + *secp = bfd_make_section_old_way (abfd, ".gcomm");
  3133. + (*secp)->flags |= SEC_IS_COMMON;
  3134. + *valp = sym->st_size;
  3135. + break;
  3136. +
  3137. + case SHN_C33_SCOMM:
  3138. + *secp = bfd_make_section_old_way (abfd, ".scomm");
  3139. + (*secp)->flags |= SEC_IS_COMMON;
  3140. + *valp = sym->st_size;
  3141. + break;
  3142. +
  3143. + case SHN_C33_TCOMM:
  3144. + *secp = bfd_make_section_old_way (abfd, ".tcomm");
  3145. + (*secp)->flags |= SEC_IS_COMMON;
  3146. + *valp = sym->st_size;
  3147. + break;
  3148. +
  3149. + case SHN_C33_ZCOMM:
  3150. + *secp = bfd_make_section_old_way (abfd, ".zcomm");
  3151. + (*secp)->flags |= SEC_IS_COMMON;
  3152. + *valp = sym->st_size;
  3153. + break;
  3154. +/* del 2002/07/17 T.Tazaki >>> */
  3155. +#if 0
  3156. + case SHN_C33_GBSS:
  3157. + *secp = bfd_make_section_old_way (abfd, ".gbss");
  3158. + (*secp)->flags |= SEC_IS_COMMON;
  3159. + *valp = sym->st_size;
  3160. + break;
  3161. +
  3162. + case SHN_C33_SBSS:
  3163. + *secp = bfd_make_section_old_way (abfd, ".sbss");
  3164. + (*secp)->flags |= SEC_IS_COMMON;
  3165. + *valp = sym->st_size;
  3166. + break;
  3167. +
  3168. + case SHN_C33_TBSS:
  3169. + *secp = bfd_make_section_old_way (abfd, ".tbss");
  3170. + (*secp)->flags |= SEC_IS_COMMON;
  3171. + *valp = sym->st_size;
  3172. + break;
  3173. +
  3174. + case SHN_C33_ZBSS:
  3175. + *secp = bfd_make_section_old_way (abfd, ".zbss");
  3176. + (*secp)->flags |= SEC_IS_COMMON;
  3177. + *valp = sym->st_size;
  3178. + break;
  3179. +#endif
  3180. +
  3181. +/* add tazaki 2001.11.19 <<<<< */
  3182. + }
  3183. +
  3184. + return true;
  3185. +}
  3186. +
  3187. +/*ARGSIGNORED*/
  3188. +static boolean
  3189. +c33_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
  3190. + bfd * abfd ATTRIBUTE_UNUSED;
  3191. + struct bfd_link_info * info ATTRIBUTE_UNUSED;
  3192. + const char * name ATTRIBUTE_UNUSED;
  3193. + Elf_Internal_Sym * sym;
  3194. + asection * input_sec;
  3195. +{
  3196. + /* If we see a common symbol, which implies a relocatable link, then
  3197. + if a symbol was in a special common section in an input file, mark
  3198. + it as a special common in the output file. */
  3199. +
  3200. + if (sym->st_shndx == SHN_COMMON)
  3201. + {
  3202. + if (strcmp (input_sec->name, ".comm") == 0)
  3203. + sym->st_shndx = SHN_C33_COMM;
  3204. + else if (strcmp (input_sec->name, ".gcomm") == 0)
  3205. + sym->st_shndx = SHN_C33_GCOMM;
  3206. + else if (strcmp (input_sec->name, ".scomm") == 0)
  3207. + sym->st_shndx = SHN_C33_SCOMM;
  3208. + else if (strcmp (input_sec->name, ".tcomm") == 0)
  3209. + sym->st_shndx = SHN_C33_TCOMM;
  3210. + else if (strcmp (input_sec->name, ".zcomm") == 0)
  3211. + sym->st_shndx = SHN_C33_ZCOMM;
  3212. +/* del 2002/07/17 T.Tazaki >>> */
  3213. +#if 0
  3214. + else if (strcmp (input_sec->name, ".gbss") == 0)
  3215. + sym->st_shndx = SHN_C33_GBSS;
  3216. + else if (strcmp (input_sec->name, ".sbss") == 0)
  3217. + sym->st_shndx = SHN_C33_SBSS;
  3218. + else if (strcmp (input_sec->name, ".tbss") == 0)
  3219. + sym->st_shndx = SHN_C33_TBSS;
  3220. + else if (strcmp (input_sec->name, ".zbss") == 0)
  3221. + sym->st_shndx = SHN_C33_ZBSS;
  3222. +#endif
  3223. + }
  3224. +
  3225. + return true;
  3226. +}
  3227. +
  3228. +/* Modify tazaki 2001.07.25 */
  3229. +static boolean
  3230. +c33_elf_section_from_shdr (abfd, hdr, name)
  3231. + bfd * abfd;
  3232. + Elf_Internal_Shdr * hdr;
  3233. + char * name;
  3234. +{
  3235. + /* There ought to be a place to keep ELF backend specific flags, but
  3236. + at the moment there isn't one. We just keep track of the
  3237. + sections by their name, instead. */
  3238. +
  3239. + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name))
  3240. + return false;
  3241. +
  3242. + switch (hdr->sh_type)
  3243. + {
  3244. +/* case SHT_C33_SCOMMON: */
  3245. + case SHT_C33_COMM:
  3246. + case SHT_C33_GCOMM:
  3247. + case SHT_C33_SCOMM:
  3248. + case SHT_C33_TCOMM:
  3249. + case SHT_C33_ZCOMM:
  3250. +/* del 2002/07/17 T.Tazaki >>> */
  3251. +#if 0
  3252. + case SHT_C33_GBSS:
  3253. + case SHT_C33_SBSS:
  3254. + case SHT_C33_TBSS:
  3255. + case SHT_C33_ZBSS:
  3256. +#endif
  3257. + if (! bfd_set_section_flags (abfd, hdr->bfd_section,
  3258. + (bfd_get_section_flags (abfd,
  3259. + hdr->bfd_section)
  3260. + | SEC_IS_COMMON)))
  3261. + return false;
  3262. + }
  3263. +
  3264. + return true;
  3265. +}
  3266. +
  3267. +/* Set the correct type for a C33 ELF section. We do this by the
  3268. + section name, which is a hack, but ought to work. */
  3269. +
  3270. +/* Modify tazaki 2001.11.19 >>>>> */
  3271. +
  3272. +static boolean
  3273. +c33_elf_fake_sections (abfd, hdr, sec)
  3274. + bfd * abfd ATTRIBUTE_UNUSED;
  3275. + Elf32_Internal_Shdr * hdr;
  3276. + asection * sec;
  3277. +{
  3278. + register const char * name;
  3279. +
  3280. + name = bfd_get_section_name (abfd, sec);
  3281. +
  3282. + if (strcmp (name, ".comm") == 0)
  3283. + {
  3284. + hdr->sh_type = SHT_C33_COMM;
  3285. + }
  3286. + else if (strcmp (name, ".gcomm") == 0)
  3287. + {
  3288. + hdr->sh_type = SHT_C33_GCOMM;
  3289. + }
  3290. + else if (strcmp (name, ".scomm") == 0)
  3291. + {
  3292. + hdr->sh_type = SHT_C33_SCOMM;
  3293. + }
  3294. + else if (strcmp (name, ".tcomm") == 0)
  3295. + {
  3296. + hdr->sh_type = SHT_C33_TCOMM;
  3297. + }
  3298. + else if (strcmp (name, ".zcomm") == 0)
  3299. + {
  3300. + hdr->sh_type = SHT_C33_ZCOMM;
  3301. + }
  3302. +/* del 2002/07/17 T.Tazaki >>> */
  3303. +#if 0
  3304. + else if (strcmp (name, ".gbss") == 0)
  3305. + {
  3306. + hdr->sh_type = SHT_C33_GBSS;
  3307. + }
  3308. + else if (strcmp (name, ".sbss") == 0)
  3309. + {
  3310. + hdr->sh_type = SHT_C33_SBSS;
  3311. + }
  3312. + else if (strcmp (name, ".tbss") == 0)
  3313. + {
  3314. + hdr->sh_type = SHT_C33_TBSS;
  3315. + }
  3316. + else if (strcmp (name, ".zbss") == 0)
  3317. + {
  3318. + hdr->sh_type = SHT_C33_ZBSS;
  3319. + }
  3320. +#endif
  3321. +
  3322. + return true;
  3323. +}
  3324. +/* Modify tazaki 2001.11.19 <<<<< */
  3325. +
  3326. +
  3327. +
  3328. +#define TARGET_LITTLE_SYM bfd_elf32_c33_vec
  3329. +#define TARGET_LITTLE_NAME "elf32-c33"
  3330. +#define ELF_ARCH bfd_arch_c33
  3331. +/* >>>>> MODIFIED D.Fujimoto 2007/10/15 machine code */
  3332. +#define ELF_MACHINE_CODE EM_NONE // do not change to EM_SE_C33
  3333. +/* <<<<< MODIFIED D.Fujimoto 2007/10/15 machine code */
  3334. +#define ELF_MAXPAGESIZE 0x1000
  3335. +
  3336. +#define elf_info_to_howto c33_elf_info_to_howto_rela
  3337. +#define elf_info_to_howto_rel c33_elf_info_to_howto_rel
  3338. +
  3339. +#define elf_backend_check_relocs c33_elf_check_relocs
  3340. +#define elf_backend_relocate_section c33_elf_relocate_section
  3341. +
  3342. +#if 0
  3343. +#define elf_backend_object_p c33_elf_object_p
  3344. +#define elf_backend_final_write_processing c33_elf_final_write_processing
  3345. +#endif
  3346. +
  3347. +#define elf_backend_section_from_bfd_section c33_elf_section_from_bfd_section
  3348. +#define elf_backend_symbol_processing c33_elf_symbol_processing
  3349. +#define elf_backend_add_symbol_hook c33_elf_add_symbol_hook
  3350. +#define elf_backend_link_output_symbol_hook c33_elf_link_output_symbol_hook
  3351. +#define elf_backend_section_from_shdr c33_elf_section_from_shdr
  3352. +#define elf_backend_fake_sections c33_elf_fake_sections
  3353. +#define elf_backend_gc_mark_hook c33_elf_gc_mark_hook
  3354. +#define elf_backend_gc_sweep_hook c33_elf_gc_sweep_hook
  3355. +
  3356. +#define elf_backend_can_gc_sections 1
  3357. +
  3358. +
  3359. +#define bfd_elf32_bfd_is_local_label_name c33_elf_is_local_label_name
  3360. +#define bfd_elf32_bfd_reloc_type_lookup c33_elf_reloc_type_lookup
  3361. +#define bfd_elf32_bfd_copy_private_bfd_data c33_elf_copy_private_bfd_data
  3362. +#define bfd_elf32_bfd_merge_private_bfd_data c33_elf_merge_private_bfd_data
  3363. +#define bfd_elf32_bfd_set_private_flags c33_elf_set_private_flags
  3364. +#define bfd_elf32_bfd_print_private_bfd_data c33_elf_print_private_bfd_data
  3365. +
  3366. +/* change leading_char for map file T.Tazaki 2003/12/09 >>> */
  3367. +//#define elf_symbol_leading_char '_'
  3368. +#define elf_symbol_leading_char '#'
  3369. +/* change T.Tazaki 2003/12/09 <<< */
  3370. +
  3371. +#include "elf32-target.h"
  3372. diff --git a/bfd/syms.c b/bfd/syms.c
  3373. index 6546f58..944c73b 100644
  3374. --- a/bfd/syms.c
  3375. +++ b/bfd/syms.c
  3376. @@ -1234,7 +1234,18 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
  3377. case N_BSLINE:
  3378. /* A line number. The value is relative to the start of the
  3379. current function. */
  3380. + /* >>>>> change T.Tazaik 2002/01/29 */
  3381. + /*
  3382. val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
  3383. + */
  3384. + if ( strncmp(
  3385. + ( indexentry->file_name ) + strlen( indexentry->file_name ) - 2 ,
  3386. + ".c", 2 ) == 0 ) {
  3387. + val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
  3388. + } else {
  3389. + val = bfd_get_32 (abfd, stab + VALOFF);
  3390. + }
  3391. + /* <<<<< change T.Tazaik 2002/01/29 */
  3392. if (val <= offset)
  3393. {
  3394. *pline = bfd_get_16 (abfd, stab + DESCOFF);
  3395. diff --git a/bfd/targets.c b/bfd/targets.c
  3396. index 1f2217b..711025e 100644
  3397. --- a/bfd/targets.c
  3398. +++ b/bfd/targets.c
  3399. @@ -539,6 +539,7 @@ extern const bfd_target bfd_elf32_sh_vec;
  3400. extern const bfd_target bfd_elf32_shl_vec;
  3401. extern const bfd_target bfd_elf32_sparc_vec;
  3402. extern const bfd_target bfd_elf32_v850_vec;
  3403. +extern const bfd_target bfd_elf32_c33_vec;
  3404. extern const bfd_target bfd_elf32_fr30_vec;
  3405. extern const bfd_target bfd_elf32_mcore_big_vec;
  3406. extern const bfd_target bfd_elf32_mcore_little_vec;
  3407. diff --git a/binutils/Makefile.am b/binutils/Makefile.am
  3408. index a6eb22a..34fd193 100644
  3409. --- a/binutils/Makefile.am
  3410. +++ b/binutils/Makefile.am
  3411. @@ -474,6 +474,7 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
  3412. $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \
  3413. $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
  3414. $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \
  3415. + $(INCDIR)/elf/c33.h \
  3416. $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \
  3417. $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
  3418. $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
  3419. diff --git a/binutils/Makefile.in b/binutils/Makefile.in
  3420. index f4178de..d947a9b 100644
  3421. --- a/binutils/Makefile.in
  3422. +++ b/binutils/Makefile.in
  3423. @@ -1299,6 +1299,7 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
  3424. $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h \
  3425. $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
  3426. $(INCDIR)/elf/v850.h $(INCDIR)/elf/ppc.h $(INCDIR)/elf/mips.h \
  3427. + $(INCDIR)/elf/c33.h \
  3428. $(INCDIR)/elf/alpha.h $(INCDIR)/elf/arm.h $(INCDIR)/elf/m68k.h \
  3429. $(INCDIR)/elf/sparc.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/d10v.h \
  3430. $(INCDIR)/elf/d30v.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/mn10200.h \
  3431. diff --git a/binutils/objdump.c b/binutils/objdump.c
  3432. index 4832e9d..f972ec3 100644
  3433. --- a/binutils/objdump.c
  3434. +++ b/binutils/objdump.c
  3435. @@ -119,6 +119,9 @@ display_file PARAMS ((char *filename, char *target));
  3436. static void
  3437. dump_section_header PARAMS ((bfd *, asection *, PTR));
  3438. +static int
  3439. +has_debug_sections(bfd *abfd); /* add D.Fujimoto 2006.06.12 */
  3440. +
  3441. static void
  3442. dump_headers PARAMS ((bfd *));
  3443. @@ -343,8 +346,15 @@ dump_section_header (abfd, section, ignored)
  3444. printf_vma (bfd_get_section_vma (abfd, section));
  3445. printf (" ");
  3446. printf_vma (section->lma);
  3447. - printf (" %08lx 2**%u", section->filepos,
  3448. - bfd_get_section_alignment (abfd, section));
  3449. + /* .comm ---> alignment 2**2 fixed add tazaki 2001.11.06 */
  3450. +/* if ( strcmp( bfd_get_section_name (abfd, section),".comm" ) ){ */
  3451. + printf (" %08lx 2**%u", section->filepos,
  3452. + bfd_get_section_alignment (abfd, section));
  3453. +/*
  3454. + }else{
  3455. + printf (" %08lx 2**2", section->filepos );
  3456. + }
  3457. +*/
  3458. if (! wide_output)
  3459. printf ("\n ");
  3460. printf (" ");
  3461. @@ -405,9 +415,34 @@ dump_section_header (abfd, section, ignored)
  3462. }
  3463. printf ("\n");
  3464. +
  3465. #undef PF
  3466. }
  3467. +/* >>>>> check if debugging sections are present add D.Fujimoto 2006.06.12 */
  3468. +static int has_debug_sections(abfd)
  3469. + bfd *abfd ATTRIBUTE_UNUSED;
  3470. +{
  3471. + int ret = 0;
  3472. + const char *section_name;
  3473. + asection *p;
  3474. +
  3475. + for (p = abfd->sections; p != NULL; p = p->next) {
  3476. + section_name = p->name;
  3477. +
  3478. + // search for section names starting with .stab or .comment
  3479. + if (strncmp(section_name, ".stab", sizeof(".stab") - 1) == 0 ||
  3480. + strncmp(section_name, ".comment", sizeof(".comment") - 1) == 0) {
  3481. + ret = 1;
  3482. + break;
  3483. + }
  3484. +
  3485. + }
  3486. +
  3487. + return ret;
  3488. +}
  3489. +/* <<<<< check if debugging sections are present add D.Fujimoto 2006.06.12 */
  3490. +
  3491. static void
  3492. dump_headers (abfd)
  3493. bfd *abfd;
  3494. @@ -425,6 +460,13 @@ dump_headers (abfd)
  3495. printf ("\n");
  3496. bfd_map_over_sections (abfd, dump_section_header, (PTR) NULL);
  3497. +
  3498. + /* >>>>> display message concerning debugging sections add D.Fujimoto 2006.06.12 */
  3499. + if (has_debug_sections(abfd)) {
  3500. + printf ("\n*** Debugging sections will not be loaded to the target ***\n\n");
  3501. + }
  3502. + /* <<<<< display message concerning debugging sections add D.Fujimoto 2006.06.12 */
  3503. +
  3504. }
  3505. static asymbol **
  3506. @@ -1251,6 +1293,9 @@ disassemble_bytes (info, disassemble_fn, insns, data,
  3507. bfd_vma addr_offset;
  3508. int opb = info->octets_per_byte;
  3509. + bfd_byte iData1,iData2; /* add tazaki 2001.07.31 */
  3510. + int iFlag; /* add tazaki 2001.07.31 */
  3511. +
  3512. aux = (struct objdump_disasm_info *) info->application_data;
  3513. section = aux->sec;
  3514. @@ -1334,7 +1379,8 @@ disassemble_bytes (info, disassemble_fn, insns, data,
  3515. *s = ' ';
  3516. if (*s == '\0')
  3517. *--s = '0';
  3518. - printf ("%s:\t", buf + skip_addr_chars);
  3519. +/* printf ("%s:\t", buf + skip_addr_chars); */
  3520. + printf ("%s: ", buf + skip_addr_chars); /* tazaki 2001.11.02 */
  3521. }
  3522. else
  3523. {
  3524. @@ -1411,24 +1457,39 @@ disassemble_bytes (info, disassemble_fn, insns, data,
  3525. else
  3526. bpc = 1;
  3527. - for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
  3528. + iFlag = 0; /* add tazaki 2001.07.31 */
  3529. +
  3530. + for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
  3531. {
  3532. int k;
  3533. +/* del tazaki 2001.07.31 >>>>>
  3534. if (bpc > 1 && info->display_endian == BFD_ENDIAN_LITTLE)
  3535. - {
  3536. + {
  3537. for (k = bpc - 1; k >= 0; k--)
  3538. - printf ("%02x", (unsigned) data[j + k]);
  3539. + printf ("%02x", (unsigned) data[j + k]);
  3540. putchar (' ');
  3541. - }
  3542. - else
  3543. - {
  3544. + }
  3545. + else{
  3546. for (k = 0; k < bpc; k++)
  3547. - printf ("%02x", (unsigned) data[j + k]);
  3548. + printf ("%02x", (unsigned) data[j + k]);
  3549. putchar (' ');
  3550. - }
  3551. + }
  3552. +<<<< del */
  3553. +/* add tazaki 2001.07.31 >>>> */
  3554. + if( iFlag == 0 ){
  3555. + iData2 = data[j + 0];
  3556. + iFlag = 1;
  3557. + }else{
  3558. + iData1 = data[j + 0];
  3559. + iFlag = 0;
  3560. + }
  3561. +/* add <<<< */
  3562. }
  3563. +
  3564. + printf( "%02x%02x",iData1,iData2 ); /* add tazaki 2001.07.31 */
  3565. - for (; pb < octets_per_line; pb += bpc)
  3566. +/* del tazaki 2001.11.06 >>>>>>>>>>>>>
  3567. + for (; pb < octets_per_line; pb += bpc)
  3568. {
  3569. int k;
  3570. @@ -1437,12 +1498,12 @@ disassemble_bytes (info, disassemble_fn, insns, data,
  3571. putchar (' ');
  3572. }
  3573. - /* Separate raw data from instruction by extra space. */
  3574. if (insns)
  3575. - putchar ('\t');
  3576. + putchar ('\t');
  3577. else
  3578. - printf (" ");
  3579. - }
  3580. + printf (" ");
  3581. +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
  3582. + }
  3583. if (! insns)
  3584. printf ("%s", buf);
  3585. @@ -1512,7 +1573,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
  3586. q = **relppp;
  3587. if (wide_output)
  3588. - putchar ('\t');
  3589. + putchar ('\t');
  3590. else
  3591. printf ("\t\t\t");
  3592. diff --git a/binutils/stabs.c b/binutils/stabs.c
  3593. index 5f60035..04031cc 100644
  3594. --- a/binutils/stabs.c
  3595. +++ b/binutils/stabs.c
  3596. @@ -556,6 +556,13 @@ parse_stab (dhandle, handle, type, desc, value, string)
  3597. if (*string == '\0')
  3598. return true;
  3599. + /* >>>>> add T.Tazaki 2002/01/29 */
  3600. + if ( strncmp( string +strlen( string ) - 2 , ".c", 2 )
  3601. + != 0 ){
  3602. + info->function_start_offset = 0x0;
  3603. + }
  3604. + /* <<<<< add T.Tazaki 2002/01/29 */
  3605. +
  3606. /* Just accumulate strings until we see a non N_SO symbol. If
  3607. the string starts with a directory separator or some other
  3608. form of absolute path specification, we discard the previously
  3609. diff --git a/binutils/version.c b/binutils/version.c
  3610. index cb893cf..da274a8 100644
  3611. --- a/binutils/version.c
  3612. +++ b/binutils/version.c
  3613. @@ -21,6 +21,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  3614. #include "bfd.h"
  3615. #include "bucomm.h"
  3616. +#define BINUTILS_REVISION "2.15 <2008/05/22>"
  3617. +
  3618. /* This is the version numbers for the binutils. They all change in
  3619. lockstep -- it's easier that way. */
  3620. @@ -35,7 +37,12 @@ print_version (name)
  3621. {
  3622. /* This output is intended to follow the GNU standards document. */
  3623. /* xgettext:c-format */
  3624. +/* change T.Tazaki 2002.01.31 >>> */
  3625. +/*
  3626. printf ("GNU %s %s\n", name, program_version);
  3627. +*/
  3628. + printf ("GNU %s %s (rev %s)\n", name, program_version, BINUTILS_REVISION);
  3629. +/* change T.Tazaki 2002.01.31 <<< */
  3630. printf (_("Copyright 1997, 98, 99, 2000 Free Software Foundation, Inc.\n"));
  3631. printf (_("\
  3632. This program is free software; you may redistribute it under the terms of\n\
  3633. diff --git a/config.sub b/config.sub
  3634. index 42fc991..884470f 100755
  3635. --- a/config.sub
  3636. +++ b/config.sub
  3637. @@ -218,7 +218,7 @@ case $basic_machine in
  3638. | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
  3639. | mips64vr5000 | miprs64vr5000el | mcore \
  3640. | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
  3641. - | thumb | d10v | d30v | fr30 | avr)
  3642. + | thumb | d10v | d30v | fr30 | c33 | avr )
  3643. basic_machine=$basic_machine-unknown
  3644. ;;
  3645. m6811 | m68hc11 | m6812 | m68hc12)
  3646. @@ -261,7 +261,7 @@ case $basic_machine in
  3647. | mipstx39-* | mipstx39el-* | mcore-* \
  3648. | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
  3649. | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
  3650. - | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
  3651. + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* | c33-* \
  3652. | bs2000-* | tic54x-* | c54x-* | x86_64-*)
  3653. ;;
  3654. # Recognize the various machine names and aliases which stand
  3655. diff --git a/configure.in b/configure.in
  3656. index 8171c53..2ce6d70 100644
  3657. --- a/configure.in
  3658. +++ b/configure.in
  3659. @@ -861,6 +861,9 @@ case "${target}" in
  3660. v850-*-*)
  3661. noconfigdirs="$noconfigdirs target-libgloss"
  3662. ;;
  3663. + c33-*-*)
  3664. + noconfigdirs="$noconfigdirs target-libgloss"
  3665. + ;;
  3666. v850e-*-*)
  3667. noconfigdirs="$noconfigdirs target-libgloss"
  3668. ;;
  3669. diff --git a/gas/Makefile.am b/gas/Makefile.am
  3670. index 49b52f7..136f719 100644
  3671. --- a/gas/Makefile.am
  3672. +++ b/gas/Makefile.am
  3673. @@ -67,6 +67,7 @@ CPU_TYPES = \
  3674. vax \
  3675. w65 \
  3676. v850 \
  3677. + c33 \
  3678. z8k
  3679. # Object format types. This is only used for dependency information.
  3680. @@ -169,7 +170,8 @@ GAS_CFILES = \
  3681. stabs.c \
  3682. subsegs.c \
  3683. symbols.c \
  3684. - write.c
  3685. + write.c \
  3686. + ext_remove.c
  3687. CFILES = $(GAS_CFILES) gasp.c itbl-ops.c
  3688. @@ -199,7 +201,8 @@ HFILES = \
  3689. subsegs.h \
  3690. symbols.h \
  3691. tc.h \
  3692. - write.h
  3693. + write.h \
  3694. + ext_remove.h
  3695. # CPU files in config.
  3696. @@ -237,6 +240,7 @@ TARGET_CPU_CFILES = \
  3697. config/tc-vax.c \
  3698. config/tc-w65.c \
  3699. config/tc-v850.c \
  3700. + config/tc-c33.c \
  3701. config/tc-z8k.c
  3702. TARGET_CPU_HFILES = \
  3703. @@ -273,6 +277,7 @@ TARGET_CPU_HFILES = \
  3704. config/tc-vax.h \
  3705. config/tc-w65.h \
  3706. config/tc-v850.h \
  3707. + config/tc-c33.h \
  3708. config/tc-z8k.h
  3709. # OBJ files in config
  3710. @@ -378,7 +383,9 @@ GENERIC_OBJS = \
  3711. ecoff.o \
  3712. stabs.o \
  3713. sb.o \
  3714. - macro.o
  3715. + macro.o \
  3716. + ext_remove.o
  3717. +
  3718. OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
  3719. @@ -1291,6 +1298,10 @@ DEPTC_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3720. $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3721. $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
  3722. emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
  3723. +DEPTC_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3724. + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3725. + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
  3726. + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/c33.h
  3727. DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/bin-bugs.h \
  3728. $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
  3729. $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
  3730. @@ -1632,6 +1643,10 @@ DEPOBJ_z8k_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3731. $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3732. $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-z8k.h \
  3733. emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
  3734. +DEPOBJ_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3735. + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3736. + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
  3737. + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
  3738. DEPOBJ_hppa_som = $(srcdir)/config/obj-som.h subsegs.h \
  3739. $(INCDIR)/obstack.h $(BFDDIR)/libhppa.h $(BFDDIR)/som.h \
  3740. $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
  3741. @@ -1849,6 +1864,9 @@ DEP_v850_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-v850.h \
  3742. DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
  3743. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  3744. $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h
  3745. +DEP_c33_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
  3746. + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  3747. + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h
  3748. DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
  3749. $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
  3750. $(INCDIR)/bfdlink.h
  3751. diff --git a/gas/Makefile.in b/gas/Makefile.in
  3752. index 569b98e..4dd7c89 100644
  3753. --- a/gas/Makefile.in
  3754. +++ b/gas/Makefile.in
  3755. @@ -171,6 +171,7 @@ CPU_TYPES = \
  3756. vax \
  3757. w65 \
  3758. v850 \
  3759. + c33 \
  3760. z8k
  3761. @@ -277,7 +278,8 @@ GAS_CFILES = \
  3762. stabs.c \
  3763. subsegs.c \
  3764. symbols.c \
  3765. - write.c
  3766. + write.c \
  3767. + ext_remove.c
  3768. CFILES = $(GAS_CFILES) gasp.c itbl-ops.c
  3769. @@ -308,7 +310,8 @@ HFILES = \
  3770. subsegs.h \
  3771. symbols.h \
  3772. tc.h \
  3773. - write.h
  3774. + write.h \
  3775. + ext_remove.h
  3776. # CPU files in config.
  3777. @@ -347,6 +350,7 @@ TARGET_CPU_CFILES = \
  3778. config/tc-vax.c \
  3779. config/tc-w65.c \
  3780. config/tc-v850.c \
  3781. + config/tc-c33.c \
  3782. config/tc-z8k.c
  3783. @@ -384,6 +388,7 @@ TARGET_CPU_HFILES = \
  3784. config/tc-vax.h \
  3785. config/tc-w65.h \
  3786. config/tc-v850.h \
  3787. + config/tc-c33.h \
  3788. config/tc-z8k.h
  3789. @@ -466,7 +471,6 @@ CONFIG_OBJS = \
  3790. $(ATOF_TARG_O) \
  3791. $(extra_objects)
  3792. -
  3793. GENERIC_OBJS = \
  3794. app.o \
  3795. as.o \
  3796. @@ -495,7 +499,8 @@ GENERIC_OBJS = \
  3797. ecoff.o \
  3798. stabs.o \
  3799. sb.o \
  3800. - macro.o
  3801. + macro.o \
  3802. + ext_remove.o
  3803. OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
  3804. @@ -1034,6 +1039,11 @@ DEPTC_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3805. $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
  3806. emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/v850.h
  3807. +DEPTC_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3808. + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3809. + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
  3810. + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/opcode/c33.h
  3811. +
  3812. DEPTC_z8k_coff = $(srcdir)/../opcodes/z8k-opc.h $(INCDIR)/bin-bugs.h \
  3813. $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
  3814. $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
  3815. @@ -1454,6 +1464,11 @@ DEPOBJ_v850_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3816. $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h \
  3817. emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
  3818. +DEPOBJ_c33_elf = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-elf.h \
  3819. + $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
  3820. + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h \
  3821. + emul.h subsegs.h $(INCDIR)/obstack.h $(INCDIR)/aout/aout64.h
  3822. +
  3823. DEPOBJ_z8k_coff = $(INCDIR)/bin-bugs.h $(srcdir)/config/obj-coff.h \
  3824. $(srcdir)/config/tc-z8k.h $(INCDIR)/coff/internal.h \
  3825. $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
  3826. @@ -1764,6 +1779,10 @@ DEP_v850_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
  3827. $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  3828. $(INCDIR)/bfdlink.h $(srcdir)/config/tc-v850.h
  3829. +DEP_c33_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
  3830. + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
  3831. + $(INCDIR)/bfdlink.h $(srcdir)/config/tc-c33.h
  3832. +
  3833. DEP_z8k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-z8k.h \
  3834. $(INCDIR)/coff/internal.h $(INCDIR)/coff/z8k.h $(BFDDIR)/libcoff.h \
  3835. $(INCDIR)/bfdlink.h
  3836. @@ -1795,11 +1814,12 @@ itbl_test_OBJECTS = itbl-parse.o itbl-lex.o
  3837. itbl_test_DEPENDENCIES = itbl-tops.o itbl-test.o \
  3838. ../libiberty/libiberty.a
  3839. itbl_test_LDFLAGS =
  3840. +
  3841. as_new_OBJECTS = app.o as.o atof-generic.o bignum-copy.o cond.o \
  3842. depend.o dwarf2dbg.o ecoff.o ehopt.o expr.o flonum-copy.o \
  3843. flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o \
  3844. listing.o literal.o macro.o messages.o output-file.o read.o sb.o \
  3845. -stabs.o subsegs.o symbols.o write.o
  3846. +stabs.o subsegs.o symbols.o write.o ext_remove.o
  3847. as_new_LDFLAGS =
  3848. gasp_new_OBJECTS = gasp.o macro.o sb.o hash.o
  3849. gasp_new_LDFLAGS =
  3850. @@ -2668,6 +2688,7 @@ e-mipsecoff.o: $(srcdir)/config/e-mipsecoff.c $(INCDIR)/bin-bugs.h \
  3851. emul.h emul-target.h
  3852. e-mipself.o: $(srcdir)/config/e-mipself.c $(INCDIR)/bin-bugs.h \
  3853. emul.h emul-target.h
  3854. +ext_remove.o: ext_remove.c ext_remove.h
  3855. $(OBJS): $(DEP_@target_cpu_type@_@obj_format@)
  3856. $(TARG_CPU_O): $(DEPTC_@target_cpu_type@_@obj_format@)
  3857. $(OBJ_FORMAT_O): $(DEPOBJ_@target_cpu_type@_@obj_format@)
  3858. diff --git a/gas/as.c b/gas/as.c
  3859. index f02c42a..6ddea62 100644
  3860. --- a/gas/as.c
  3861. +++ b/gas/as.c
  3862. @@ -1,5 +1,5 @@
  3863. /* as.c - GAS main program.
  3864. - Copyright (C) 1987, 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
  3865. + Copyright (C) 1987, 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
  3866. Free Software Foundation, Inc.
  3867. This file is part of GAS, the GNU Assembler.
  3868. @@ -26,16 +26,22 @@
  3869. * are shared.
  3870. *
  3871. *
  3872. - * bugs
  3873. + * bugs
  3874. *
  3875. * : initialisers
  3876. - * Since no-one else says they will support them in future: I
  3877. + * Since no-one else says they will support them in future: I
  3878. * don't support them now.
  3879. *
  3880. */
  3881. #include "ansidecl.h"
  3882. +#define C33_AS_REVISION "2.15 <2008/05/22>"
  3883. +
  3884. +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  3885. +//#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor add T.Tazaki 2003/05/14*/
  3886. +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  3887. +
  3888. #define COMMON
  3889. #include "as.h"
  3890. @@ -43,6 +49,7 @@
  3891. #include "output-file.h"
  3892. #include "sb.h"
  3893. #include "macro.h"
  3894. +#include "ext_remove.h" // add D.Fujimoto 2007/02/28
  3895. #ifdef HAVE_ITBL_CPU
  3896. #include "itbl-ops.h"
  3897. @@ -63,9 +70,13 @@ static void dump_statistics PARAMS ((void));
  3898. static void perform_an_assembly_pass PARAMS ((int argc, char **argv));
  3899. static int macro_expr PARAMS ((const char *, int, sb *, int *));
  3900. -int listing; /* true if a listing is wanted */
  3901. +int listing; /* true if a listing is wanted */
  3902. -static char *listing_filename = NULL; /* Name of listing file. */
  3903. +/* add T.Tazaki 2002.04.26 >>> */
  3904. +int g_listing = 0;
  3905. +/* add T.Tazaki 2002.04.26 <<< */
  3906. +
  3907. +static char *listing_filename = NULL; /* Name of listing file. */
  3908. /* Type of debugging to generate. */
  3909. @@ -75,7 +86,7 @@ enum debug_info_type debug_type = DEBUG_NONE;
  3910. int max_macro_nest = 100;
  3911. -char *myname; /* argv[0] */
  3912. +char *myname; /* argv[0] */
  3913. #ifdef BFD_ASSEMBLER
  3914. segT reg_section, expr_section;
  3915. segT text_section, data_section, bss_section;
  3916. @@ -157,10 +168,10 @@ select_emulation_mode (argc, argv)
  3917. if (em)
  3918. {
  3919. for (i = 0; i < n_emulations; i++)
  3920. - if (!strcmp (emulations[i]->name, em))
  3921. - break;
  3922. + if (!strcmp (emulations[i]->name, em))
  3923. + break;
  3924. if (i == n_emulations)
  3925. - as_fatal (_("unrecognized emulation name `%s'"), em);
  3926. + as_fatal (_("unrecognized emulation name `%s'"), em);
  3927. this_emulation = emulations[i];
  3928. }
  3929. else
  3930. @@ -190,10 +201,10 @@ common_emul_init ()
  3931. if (this_emulation->fake_label_name == 0)
  3932. {
  3933. if (this_emulation->leading_underscore)
  3934. - this_emulation->fake_label_name = "L0\001";
  3935. + this_emulation->fake_label_name = "L0\001";
  3936. else
  3937. - /* What other parameters should we test? */
  3938. - this_emulation->fake_label_name = ".L0\001";
  3939. + /* What other parameters should we test? */
  3940. + this_emulation->fake_label_name = ".L0\001";
  3941. }
  3942. }
  3943. #endif
  3944. @@ -207,8 +218,14 @@ print_version_id ()
  3945. printed = 1;
  3946. #ifdef BFD_ASSEMBLER
  3947. +/* change T.Tazaki 2002.01.31 >>> */
  3948. +/*
  3949. fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s"),
  3950. - VERSION, TARGET_ALIAS, BFD_VERSION);
  3951. + VERSION, TARGET_ALIAS, BFD_VERSION);
  3952. +*/
  3953. + fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s(rev %s)"),
  3954. + VERSION, TARGET_ALIAS, BFD_VERSION, C33_AS_REVISION);
  3955. +/* change T.Tazaki 2002.01.31 <<< */
  3956. #else
  3957. fprintf (stderr, _("GNU assembler version %s (%s)"), VERSION, TARGET_ALIAS);
  3958. #endif
  3959. @@ -223,17 +240,17 @@ show_usage (stream)
  3960. fprintf (stream, _("\
  3961. Options:\n\
  3962. - -a[sub-option...] turn on listings\n\
  3963. - Sub-options [default hls]:\n\
  3964. - c omit false conditionals\n\
  3965. - d omit debugging directives\n\
  3966. - h include high-level source\n\
  3967. - l include assembly\n\
  3968. - m include macro expansions\n\
  3969. - n omit forms processing\n\
  3970. - s include symbols\n\
  3971. - L include line debug statistics (if applicable)\n\
  3972. - =FILE list to FILE (must be last sub-option)\n"));
  3973. + -a[sub-option...] turn on listings\n\
  3974. + Sub-options [default hls]:\n\
  3975. + c omit false conditionals\n\
  3976. + d omit debugging directives\n\
  3977. + h include high-level source\n\
  3978. + l include assembly\n\
  3979. + m include macro expansions\n\
  3980. + n omit forms processing\n\
  3981. + s include symbols\n\
  3982. + L include line debug statistics (if applicable)\n\
  3983. + =FILE list to FILE (must be last sub-option)\n"));
  3984. fprintf (stream, _("\
  3985. -D produce assembler debugging messages\n"));
  3986. @@ -320,6 +337,26 @@ Options:\n\
  3987. --listing-cont-lines set the maximum number of continuation lines used\n\
  3988. for the output data column of the listing\n"));
  3989. +/* add 2002.01.25 >>>> */
  3990. +
  3991. + fprintf (stream, _("\
  3992. + -mc33adv set advanced macro assemble mode\n"));
  3993. +
  3994. +/* add 2002.01.25 <<<< */
  3995. +
  3996. +/* add T.Tazaki 2003/11/18 >>>> */
  3997. +
  3998. + fprintf (stream, _("\
  3999. + -mc33pe set PE macro assemble mode\n"));
  4000. +
  4001. +/* add T.Tazaki 2003/11/18 <<<< */
  4002. +
  4003. +
  4004. +// ADD D.Fujimoto usage for -mc33_ext option 2007/02/28 >>>>>>>
  4005. + fprintf (stream, _("\
  4006. + -mc33_ext optimize ext code\n"));
  4007. +// ADD D.Fujimoto usage for -mc33_ext option 2007/02/28 <<<<<<<
  4008. +
  4009. md_show_usage (stream);
  4010. fputc ('\n', stream);
  4011. @@ -337,6 +374,19 @@ Options:\n\
  4012. * md_parse_option definitions in config/tc-*.c
  4013. */
  4014. +/* >>>>>>> add tazaki 2001.11.02 */
  4015. +int g_iAdvance = 0; /* 0=STANDARD Architecture Mode */
  4016. + /* 1=Advanced Architecture Mode */
  4017. +/* <<<<<<< add tazaki 2001.11.02 */
  4018. +
  4019. +/* add T.Tazaki 2003/11/18 >>> */
  4020. +int g_iPE = 0; /* 1=PE Architecture Mode */
  4021. +/* add T.Tazaki 2003/11/18 <<< */
  4022. +/* add T.Tazaki 2004/07/30 >>> */
  4023. +int g_iMedda32 = 0; /* 1= No use default data area Mode */
  4024. +/* add T.Tazaki 2004/07/30 <<< */
  4025. +
  4026. +
  4027. static void
  4028. parse_args (pargc, pargv)
  4029. int *pargc;
  4030. @@ -345,6 +395,14 @@ parse_args (pargc, pargv)
  4031. int old_argc, new_argc;
  4032. char **old_argv, **new_argv;
  4033. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  4034. + int flag_plural_src = 0; // specified plural source files
  4035. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  4036. +// ADD D.Fujimoto 2008/01/07 >>>>>>>
  4037. + int check_all_dump_flg = 0; // flag whether to check the all objects' dump file
  4038. + int i_len;
  4039. +// ADD D.Fujimoto 2008/01/07 <<<<<<<
  4040. +
  4041. /* Starting the short option string with '-' is for programs that
  4042. expect options and other ARGV-elements in any order and that care about
  4043. the ordering of the two. We describe each non-option ARGV-element
  4044. @@ -422,7 +480,32 @@ parse_args (pargc, pargv)
  4045. #define OPTION_WARN (OPTION_STD_BASE + 18)
  4046. {"warn", no_argument, NULL, OPTION_WARN},
  4047. #define OPTION_WARN_FATAL (OPTION_STD_BASE + 19)
  4048. - {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
  4049. + {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
  4050. +
  4051. +/* add tazaki 2001.12.11 Avdanced Option >>>>>> */
  4052. +
  4053. +#define OPTION_ADVANCE (OPTION_STD_BASE + 20)
  4054. + {"mc33adv", no_argument, NULL, OPTION_ADVANCE},
  4055. +
  4056. +/* <<<<<<<< add tazaki 2001.12.11 */
  4057. +/* add T.Tazaki 2003/11/18 PE Option >>>>>> */
  4058. +
  4059. +#define OPTION_PE (OPTION_STD_BASE + 21)
  4060. + {"mc33pe", no_argument, NULL, OPTION_PE},
  4061. +
  4062. +/* <<<<<<<< add T.Tazaki 2003/11/18 */
  4063. +
  4064. +/* -medda32 add T.Tazaki 2004/07/30 >>> */
  4065. +#define OPTION_MEDDA32 (OPTION_STD_BASE + 22)
  4066. + {"medda32", no_argument, NULL, OPTION_MEDDA32},
  4067. +/* -medda32 add T.Tazaki 2004/07/30 <<< */
  4068. +
  4069. +// ADD D.Fujimoto mc33_ext option 2007/03/01 >>>>>>>
  4070. +#define OPTION_C33_EXT (OPTION_STD_BASE + 23)
  4071. + {"mc33_ext", required_argument, NULL, OPTION_C33_EXT}
  4072. +// ADD D.Fujimoto mc33_ext option 2007/03/01 <<<<<<<
  4073. +
  4074. +
  4075. };
  4076. /* Construct the option lists from the standard list and the
  4077. @@ -431,7 +514,7 @@ parse_args (pargc, pargv)
  4078. longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
  4079. memcpy (longopts, std_longopts, sizeof (std_longopts));
  4080. memcpy ((char *) longopts + sizeof (std_longopts),
  4081. - md_longopts, md_longopts_size);
  4082. + md_longopts, md_longopts_size);
  4083. /* Make a local copy of the old argv. */
  4084. old_argc = *pargc;
  4085. @@ -446,300 +529,381 @@ parse_args (pargc, pargv)
  4086. while (1)
  4087. {
  4088. /* getopt_long_only is like getopt_long, but '-' as well as '--' can
  4089. - indicate a long option. */
  4090. + indicate a long option. */
  4091. int longind;
  4092. int optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,
  4093. - &longind);
  4094. + &longind);
  4095. +
  4096. +// ADD D.Fujimoto 2008/01/07 >>>>>>>
  4097. + // check the all objects' dump file from command line
  4098. + if( check_all_dump_flg == 1 ){
  4099. + check_all_dump_flg = 0;
  4100. +
  4101. + // save the dump file name
  4102. + if( optarg == 0 ){
  4103. + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n") );
  4104. + xexit (EXIT_FAILURE);
  4105. + } else {
  4106. + i_len = strlen( optarg );
  4107. + if( 0 == memcmp( ".dump",&(optarg[i_len-5]),5 ) ){
  4108. + cp_All_Dump_File_Name = optarg;
  4109. + optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,&longind);
  4110. + } else {
  4111. + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n") );
  4112. + xexit (EXIT_FAILURE);
  4113. + }
  4114. + }
  4115. + }
  4116. +// ADD D.Fujimoto 2008/01/07 <<<<<<<
  4117. +
  4118. if (optc == -1)
  4119. - break;
  4120. + break;
  4121. switch (optc)
  4122. - {
  4123. - default:
  4124. - /* md_parse_option should return 1 if it recognizes optc,
  4125. - 0 if not. */
  4126. - if (md_parse_option (optc, optarg) != 0)
  4127. - break;
  4128. - /* `-v' isn't included in the general short_opts list, so check for
  4129. - it explicity here before deciding we've gotten a bad argument. */
  4130. - if (optc == 'v')
  4131. - {
  4132. + {
  4133. + default:
  4134. + /* md_parse_option should return 1 if it recognizes optc,
  4135. + 0 if not. */
  4136. + if (md_parse_option (optc, optarg) != 0)
  4137. + break;
  4138. + /* `-v' isn't included in the general short_opts list, so check for
  4139. + it explicity here before deciding we've gotten a bad argument. */
  4140. + if (optc == 'v')
  4141. + {
  4142. #ifdef VMS
  4143. - /* Telling getopt to treat -v's value as optional can result
  4144. - in it picking up a following filename argument here. The
  4145. - VMS code in md_parse_option can return 0 in that case,
  4146. - but it has no way of pushing the filename argument back. */
  4147. - if (optarg && *optarg)
  4148. - new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
  4149. - else
  4150. + /* Telling getopt to treat -v's value as optional can result
  4151. + in it picking up a following filename argument here. The
  4152. + VMS code in md_parse_option can return 0 in that case,
  4153. + but it has no way of pushing the filename argument back. */
  4154. + if (optarg && *optarg)
  4155. + new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
  4156. + else
  4157. #else
  4158. - case 'v':
  4159. + case 'v':
  4160. #endif
  4161. - case OPTION_VERBOSE:
  4162. - print_version_id ();
  4163. - break;
  4164. - }
  4165. - /*FALLTHRU*/
  4166. -
  4167. - case '?':
  4168. - exit (EXIT_FAILURE);
  4169. -
  4170. - case 1: /* File name. */
  4171. - if (!strcmp (optarg, "-"))
  4172. - optarg = "";
  4173. - new_argv[new_argc++] = optarg;
  4174. - new_argv[new_argc] = NULL;
  4175. - break;
  4176. -
  4177. - case OPTION_HELP:
  4178. - show_usage (stdout);
  4179. - exit (EXIT_SUCCESS);
  4180. -
  4181. - case OPTION_NOCPP:
  4182. - break;
  4183. -
  4184. - case OPTION_STATISTICS:
  4185. - flag_print_statistics = 1;
  4186. - break;
  4187. -
  4188. - case OPTION_STRIP_LOCAL_ABSOLUTE:
  4189. - flag_strip_local_absolute = 1;
  4190. - break;
  4191. -
  4192. - case OPTION_TRADITIONAL_FORMAT:
  4193. - flag_traditional_format = 1;
  4194. - break;
  4195. -
  4196. - case OPTION_VERSION:
  4197. - /* This output is intended to follow the GNU standards document. */
  4198. - printf (_("GNU assembler %s\n"), VERSION);
  4199. - printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
  4200. - printf (_("\
  4201. + case OPTION_VERBOSE:
  4202. + print_version_id ();
  4203. + break;
  4204. + }
  4205. + /*FALLTHRU*/
  4206. +
  4207. + case '?':
  4208. + exit (EXIT_FAILURE);
  4209. +
  4210. + case 1: /* File name. */
  4211. + if (!strcmp (optarg, "-"))
  4212. + optarg = "";
  4213. + new_argv[new_argc++] = optarg;
  4214. + new_argv[new_argc] = NULL;
  4215. +
  4216. +
  4217. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  4218. +#ifdef EXT_REMOVE
  4219. + // save the source file name
  4220. + if( cp_Current_File_Name == 0 ){
  4221. + cp_Current_File_Name = xstrdup(optarg);
  4222. + } else {
  4223. + flag_plural_src = 1;
  4224. + }
  4225. +#endif
  4226. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  4227. +
  4228. + break;
  4229. +
  4230. +/* add tazaki 2001.11.02 Avdanced Option >>>>>> */
  4231. + case OPTION_ADVANCE:
  4232. + g_iAdvance = 1;
  4233. + break;
  4234. +
  4235. +/* add tazaki 2001.11.02 Avdanced Option <<<<<< */
  4236. +
  4237. +/* add T.Tazaki 2003/11/18 PE Option >>>>>> */
  4238. + case OPTION_PE:
  4239. + g_iPE = 1;
  4240. + break;
  4241. +
  4242. +/* add T.Tazaki 2003/11/18 PE Option <<<<<< */
  4243. +/* add T.Tazaki 2004/07/30 -medda32 Option >>> */
  4244. + case OPTION_MEDDA32:
  4245. + g_iMedda32 = 1;
  4246. + break;
  4247. +
  4248. +/* add T.Tazaki 2004/07/30 -medda32 Option <<< */
  4249. +
  4250. +// ADD D.Fujimoto check mc33_ext argument file 2007/06/25 >>>>>>>
  4251. +#ifdef EXT_REMOVE
  4252. + case OPTION_C33_EXT:
  4253. + if( optarg != NULL ){
  4254. + int i_len = strlen( optarg );
  4255. + if( 0 != memcmp( ".dump",&(optarg[i_len-5]),5 ) ){
  4256. + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
  4257. + xexit (EXIT_FAILURE);
  4258. + } else {
  4259. + cp_Dump_File_Name = xstrdup(optarg);
  4260. +// ADD D.Fujimoto 2008/01/07 >>>>>>>
  4261. + check_all_dump_flg = 1;
  4262. +// ADD D.Fujimoto 2008/01/07 <<<<<<<
  4263. + }
  4264. + } else {
  4265. + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
  4266. + xexit (EXIT_FAILURE);
  4267. + }
  4268. + break;
  4269. +#endif
  4270. +// ADD D.Fujimoto check mc33_ext argument file 2007/06/25 <<<<<<<
  4271. +
  4272. + case OPTION_HELP:
  4273. + show_usage (stdout);
  4274. + exit (EXIT_SUCCESS);
  4275. +
  4276. + case OPTION_NOCPP:
  4277. + break;
  4278. +
  4279. + case OPTION_STATISTICS:
  4280. + flag_print_statistics = 1;
  4281. + break;
  4282. +
  4283. + case OPTION_STRIP_LOCAL_ABSOLUTE:
  4284. + flag_strip_local_absolute = 1;
  4285. + break;
  4286. +
  4287. + case OPTION_TRADITIONAL_FORMAT:
  4288. + flag_traditional_format = 1;
  4289. + break;
  4290. +
  4291. + case OPTION_VERSION:
  4292. + /* This output is intended to follow the GNU standards document. */
  4293. + printf (_("GNU assembler %s\n"), VERSION);
  4294. + printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
  4295. + printf (_("\
  4296. This program is free software; you may redistribute it under the terms of\n\
  4297. the GNU General Public License. This program has absolutely no warranty.\n"));
  4298. - printf (_("This assembler was configured for a target of `%s'.\n"),
  4299. - TARGET_ALIAS);
  4300. - exit (EXIT_SUCCESS);
  4301. + printf (_("This assembler was configured for a target of `%s'.\n"),
  4302. + TARGET_ALIAS);
  4303. + exit (EXIT_SUCCESS);
  4304. - case OPTION_EMULATION:
  4305. + case OPTION_EMULATION:
  4306. #ifdef USE_EMULATIONS
  4307. - if (strcmp (optarg, this_emulation->name))
  4308. - as_fatal (_("multiple emulation names specified"));
  4309. + if (strcmp (optarg, this_emulation->name))
  4310. + as_fatal (_("multiple emulation names specified"));
  4311. #else
  4312. - as_fatal (_("emulations not handled in this configuration"));
  4313. + as_fatal (_("emulations not handled in this configuration"));
  4314. #endif
  4315. - break;
  4316. + break;
  4317. - case OPTION_DUMPCONFIG:
  4318. - fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
  4319. - fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
  4320. - fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
  4321. + case OPTION_DUMPCONFIG:
  4322. + fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
  4323. + fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
  4324. + fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
  4325. #ifdef TARGET_OBJ_FORMAT
  4326. - fprintf (stderr, _("format = %s\n"), TARGET_OBJ_FORMAT);
  4327. + fprintf (stderr, _("format = %s\n"), TARGET_OBJ_FORMAT);
  4328. #endif
  4329. #ifdef TARGET_FORMAT
  4330. - fprintf (stderr, _("bfd-target = %s\n"), TARGET_FORMAT);
  4331. + fprintf (stderr, _("bfd-target = %s\n"), TARGET_FORMAT);
  4332. #endif
  4333. - exit (EXIT_SUCCESS);
  4334. -
  4335. - case OPTION_DEFSYM:
  4336. - {
  4337. - char *s;
  4338. - long i;
  4339. - struct defsym_list *n;
  4340. -
  4341. - for (s = optarg; *s != '\0' && *s != '='; s++)
  4342. - ;
  4343. - if (*s == '\0')
  4344. - as_fatal (_("bad defsym; format is --defsym name=value"));
  4345. - *s++ = '\0';
  4346. - i = strtol (s, (char **) NULL, 0);
  4347. - n = (struct defsym_list *) xmalloc (sizeof *n);
  4348. - n->next = defsyms;
  4349. - n->name = optarg;
  4350. - n->value = i;
  4351. - defsyms = n;
  4352. - }
  4353. - break;
  4354. -
  4355. - case OPTION_INSTTBL:
  4356. - case 't':
  4357. - {
  4358. - /* optarg is the name of the file containing the instruction
  4359. - formats, opcodes, register names, etc. */
  4360. - struct itbl_file_list *n;
  4361. -
  4362. - if (optarg == NULL)
  4363. - {
  4364. - as_warn ( _("No file name following -t option\n") );
  4365. - break;
  4366. - }
  4367. -
  4368. - n = (struct itbl_file_list *) xmalloc (sizeof *n);
  4369. - n->next = itbl_files;
  4370. - n->name = optarg;
  4371. - itbl_files = n;
  4372. -
  4373. - /* Parse the file and add the new instructions to our internal
  4374. - table. If multiple instruction tables are specified, the
  4375. - information from this table gets appended onto the existing
  4376. - internal table. */
  4377. - itbl_files->name = xstrdup (optarg);
  4378. - if (itbl_parse (itbl_files->name) != 0)
  4379. - {
  4380. - fprintf (stderr, _("Failed to read instruction table %s\n"),
  4381. - itbl_files->name);
  4382. - exit (EXIT_SUCCESS);
  4383. - }
  4384. - }
  4385. - break;
  4386. + exit (EXIT_SUCCESS);
  4387. +
  4388. + case OPTION_DEFSYM:
  4389. + {
  4390. + char *s;
  4391. + long i;
  4392. + struct defsym_list *n;
  4393. +
  4394. + for (s = optarg; *s != '\0' && *s != '='; s++)
  4395. + ;
  4396. + if (*s == '\0')
  4397. + as_fatal (_("bad defsym; format is --defsym name=value"));
  4398. + *s++ = '\0';
  4399. + i = strtol (s, (char **) NULL, 0);
  4400. + n = (struct defsym_list *) xmalloc (sizeof *n);
  4401. + n->next = defsyms;
  4402. + n->name = optarg;
  4403. + n->value = i;
  4404. + defsyms = n;
  4405. + }
  4406. + break;
  4407. - case OPTION_DEPFILE:
  4408. - start_dependencies (optarg);
  4409. - break;
  4410. + case OPTION_INSTTBL:
  4411. + case 't':
  4412. + {
  4413. + /* optarg is the name of the file containing the instruction
  4414. + formats, opcodes, register names, etc. */
  4415. + struct itbl_file_list *n;
  4416. +
  4417. + if (optarg == NULL)
  4418. + {
  4419. + as_warn ( _("No file name following -t option\n") );
  4420. + break;
  4421. + }
  4422. +
  4423. + n = (struct itbl_file_list *) xmalloc (sizeof *n);
  4424. + n->next = itbl_files;
  4425. + n->name = optarg;
  4426. + itbl_files = n;
  4427. +
  4428. + /* Parse the file and add the new instructions to our internal
  4429. + table. If multiple instruction tables are specified, the
  4430. + information from this table gets appended onto the existing
  4431. + internal table. */
  4432. + itbl_files->name = xstrdup (optarg);
  4433. + if (itbl_parse (itbl_files->name) != 0)
  4434. + {
  4435. + fprintf (stderr, _("Failed to read instruction table %s\n"),
  4436. + itbl_files->name);
  4437. + exit (EXIT_SUCCESS);
  4438. + }
  4439. + }
  4440. + break;
  4441. - case OPTION_GSTABS:
  4442. - debug_type = DEBUG_STABS;
  4443. - break;
  4444. + case OPTION_DEPFILE:
  4445. + start_dependencies (optarg);
  4446. + break;
  4447. +
  4448. + case OPTION_GSTABS:
  4449. + debug_type = DEBUG_STABS;
  4450. + break;
  4451. - case OPTION_GDWARF2:
  4452. - debug_type = DEBUG_DWARF2;
  4453. - break;
  4454. + case OPTION_GDWARF2:
  4455. + debug_type = DEBUG_DWARF2;
  4456. + break;
  4457. - case 'J':
  4458. - flag_signed_overflow_ok = 1;
  4459. - break;
  4460. + case 'J':
  4461. + flag_signed_overflow_ok = 1;
  4462. + break;
  4463. #ifndef WORKING_DOT_WORD
  4464. - case 'K':
  4465. - flag_warn_displacement = 1;
  4466. - break;
  4467. + case 'K':
  4468. + flag_warn_displacement = 1;
  4469. + break;
  4470. #endif
  4471. - case 'L':
  4472. - flag_keep_locals = 1;
  4473. - break;
  4474. -
  4475. - case OPTION_LISTING_LHS_WIDTH:
  4476. - listing_lhs_width = atoi(optarg);
  4477. - if (listing_lhs_width_second < listing_lhs_width)
  4478. - listing_lhs_width_second = listing_lhs_width;
  4479. - break;
  4480. - case OPTION_LISTING_LHS_WIDTH2:
  4481. - {
  4482. - int tmp = atoi(optarg);
  4483. - if (tmp > listing_lhs_width)
  4484. - listing_lhs_width_second = tmp;
  4485. - }
  4486. - break;
  4487. - case OPTION_LISTING_RHS_WIDTH:
  4488. - listing_rhs_width = atoi(optarg);
  4489. - break;
  4490. - case OPTION_LISTING_CONT_LINES:
  4491. - listing_lhs_cont_lines = atoi(optarg);
  4492. - break;
  4493. -
  4494. - case 'M':
  4495. - flag_mri = 1;
  4496. + case 'L':
  4497. + flag_keep_locals = 1;
  4498. + break;
  4499. +
  4500. + case OPTION_LISTING_LHS_WIDTH:
  4501. + listing_lhs_width = atoi(optarg);
  4502. + if (listing_lhs_width_second < listing_lhs_width)
  4503. + listing_lhs_width_second = listing_lhs_width;
  4504. + break;
  4505. + case OPTION_LISTING_LHS_WIDTH2:
  4506. + {
  4507. + int tmp = atoi(optarg);
  4508. + if (tmp > listing_lhs_width)
  4509. + listing_lhs_width_second = tmp;
  4510. + }
  4511. + break;
  4512. + case OPTION_LISTING_RHS_WIDTH:
  4513. + listing_rhs_width = atoi(optarg);
  4514. + break;
  4515. + case OPTION_LISTING_CONT_LINES:
  4516. + listing_lhs_cont_lines = atoi(optarg);
  4517. + break;
  4518. +
  4519. + case 'M':
  4520. + flag_mri = 1;
  4521. #ifdef TC_M68K
  4522. - flag_m68k_mri = 1;
  4523. + flag_m68k_mri = 1;
  4524. #endif
  4525. - break;
  4526. -
  4527. - case 'R':
  4528. - flag_readonly_data_in_text = 1;
  4529. - break;
  4530. -
  4531. - case 'W':
  4532. - flag_no_warnings = 1;
  4533. - break;
  4534. -
  4535. - case OPTION_WARN:
  4536. - flag_no_warnings = 0;
  4537. - flag_fatal_warnings = 0;
  4538. - break;
  4539. -
  4540. - case OPTION_WARN_FATAL:
  4541. - flag_no_warnings = 0;
  4542. - flag_fatal_warnings = 1;
  4543. - break;
  4544. -
  4545. - case 'Z':
  4546. - flag_always_generate_output = 1;
  4547. - break;
  4548. -
  4549. - case 'a':
  4550. - if (optarg)
  4551. - {
  4552. - while (*optarg)
  4553. - {
  4554. - switch (*optarg)
  4555. - {
  4556. - case 'c':
  4557. - listing |= LISTING_NOCOND;
  4558. - break;
  4559. - case 'd':
  4560. - listing |= LISTING_NODEBUG;
  4561. - break;
  4562. - case 'h':
  4563. - listing |= LISTING_HLL;
  4564. - break;
  4565. - case 'l':
  4566. - listing |= LISTING_LISTING;
  4567. - break;
  4568. - case 'm':
  4569. - listing |= LISTING_MACEXP;
  4570. - break;
  4571. - case 'n':
  4572. - listing |= LISTING_NOFORM;
  4573. - break;
  4574. - case 's':
  4575. - listing |= LISTING_SYMBOLS;
  4576. - break;
  4577. - case '=':
  4578. - listing_filename = xstrdup (optarg + 1);
  4579. - optarg += strlen (listing_filename);
  4580. - break;
  4581. - default:
  4582. - as_fatal (_("invalid listing option `%c'"), *optarg);
  4583. - break;
  4584. - }
  4585. - optarg++;
  4586. - }
  4587. - }
  4588. - if (!listing)
  4589. - listing = LISTING_DEFAULT;
  4590. - break;
  4591. -
  4592. - case 'D':
  4593. - /* DEBUG is implemented: it debugs different */
  4594. - /* things from other people's assemblers. */
  4595. - flag_debug = 1;
  4596. - break;
  4597. -
  4598. - case 'f':
  4599. - flag_no_comments = 1;
  4600. - break;
  4601. -
  4602. - case 'I':
  4603. - { /* Include file directory */
  4604. - char *temp = xstrdup (optarg);
  4605. - add_include_dir (temp);
  4606. - break;
  4607. - }
  4608. + break;
  4609. +
  4610. + case 'R':
  4611. + flag_readonly_data_in_text = 1;
  4612. + break;
  4613. - case 'o':
  4614. - out_file_name = xstrdup (optarg);
  4615. - break;
  4616. + case 'W':
  4617. + flag_no_warnings = 1;
  4618. + break;
  4619. - case 'w':
  4620. - break;
  4621. + case OPTION_WARN:
  4622. + flag_no_warnings = 0;
  4623. + flag_fatal_warnings = 0;
  4624. + break;
  4625. - case 'X':
  4626. - /* -X means treat warnings as errors */
  4627. - break;
  4628. - }
  4629. + case OPTION_WARN_FATAL:
  4630. + flag_no_warnings = 0;
  4631. + flag_fatal_warnings = 1;
  4632. + break;
  4633. +
  4634. + case 'Z':
  4635. + flag_always_generate_output = 1;
  4636. + break;
  4637. +
  4638. + case 'a':
  4639. + if (optarg)
  4640. + {
  4641. + while (*optarg)
  4642. + {
  4643. + switch (*optarg)
  4644. + {
  4645. + case 'c':
  4646. + listing |= LISTING_NOCOND;
  4647. + break;
  4648. + case 'd':
  4649. + listing |= LISTING_NODEBUG;
  4650. + break;
  4651. + case 'h':
  4652. + listing |= LISTING_HLL;
  4653. + break;
  4654. + case 'l':
  4655. + listing |= LISTING_LISTING;
  4656. + break;
  4657. + case 'm':
  4658. + listing |= LISTING_MACEXP;
  4659. + break;
  4660. + case 'n':
  4661. + listing |= LISTING_NOFORM;
  4662. + break;
  4663. + case 's':
  4664. + listing |= LISTING_SYMBOLS;
  4665. + break;
  4666. + case '=':
  4667. + listing_filename = xstrdup (optarg + 1);
  4668. + optarg += strlen (listing_filename);
  4669. + break;
  4670. + default:
  4671. + as_fatal (_("invalid listing option `%c'"), *optarg);
  4672. + break;
  4673. + }
  4674. + optarg++;
  4675. + }
  4676. + }
  4677. + if (!listing)
  4678. + listing = LISTING_DEFAULT;
  4679. +
  4680. + g_listing = 1; /* -a option exist: @rm,@rl Warning */
  4681. + /* add T.Tazaki 2002.04.26 */
  4682. + break;
  4683. +
  4684. + case 'D':
  4685. + /* DEBUG is implemented: it debugs different */
  4686. + /* things from other people's assemblers. */
  4687. + flag_debug = 1;
  4688. + break;
  4689. +
  4690. + case 'f':
  4691. + flag_no_comments = 1;
  4692. + break;
  4693. +
  4694. + case 'I':
  4695. + { /* Include file directory */
  4696. + char *temp = xstrdup (optarg);
  4697. + add_include_dir (temp);
  4698. + break;
  4699. + }
  4700. +
  4701. + case 'o':
  4702. + out_file_name = xstrdup (optarg);
  4703. + break;
  4704. +
  4705. + case 'w':
  4706. + break;
  4707. +
  4708. + case 'X':
  4709. + /* -X means treat warnings as errors */
  4710. + break;
  4711. + }
  4712. }
  4713. free (shortopts);
  4714. @@ -747,6 +911,48 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
  4715. *pargc = new_argc;
  4716. *pargv = new_argv;
  4717. +
  4718. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  4719. +#ifdef EXT_REMOVE
  4720. + // process of -mc33ext option
  4721. + if( flag_plural_src == 1 ){
  4722. + fprintf (stderr, _("Error : Cannot specify plurality source files.\n"));
  4723. + xexit (EXIT_FAILURE);
  4724. + }
  4725. +
  4726. + if( cp_Current_File_Name != NULL ){
  4727. + if( strlen(cp_Current_File_Name) > 0 ){
  4728. + chk_is_file_inf( cp_Current_File_Name ); // check whether ".file" exists
  4729. + }
  4730. + }
  4731. +
  4732. + if( ( cp_Current_File_Name != NULL )
  4733. + && ( cp_Dump_File_Name != NULL ) && ( out_file_name != NULL ) ){
  4734. + if( strlen(cp_Current_File_Name) > 0 ){
  4735. + xatexit( free_ext_heap_area ); // register "free_ext_heap_area()" into "xexit()"
  4736. + read_cur_file_info( cp_Current_File_Name );
  4737. + read_dump_info( cp_Dump_File_Name,out_file_name );
  4738. +
  4739. +// ADD D.Fujimoto 2008/01/07 >>>>>>>
  4740. + // read all object dump file
  4741. + read_all_dump_info(cp_All_Dump_File_Name, out_file_name);
  4742. +
  4743. + // count duplicate symbols using the all object dump file
  4744. + countDuplicateSymbols(stpp_All_Dump_Inf, ul_All_Dump_Symbol_Cnt);
  4745. +// ADD D.Fujimoto 2008/01/07 <<<<<<<
  4746. +
  4747. + // get data pointer address
  4748. + if (!g_iMedda32) {
  4749. + g_dpAddress = getDataPointerAddress(DATA_POINTER_SYMBOL);
  4750. + }
  4751. +
  4752. + g_c33_ext = 1;
  4753. + }
  4754. + }
  4755. +#endif
  4756. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  4757. +
  4758. +
  4759. }
  4760. static long start_time;
  4761. @@ -759,6 +965,10 @@ main (argc, argv)
  4762. int macro_alternate;
  4763. int macro_strip_at;
  4764. int keep_it;
  4765. +
  4766. + /* add T.Tazaki 2003/05/14 >>> */
  4767. + FILE *fpOut;
  4768. + /* add T.Tazaki 2003/05/14 <<< */
  4769. start_time = get_run_time ();
  4770. @@ -850,7 +1060,7 @@ main (argc, argv)
  4771. struct defsym_list *next;
  4772. sym = symbol_new (defsyms->name, absolute_section, defsyms->value,
  4773. - &zero_address_frag);
  4774. + &zero_address_frag);
  4775. symbol_table_insert (sym);
  4776. next = defsyms->next;
  4777. free (defsyms);
  4778. @@ -859,7 +1069,7 @@ main (argc, argv)
  4779. PROGRESS (1);
  4780. - perform_an_assembly_pass (argc, argv); /* Assemble it. */
  4781. + perform_an_assembly_pass (argc, argv); /* Assemble it. */
  4782. cond_finish_check (-1);
  4783. @@ -893,6 +1103,35 @@ main (argc, argv)
  4784. if (keep_it)
  4785. #endif
  4786. output_file_close (out_file_name);
  4787. +
  4788. +/* add T.Tazaki 2003/05/14 >>> */
  4789. + fpOut = fopen( out_file_name,"r+b" );
  4790. + if( fpOut != NULL )
  4791. + {
  4792. + /* e_machine number set */
  4793. +// fseek( fpOut, 18, SEEK_SET );
  4794. +// fputc( EM_SE_C33, fpOut );
  4795. +
  4796. + /* ELF header : e_flags bit31-28=CPU flag set */
  4797. + /* flag = 0x0 : Standard macro */
  4798. + /* flag = 'A' : Advanced macro */
  4799. + /* flag = 'P' : PE macro */
  4800. +
  4801. + /* Advanced macro mode ? */
  4802. + if( g_iAdvance == 1 )
  4803. + {
  4804. + fseek( fpOut, 39, SEEK_SET );
  4805. + fputc( 'A', fpOut );
  4806. + }
  4807. + else if ( g_iPE == 1 ) /* add T.Tazaki 2003/11/18 */
  4808. + {
  4809. + fseek( fpOut, 39, SEEK_SET );
  4810. + fputc( 'P', fpOut );
  4811. + }
  4812. + fclose( fpOut );
  4813. + }
  4814. +/* add T.Tazaki 2003/05/14 <<< */
  4815. +
  4816. #endif
  4817. if (flag_fatal_warnings && had_warnings() > 0 && had_errors () == 0)
  4818. @@ -928,10 +1167,10 @@ dump_statistics ()
  4819. long run_time = get_run_time () - start_time;
  4820. fprintf (stderr, _("%s: total time in assembly: %ld.%06ld\n"),
  4821. - myname, run_time / 1000000, run_time % 1000000);
  4822. + myname, run_time / 1000000, run_time % 1000000);
  4823. #ifdef HAVE_SBRK
  4824. fprintf (stderr, _("%s: data size %ld\n"),
  4825. - myname, (long) (lim - (char *) &environ));
  4826. + myname, (long) (lim - (char *) &environ));
  4827. #endif
  4828. subsegs_print_statistics (stderr);
  4829. @@ -948,7 +1187,7 @@ dump_statistics ()
  4830. }
  4831. -/* perform_an_assembly_pass()
  4832. +/* perform_an_assembly_pass()
  4833. *
  4834. * Here to attempt 1 pass over each input file.
  4835. * We scan argv[*] looking for filenames or exactly "" which is
  4836. @@ -1012,11 +1251,11 @@ perform_an_assembly_pass (argc, argv)
  4837. to have relocs, otherwise we don't find out in time. */
  4838. applicable = bfd_applicable_section_flags (stdoutput);
  4839. bfd_set_section_flags (stdoutput, text_section,
  4840. - applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
  4841. - | SEC_CODE | SEC_READONLY));
  4842. + applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
  4843. + | SEC_CODE | SEC_READONLY));
  4844. bfd_set_section_flags (stdoutput, data_section,
  4845. - applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
  4846. - | SEC_DATA));
  4847. + applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
  4848. + | SEC_DATA));
  4849. bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
  4850. seg_info (bss_section)->bss = 1;
  4851. subseg_new (BFD_ABS_SECTION_NAME, 0);
  4852. @@ -1036,22 +1275,22 @@ perform_an_assembly_pass (argc, argv)
  4853. obj_begin ();
  4854. #endif
  4855. - argv++; /* skip argv[0] */
  4856. - argc--; /* skip argv[0] */
  4857. + argv++; /* skip argv[0] */
  4858. + argc--; /* skip argv[0] */
  4859. while (argc--)
  4860. {
  4861. if (*argv)
  4862. - { /* Is it a file-name argument? */
  4863. - PROGRESS (1);
  4864. - saw_a_file++;
  4865. - /* argv->"" if stdin desired, else->filename */
  4866. - read_a_source_file (*argv);
  4867. - }
  4868. - argv++; /* completed that argv */
  4869. + { /* Is it a file-name argument? */
  4870. + PROGRESS (1);
  4871. + saw_a_file++;
  4872. + /* argv->"" if stdin desired, else->filename */
  4873. + read_a_source_file (*argv);
  4874. + }
  4875. + argv++; /* completed that argv */
  4876. }
  4877. if (!saw_a_file)
  4878. read_a_source_file ("");
  4879. -} /* perform_an_assembly_pass() */
  4880. +} /* perform_an_assembly_pass() */
  4881. /* The interface between the macro code and gas expression handling. */
  4882. diff --git a/gas/config/gas/config/tc-c33.c b/gas/config/gas/config/tc-c33.c
  4883. new file mode 100644
  4884. index 0000000..f247b49
  4885. --- /dev/null
  4886. +++ b/gas/config/gas/config/tc-c33.c
  4887. @@ -0,0 +1,4382 @@
  4888. +/* tc-c33.c -- Assembler code for the EPSON EOC33
  4889. + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
  4890. +
  4891. + This file is part of GAS, the GNU Assembler.
  4892. +
  4893. + GAS is free software; you can redistribute it and/or modify
  4894. + it under the terms of the GNU General Public License as published by
  4895. + the Free Software Foundation; either version 2, or (at your option)
  4896. + any later version.
  4897. +
  4898. + GAS is distributed in the hope that it will be useful,
  4899. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  4900. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4901. + GNU General Public License for more details.
  4902. +
  4903. + You should have received a copy of the GNU General Public License
  4904. + along with GAS; see the file COPYING. If not, write to
  4905. + the Free Software Foundation, 59 Temple Place - Suite 330,
  4906. + Boston, MA 02111-1307, USA. */
  4907. +
  4908. +#include <stdio.h>
  4909. +#include <ctype.h>
  4910. +#include "as.h"
  4911. +#include "subsegs.h"
  4912. +#include "opcode/c33.h"
  4913. +
  4914. +#define AREA_CDA 0
  4915. +#define AREA_GDA 1
  4916. +#define AREA_ZDA 2
  4917. +#define AREA_SDA 3
  4918. +#define AREA_TDA 4
  4919. +#define AREA_LCDA 5
  4920. +#define AREA_LGDA 6
  4921. +#define AREA_LZDA 7
  4922. +#define AREA_LSDA 8
  4923. +#define AREA_LTDA 9
  4924. +
  4925. +
  4926. +#define O_spregister O_md1 /* for c33 %sp */
  4927. +#define O_dpregister O_md2 /* for c33 %dp */
  4928. +#define O_cond O_md3 /* for c33 ext cond */
  4929. +#define O_op_shift O_md4 /* for c33 ext OP */
  4930. +
  4931. +#define SGP_REG 12 /* GP register */
  4932. +#define TGP_REG 13 /* GP register */
  4933. +#define ZGP_REG 14 /* GP register */
  4934. +#define GP_REG 15 /* GP register */
  4935. +
  4936. +/* Temporarily holds the reloc in a cons expression. */
  4937. +static bfd_reloc_code_real_type hold_cons_reloc;
  4938. +
  4939. +
  4940. +
  4941. +/* Structure to hold information about predefined registers. */
  4942. +struct reg_name
  4943. +{
  4944. + const char * name;
  4945. + int value;
  4946. +};
  4947. +
  4948. +/* Generic assembler global variables which must be defined by all targets. */
  4949. +
  4950. +/* Characters which always start a comment. */
  4951. +const char comment_chars[] = ";";
  4952. +
  4953. +/* Characters which start a comment at the beginning of a line. */
  4954. +const char line_comment_chars[] = "";
  4955. +
  4956. +/* Characters which may be used to separate multiple commands on a
  4957. + single line. */
  4958. +const char line_separator_chars[] = "";
  4959. +
  4960. +/* Characters which are used to indicate an exponent in a floating
  4961. + point number. */
  4962. +const char EXP_CHARS[] = "eE";
  4963. +
  4964. +/* Characters which mean that a number is a floating point constant,
  4965. + as in 0d1.0. */
  4966. +const char FLT_CHARS[] = "dD";
  4967. +
  4968. +
  4969. +const relax_typeS md_relax_table[] =
  4970. +{
  4971. + /* Conditional branches. */
  4972. + {0xff, -0x100, 2, 1},
  4973. + {0x1fffff, -0x200000, 6, 0},
  4974. + /* Unconditional branches. */
  4975. + {0xff, -0x100, 2, 3},
  4976. + {0x1fffff, -0x200000, 4, 0},
  4977. +};
  4978. +
  4979. +/* add tazaki 2001.12.03 */
  4980. +static segT comm_section = NULL;
  4981. +static segT gcomm_section = NULL;
  4982. +static segT scomm_section = NULL;
  4983. +static segT tcomm_section = NULL;
  4984. +static segT zcomm_section = NULL;
  4985. +static segT gbss_section = NULL;
  4986. +static segT sbss_section = NULL;
  4987. +static segT tbss_section = NULL;
  4988. +static segT zbss_section = NULL;
  4989. +/* add tazaki 2001.12.03 */
  4990. +
  4991. +/* add T.Tazaki 2002.04.26 >>> */
  4992. +extern int g_listing;
  4993. +/* add T.Tazaki 2002.04.26 <<< */
  4994. +
  4995. +/* fixups */
  4996. +#define MAX_INSN_FIXUPS (5)
  4997. +struct c33_fixup
  4998. +{
  4999. + expressionS exp;
  5000. + int opindex;
  5001. + bfd_reloc_code_real_type reloc;
  5002. +};
  5003. +
  5004. +struct c33_fixup fixups [MAX_INSN_FIXUPS];
  5005. +static int fc;
  5006. +
  5007. +
  5008. +
  5009. +/******************************************************************************
  5010. + INPUT int area of symbol
  5011. + RETURN void
  5012. + Explanation assembler false instruction(.gcomm/.scomm/.tcomm/.zcomm) Evaluation
  5013. +******************************************************************************/
  5014. +/* Copied from obj_elf_common() in gas/config/obj-elf.c */
  5015. +static void
  5016. +c33_comm (area)
  5017. + int area;
  5018. +{
  5019. + char * name;
  5020. + char c;
  5021. + char * p;
  5022. + int temp;
  5023. + int size;
  5024. + symbolS * symbolP;
  5025. + int have_align;
  5026. + char * pfrag;
  5027. +
  5028. + name = input_line_pointer;
  5029. + c = get_symbol_end ();
  5030. +
  5031. + /* just after name is now '\0' */
  5032. + p = input_line_pointer;
  5033. + *p = c;
  5034. +
  5035. + /* skip space */
  5036. + SKIP_WHITESPACE ();
  5037. +
  5038. + /* Is the character after ".comm" a pause character? */
  5039. + if (*input_line_pointer != ',')
  5040. + {
  5041. + as_bad (_("Expected comma after symbol-name"));
  5042. + ignore_rest_of_line ();
  5043. + return;
  5044. + }
  5045. +
  5046. + input_line_pointer ++; /* skip ',' */
  5047. +
  5048. + if ((temp = get_absolute_expression ()) < 0)
  5049. + {
  5050. + /* xgettext:c-format */
  5051. + as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp);
  5052. + ignore_rest_of_line ();
  5053. + return;
  5054. + }
  5055. +
  5056. + size = temp;
  5057. + *p = 0;
  5058. + symbolP = symbol_find_or_make (name);
  5059. + *p = c;
  5060. +
  5061. +/* if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) */
  5062. + if (S_IS_DEFINED (symbolP) )
  5063. + {
  5064. + as_bad (_("Ignoring attempt to re-define symbol"));
  5065. + ignore_rest_of_line ();
  5066. + return;
  5067. + }
  5068. +
  5069. + if (S_GET_VALUE (symbolP) != 0)
  5070. + {
  5071. + if (S_GET_VALUE (symbolP) != size)
  5072. + {
  5073. + /* xgettext:c-format */
  5074. + as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
  5075. + S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
  5076. + }
  5077. + }
  5078. +
  5079. + know (symbol_get_frag (symbolP) == & zero_address_frag);
  5080. +
  5081. + if (*input_line_pointer != ',')
  5082. + have_align = 0;
  5083. + else
  5084. + {
  5085. + have_align = 1;
  5086. + input_line_pointer++;
  5087. + SKIP_WHITESPACE ();
  5088. + }
  5089. +
  5090. + if (! have_align || *input_line_pointer != '"')
  5091. + {
  5092. + if (! have_align)
  5093. + temp = 0;
  5094. + else
  5095. + {
  5096. + temp = get_absolute_expression ();
  5097. +
  5098. + if (temp < 0)
  5099. + {
  5100. + temp = 0;
  5101. + as_warn (_("Common alignment negative; 0 assumed"));
  5102. + }
  5103. + }
  5104. +
  5105. +
  5106. +/* if (symbol_get_obj (symbolP)->local)*/
  5107. + if (!(area == AREA_CDA || area == AREA_GDA || area == AREA_SDA || area == AREA_TDA || area == AREA_ZDA ))
  5108. + {
  5109. + /* NOT EXIST ROUTINE */
  5110. +
  5111. + segT old_sec;
  5112. + int old_subsec;
  5113. + int align;
  5114. + flagword applicable;
  5115. +
  5116. + old_sec = now_seg;
  5117. + old_subsec = now_subseg;
  5118. +
  5119. + applicable = bfd_applicable_section_flags (stdoutput);
  5120. +
  5121. + applicable &= SEC_ALLOC;
  5122. +
  5123. + switch (area)
  5124. + {
  5125. + case AREA_CDA:
  5126. + if (comm_section == NULL)
  5127. + {
  5128. +
  5129. + comm_section = subseg_new (".comm", 0);
  5130. +
  5131. + bfd_set_section_flags (stdoutput, comm_section, applicable);
  5132. +
  5133. + seg_info (comm_section)->bss = 1;
  5134. + }
  5135. + break;
  5136. +
  5137. + case AREA_GDA:
  5138. + if (gcomm_section == NULL)
  5139. + {
  5140. + gcomm_section = subseg_new (".gcomm", 0);
  5141. +
  5142. + bfd_set_section_flags (stdoutput, gcomm_section, applicable);
  5143. +
  5144. + seg_info (gcomm_section)->bss = 1;
  5145. + }
  5146. + break;
  5147. +
  5148. + case AREA_SDA:
  5149. + if (scomm_section == NULL)
  5150. + {
  5151. + scomm_section = subseg_new (".scomm", 0);
  5152. +
  5153. + bfd_set_section_flags (stdoutput, scomm_section, applicable);
  5154. +
  5155. + seg_info (scomm_section)->bss = 1;
  5156. + }
  5157. + break;
  5158. +
  5159. + case AREA_TDA:
  5160. + if (tcomm_section == NULL)
  5161. + {
  5162. + tcomm_section = subseg_new (".tcomm", 0);
  5163. +
  5164. + bfd_set_section_flags (stdoutput, tcomm_section, applicable);
  5165. +
  5166. + seg_info (tcomm_section)->bss = 1;
  5167. + }
  5168. + break;
  5169. +
  5170. + case AREA_ZDA:
  5171. + if (zcomm_section == NULL)
  5172. + {
  5173. + zcomm_section = subseg_new (".zcomm", 0);
  5174. +
  5175. + bfd_set_section_flags (stdoutput, zcomm_section, applicable);
  5176. +
  5177. + seg_info (zcomm_section)->bss = 1;
  5178. + }
  5179. + break;
  5180. +
  5181. + }
  5182. +
  5183. + if (temp)
  5184. + {
  5185. + /* convert to a power of 2 alignment */
  5186. + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
  5187. + ;
  5188. +
  5189. + if (temp != 1)
  5190. + {
  5191. + as_bad (_("Common alignment not a power of 2"));
  5192. + ignore_rest_of_line ();
  5193. + return;
  5194. + }
  5195. + }
  5196. + else
  5197. + align = 0;
  5198. +
  5199. + switch (area)
  5200. + {
  5201. + case AREA_CDA:
  5202. + record_alignment (comm_section, align);
  5203. + obj_elf_section_change_hook();
  5204. + subseg_set (comm_section, 0);
  5205. + break;
  5206. +
  5207. + case AREA_GDA:
  5208. + record_alignment (gcomm_section, align);
  5209. + obj_elf_section_change_hook();
  5210. + subseg_set (gcomm_section, 0);
  5211. + break;
  5212. +
  5213. + case AREA_SDA:
  5214. + record_alignment (scomm_section, align);
  5215. + obj_elf_section_change_hook();
  5216. + subseg_set (scomm_section, 0);
  5217. + break;
  5218. +
  5219. + case AREA_TDA:
  5220. + record_alignment (tcomm_section, align);
  5221. + obj_elf_section_change_hook();
  5222. + subseg_set (tcomm_section, 0);
  5223. + break;
  5224. +
  5225. + case AREA_ZDA:
  5226. + record_alignment (zcomm_section, align);
  5227. + obj_elf_section_change_hook();
  5228. + subseg_set (zcomm_section, 0);
  5229. + break;
  5230. +
  5231. + default:
  5232. + abort();
  5233. + }
  5234. +
  5235. + if (align)
  5236. + frag_align (align, 0, 0);
  5237. +
  5238. + switch (area)
  5239. + {
  5240. + case AREA_CDA:
  5241. + if (S_GET_SEGMENT (symbolP) == comm_section)
  5242. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5243. + break;
  5244. +
  5245. + case AREA_GDA:
  5246. + if (S_GET_SEGMENT (symbolP) == gcomm_section)
  5247. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5248. + break;
  5249. +
  5250. + case AREA_SDA:
  5251. + if (S_GET_SEGMENT (symbolP) == scomm_section)
  5252. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5253. + break;
  5254. +
  5255. + case AREA_TDA:
  5256. + if (S_GET_SEGMENT (symbolP) == tcomm_section)
  5257. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5258. + break;
  5259. +
  5260. + case AREA_ZDA:
  5261. + if (S_GET_SEGMENT (symbolP) == zcomm_section)
  5262. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5263. + break;
  5264. +
  5265. + default:
  5266. + abort ();
  5267. + }
  5268. +
  5269. + symbol_set_frag (symbolP, frag_now);
  5270. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5271. + (offsetT) size, (char *) 0);
  5272. + *pfrag = 0;
  5273. + S_SET_SIZE (symbolP, size);
  5274. +
  5275. + switch (area)
  5276. + {
  5277. + case AREA_CDA:
  5278. + S_SET_SEGMENT (symbolP, comm_section);
  5279. + break;
  5280. +
  5281. + case AREA_GDA:
  5282. + S_SET_SEGMENT (symbolP, gcomm_section);
  5283. + break;
  5284. +
  5285. + case AREA_SDA:
  5286. + S_SET_SEGMENT (symbolP, scomm_section);
  5287. + break;
  5288. +
  5289. + case AREA_TDA:
  5290. + S_SET_SEGMENT (symbolP, tcomm_section);
  5291. + break;
  5292. +
  5293. + case AREA_ZDA:
  5294. + S_SET_SEGMENT (symbolP, zcomm_section);
  5295. + break;
  5296. +
  5297. + default:
  5298. + abort();
  5299. + }
  5300. +
  5301. + if (symbol_get_obj (symbolP)->local)
  5302. + S_CLEAR_EXTERNAL (symbolP);
  5303. + else
  5304. + S_SET_EXTERNAL (symbolP);
  5305. +
  5306. + obj_elf_section_change_hook();
  5307. + subseg_set (old_sec, old_subsec);
  5308. + }
  5309. + else
  5310. + {
  5311. + /*==========================================================================*/
  5312. + /* Evaluation of .comm */
  5313. + /*==========================================================================*/
  5314. + segT old_sec;
  5315. + int old_subsec;
  5316. + int align;
  5317. + int i_now_align; /* add 2002.01.21 */
  5318. + i_now_align = temp; /* add 2002.01.21 */
  5319. +
  5320. + /* computing of alignment */
  5321. + if (temp)
  5322. + {
  5323. + /* convert to a power of 2 alignment */
  5324. + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
  5325. + ;
  5326. +
  5327. + if (temp != 1)
  5328. + {
  5329. + as_bad (_("Common alignment not a power of 2"));
  5330. + ignore_rest_of_line ();
  5331. + return;
  5332. + }
  5333. + }
  5334. + else
  5335. + align = 0;
  5336. +
  5337. + old_sec = now_seg;
  5338. + old_subsec = now_subseg;
  5339. +
  5340. + allocate_common:
  5341. +
  5342. + /* Convert .local + .xcomm to local section. */
  5343. +
  5344. + if (symbol_get_obj (symbolP)->local){
  5345. + switch (area)
  5346. + {
  5347. + case AREA_CDA:
  5348. + area = AREA_LCDA;
  5349. + break;
  5350. + case AREA_GDA:
  5351. + area = AREA_LGDA;
  5352. + break;
  5353. + case AREA_SDA:
  5354. + area = AREA_LSDA;
  5355. + break;
  5356. + case AREA_TDA:
  5357. + area = AREA_LTDA;
  5358. + break;
  5359. + case AREA_ZDA:
  5360. + area = AREA_LZDA;
  5361. + break;
  5362. + }
  5363. + }
  5364. +
  5365. + switch (area)
  5366. + {
  5367. + case AREA_CDA:
  5368. + if (comm_section == NULL)
  5369. + {
  5370. + flagword applicable;
  5371. +
  5372. + applicable = bfd_applicable_section_flags (stdoutput);
  5373. +
  5374. + comm_section = subseg_new (".comm", 0);
  5375. +
  5376. + bfd_set_section_flags (stdoutput, comm_section, applicable
  5377. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  5378. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  5379. + }
  5380. + S_SET_SEGMENT (symbolP, comm_section);
  5381. + record_alignment (comm_section, align);
  5382. +
  5383. + break;
  5384. +
  5385. + case AREA_GDA:
  5386. + if (gcomm_section == NULL)
  5387. + {
  5388. + flagword applicable;
  5389. +
  5390. + applicable = bfd_applicable_section_flags (stdoutput);
  5391. +
  5392. + gcomm_section = subseg_new (".gcomm", 0);
  5393. +
  5394. + bfd_set_section_flags (stdoutput, gcomm_section, applicable
  5395. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  5396. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  5397. + }
  5398. + S_SET_SEGMENT (symbolP, gcomm_section);
  5399. + record_alignment (gcomm_section, align);
  5400. + break;
  5401. +
  5402. + case AREA_SDA:
  5403. + if (scomm_section == NULL)
  5404. + {
  5405. + flagword applicable;
  5406. +
  5407. + applicable = bfd_applicable_section_flags (stdoutput);
  5408. +
  5409. + scomm_section = subseg_new (".scomm", 0);
  5410. +
  5411. + bfd_set_section_flags (stdoutput, scomm_section, applicable
  5412. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  5413. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  5414. + }
  5415. + S_SET_SEGMENT (symbolP, scomm_section);
  5416. + record_alignment (scomm_section, align);
  5417. + break;
  5418. +
  5419. + case AREA_TDA:
  5420. + if (tcomm_section == NULL)
  5421. + {
  5422. + flagword applicable;
  5423. +
  5424. + applicable = bfd_applicable_section_flags (stdoutput);
  5425. +
  5426. + tcomm_section = subseg_new (".tcomm", 0);
  5427. +
  5428. + bfd_set_section_flags (stdoutput, tcomm_section, applicable
  5429. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  5430. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  5431. + }
  5432. + S_SET_SEGMENT (symbolP, tcomm_section);
  5433. + record_alignment (tcomm_section, align);
  5434. + break;
  5435. +
  5436. + case AREA_ZDA:
  5437. + if (zcomm_section == NULL)
  5438. + {
  5439. + flagword applicable;
  5440. +
  5441. + applicable = bfd_applicable_section_flags (stdoutput);
  5442. +
  5443. + zcomm_section = subseg_new (".zcomm", 0);
  5444. +
  5445. + bfd_set_section_flags (stdoutput, zcomm_section, applicable
  5446. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  5447. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  5448. + }
  5449. + S_SET_SEGMENT (symbolP, zcomm_section);
  5450. + record_alignment (zcomm_section, align);
  5451. + break;
  5452. +
  5453. +
  5454. + case AREA_LCDA:
  5455. + /* Convert local comm to .bss section. */
  5456. + obj_elf_section_change_hook();
  5457. + subseg_set (bss_section, 0);
  5458. +
  5459. + if (S_GET_SEGMENT (symbolP) == bss_section)
  5460. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5461. +
  5462. + if (align)
  5463. + frag_align (align, 0, 0);
  5464. +
  5465. + symbol_set_frag (symbolP, frag_now);
  5466. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5467. + (offsetT) size, (char *) 0);
  5468. + *pfrag = 0;
  5469. +
  5470. + S_SET_SIZE (symbolP, size);
  5471. + S_SET_SEGMENT (symbolP, bss_section);
  5472. + record_alignment (bss_section, align);
  5473. +
  5474. + break;
  5475. +
  5476. + case AREA_LGDA:
  5477. + if (gbss_section == NULL)
  5478. + {
  5479. + flagword applicable;
  5480. +
  5481. + applicable = bfd_applicable_section_flags (stdoutput);
  5482. +
  5483. + gbss_section = subseg_new (".gbss", 0);
  5484. +
  5485. + bfd_set_section_flags (stdoutput, gbss_section, applicable & SEC_ALLOC);
  5486. +
  5487. + seg_info (gbss_section)->bss = 1;
  5488. + }
  5489. +
  5490. + record_alignment (gbss_section, align);
  5491. + obj_elf_section_change_hook();
  5492. + subseg_set (gbss_section, 0);
  5493. +
  5494. + if (align)
  5495. + frag_align (align, 0, 0);
  5496. +
  5497. + if (S_GET_SEGMENT (symbolP) == gbss_section)
  5498. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5499. +
  5500. + symbol_set_frag (symbolP, frag_now);
  5501. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5502. + (offsetT) size, (char *) 0);
  5503. + *pfrag = 0;
  5504. + S_SET_SIZE (symbolP, size);
  5505. + S_SET_SEGMENT (symbolP, gbss_section);
  5506. +
  5507. + break;
  5508. +
  5509. + case AREA_LSDA:
  5510. + if (sbss_section == NULL)
  5511. + {
  5512. + flagword applicable;
  5513. +
  5514. + applicable = bfd_applicable_section_flags (stdoutput);
  5515. +
  5516. + sbss_section = subseg_new (".sbss", 0);
  5517. +
  5518. + bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC);
  5519. +
  5520. + seg_info (sbss_section)->bss = 1;
  5521. + }
  5522. +
  5523. + record_alignment (sbss_section, align);
  5524. + obj_elf_section_change_hook();
  5525. + subseg_set (sbss_section, 0);
  5526. +
  5527. + if (align)
  5528. + frag_align (align, 0, 0);
  5529. +
  5530. + if (S_GET_SEGMENT (symbolP) == sbss_section)
  5531. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5532. +
  5533. + symbol_set_frag (symbolP, frag_now);
  5534. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5535. + (offsetT) size, (char *) 0);
  5536. + *pfrag = 0;
  5537. + S_SET_SIZE (symbolP, size);
  5538. + S_SET_SEGMENT (symbolP, sbss_section);
  5539. +
  5540. + break;
  5541. +
  5542. + case AREA_LTDA:
  5543. + if (tbss_section == NULL)
  5544. + {
  5545. + flagword applicable;
  5546. +
  5547. + applicable = bfd_applicable_section_flags (stdoutput);
  5548. +
  5549. + tbss_section = subseg_new (".tbss", 0);
  5550. +
  5551. + bfd_set_section_flags (stdoutput, tbss_section, applicable & SEC_ALLOC);
  5552. +
  5553. + seg_info (tbss_section)->bss = 1;
  5554. + }
  5555. +
  5556. + record_alignment (tbss_section, align);
  5557. + obj_elf_section_change_hook();
  5558. + subseg_set (tbss_section, 0);
  5559. +
  5560. + if (align)
  5561. + frag_align (align, 0, 0);
  5562. +
  5563. + if (S_GET_SEGMENT (symbolP) == tbss_section)
  5564. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5565. +
  5566. + symbol_set_frag (symbolP, frag_now);
  5567. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5568. + (offsetT) size, (char *) 0);
  5569. + *pfrag = 0;
  5570. + S_SET_SIZE (symbolP, size);
  5571. + S_SET_SEGMENT (symbolP, tbss_section);
  5572. +
  5573. + break;
  5574. +
  5575. + case AREA_LZDA:
  5576. + if (zbss_section == NULL)
  5577. + {
  5578. + flagword applicable;
  5579. +
  5580. + applicable = bfd_applicable_section_flags (stdoutput);
  5581. +
  5582. + zbss_section = subseg_new (".zbss", 0);
  5583. +
  5584. + bfd_set_section_flags (stdoutput, zbss_section, applicable & SEC_ALLOC);
  5585. +
  5586. + seg_info (zbss_section)->bss = 1;
  5587. + }
  5588. +
  5589. + record_alignment (zbss_section, align);
  5590. + obj_elf_section_change_hook();
  5591. + subseg_set (zbss_section, 0);
  5592. +
  5593. + if (align)
  5594. + frag_align (align, 0, 0);
  5595. +
  5596. + if (S_GET_SEGMENT (symbolP) == zbss_section)
  5597. + symbol_get_frag (symbolP)->fr_symbol = 0;
  5598. +
  5599. + symbol_set_frag (symbolP, frag_now);
  5600. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  5601. + (offsetT) size, (char *) 0);
  5602. + *pfrag = 0;
  5603. + S_SET_SIZE (symbolP, size);
  5604. + S_SET_SEGMENT (symbolP, zbss_section);
  5605. +
  5606. + break;
  5607. +
  5608. + default:
  5609. + abort();
  5610. + }
  5611. +
  5612. + if (area == AREA_LCDA || area == AREA_LGDA || area == AREA_LSDA || area == AREA_LTDA || area == AREA_LZDA) /* ローカル? */
  5613. + {
  5614. + S_CLEAR_EXTERNAL (symbolP);
  5615. + }else{
  5616. + S_SET_VALUE (symbolP, (valueT) size);
  5617. +// S_SET_ALIGN (symbolP, temp);
  5618. + if( i_now_align )
  5619. + S_SET_ALIGN (symbolP, i_now_align);
  5620. + S_SET_EXTERNAL (symbolP);
  5621. + }
  5622. +
  5623. + obj_elf_section_change_hook();
  5624. + subseg_set (old_sec, old_subsec);
  5625. +
  5626. + }
  5627. +}
  5628. + else
  5629. + {
  5630. + input_line_pointer++;
  5631. + /* @@ Some use the dot, some don't. Can we get some consistency?? */
  5632. + if (*input_line_pointer == '.')
  5633. + input_line_pointer++;
  5634. + /* @@ Some say data, some say bss. */
  5635. + if (strncmp (input_line_pointer, "bss\"", 4)
  5636. + && strncmp (input_line_pointer, "data\"", 5))
  5637. + {
  5638. + while (*--input_line_pointer != '"')
  5639. + ;
  5640. + input_line_pointer--;
  5641. + goto bad_common_segment;
  5642. + }
  5643. + while (*input_line_pointer++ != '"')
  5644. + ;
  5645. + goto allocate_common;
  5646. + }
  5647. +
  5648. + symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
  5649. +
  5650. + demand_empty_rest_of_line ();
  5651. + return;
  5652. +
  5653. + {
  5654. + bad_common_segment:
  5655. + p = input_line_pointer;
  5656. + while (*p && *p != '\n')
  5657. + p++;
  5658. + c = *p;
  5659. + *p = '\0';
  5660. + as_bad (_("bad .common segment %s"), input_line_pointer + 1);
  5661. + *p = c;
  5662. + input_line_pointer = p;
  5663. + ignore_rest_of_line ();
  5664. + return;
  5665. + }
  5666. +}
  5667. +
  5668. +/* The target specific pseudo-ops which we support. */
  5669. +const pseudo_typeS md_pseudo_table[] =
  5670. +{
  5671. + {"comm", c33_comm, AREA_CDA},
  5672. + {"gcomm", c33_comm, AREA_GDA},
  5673. + {"scomm", c33_comm, AREA_SDA},
  5674. + {"tcomm", c33_comm, AREA_TDA},
  5675. + {"zcomm", c33_comm, AREA_ZDA},
  5676. + { NULL, NULL, 0}
  5677. +};
  5678. +
  5679. +/*****************************************************************************/
  5680. +
  5681. +
  5682. +
  5683. +/* Opcode hash table. */
  5684. +static struct hash_control *c33_hash;
  5685. +
  5686. +/* This table is sorted. Suitable for searching by a binary search. */
  5687. +static const struct reg_name pre_defined_registers[] =
  5688. +{
  5689. + { "%r0", 0 },
  5690. + { "%r1", 1 },
  5691. + { "%r10", 10 },
  5692. + { "%r11", 11 },
  5693. + { "%r12", 12 },
  5694. + { "%r13", 13 },
  5695. + { "%r14", 14 },
  5696. + { "%r15", 15 },
  5697. + { "%r2", 2 },
  5698. + { "%r3", 3 },
  5699. + { "%r4", 4 },
  5700. + { "%r5", 5 },
  5701. + { "%r6", 6 },
  5702. + { "%r7", 7 },
  5703. + { "%r8", 8 },
  5704. + { "%r9", 9 },
  5705. +};
  5706. +#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct reg_name))
  5707. +
  5708. +/* standard macro spesial registers */
  5709. +static const struct reg_name system_registers[] =
  5710. +{
  5711. + { "%ahr", 3 },
  5712. + { "%alr", 2 },
  5713. + { "%psr", 0 },
  5714. + { "%sp", 1 },
  5715. +};
  5716. +
  5717. +/* advanced macro spesial registers */
  5718. +static const struct reg_name adv_system_registers[] =
  5719. +{
  5720. + { "%ahr", 3 },
  5721. + { "%alr", 2 },
  5722. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  5723. + { "%dp", 9 }, /* Adv */
  5724. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  5725. + { "%lco", 4 }, /* Adv */
  5726. + { "%lea", 6 }, /* Adv */
  5727. + { "%lsa", 5 }, /* Adv */
  5728. + { "%pc", 15},
  5729. + { "%psr", 0 },
  5730. + { "%sor", 7 }, /* Adv */
  5731. + { "%sp", 1 },
  5732. + { "%ssp", 14 }, /* Adv */
  5733. + { "%ttbr", 8 }, /* Adv */
  5734. + { "%usp", 13 }, /* Adv */
  5735. +};
  5736. +
  5737. +/* ld.w %sd,%rs special registers */
  5738. +static const struct reg_name adv_load_system_registers[] =
  5739. +{
  5740. + { "%ahr", 3 },
  5741. + { "%alr", 2 },
  5742. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  5743. + { "%dp", 9 }, /* Adv */
  5744. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  5745. + { "%lco", 4 }, /* Adv */
  5746. + { "%lea", 6 }, /* Adv */
  5747. + { "%lsa", 5 }, /* Adv */
  5748. + { "%psr", 0 },
  5749. + { "%sor", 7 }, /* Adv */
  5750. + { "%sp", 1 },
  5751. + { "%ssp", 14 }, /* Adv */
  5752. + { "%ttbr", 8 }, /* Adv */
  5753. + { "%usp", 13 }, /* Adv */
  5754. +};
  5755. +
  5756. +/* pushs , pops special registers */
  5757. +static const struct reg_name adv_pushs_system_registers[] =
  5758. +{
  5759. + { "%ahr", 3 },
  5760. + { "%alr", 2 },
  5761. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  5762. + { "%dp", 9 }, /* Adv */
  5763. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  5764. + { "%lco", 4 }, /* Adv */
  5765. + { "%lea", 6 }, /* Adv */
  5766. + { "%lsa", 5 }, /* Adv */
  5767. + { "%pc", 15 },
  5768. + { "%psr", 0 },
  5769. + { "%sor", 7 }, /* Adv */
  5770. + { "%sp", 1 },
  5771. + { "%ssp", 14 }, /* Adv */
  5772. + { "%ttbr", 8 }, /* Adv */
  5773. + { "%usp", 13 }, /* Adv */
  5774. +};
  5775. +
  5776. +/* PE add T.Tazaki 2003/11/18 >>> */
  5777. +
  5778. +/* PE macro spesial registers */
  5779. +static const struct reg_name pe_system_registers[] =
  5780. +{
  5781. + { "%ahr", 3 },
  5782. + { "%alr", 2 },
  5783. + { "%dbbr", 11 },
  5784. + { "%idir", 10 },
  5785. + { "%pc", 15},
  5786. + { "%psr", 0 },
  5787. + { "%sp", 1 },
  5788. + { "%ttbr", 8 },
  5789. +};
  5790. +
  5791. +/* ld.w %sd,%rs special registers */
  5792. +static const struct reg_name pe_load_system_registers[] =
  5793. +{
  5794. + { "%ahr", 3 },
  5795. + { "%alr", 2 },
  5796. + { "%psr", 0 },
  5797. + { "%sp", 1 },
  5798. + { "%ttbr", 8 },
  5799. +};
  5800. +
  5801. +/* pushs , pops special registers */
  5802. +static const struct reg_name pe_pushs_system_registers[] =
  5803. +{
  5804. + { "%ahr", 3 },
  5805. + { "%alr", 2 },
  5806. +};
  5807. +
  5808. +/* PE add T.Tazaki 2003/11/18 <<< */
  5809. +
  5810. +#define SYSREG_NAME_CNT (sizeof (system_registers) / sizeof (struct reg_name))
  5811. +#define ADV_SYSREG_NAME_CNT (sizeof (adv_system_registers) / sizeof (struct reg_name))
  5812. +#define ADV_LOAD_SYSREG_NAME_CNT (sizeof (adv_load_system_registers) / sizeof (struct reg_name))
  5813. +#define ADV_PUSHS_SYSREG_NAME_CNT (sizeof (adv_pushs_system_registers) / sizeof (struct reg_name))
  5814. +
  5815. +/* PE add T.Tazaki 2003/11/18 >>> */
  5816. +#define PE_SYSREG_NAME_CNT (sizeof (pe_system_registers) / sizeof (struct reg_name))
  5817. +#define PE_LOAD_SYSREG_NAME_CNT (sizeof (pe_load_system_registers) / sizeof (struct reg_name))
  5818. +#define PE_PUSHS_SYSREG_NAME_CNT (sizeof (pe_pushs_system_registers) / sizeof (struct reg_name))
  5819. +/* PE add T.Tazaki 2003/11/18 <<< */
  5820. +
  5821. +/******************************************************************************
  5822. + INPUT const struct reg_name * register name
  5823. + int register string size
  5824. + const char * check register string
  5825. + boolean not used
  5826. + RETURN int register number
  5827. + Explanation Get register number
  5828. +******************************************************************************/
  5829. +/* reg_name_search does a binary search of the given register table
  5830. + to see if "name" is a valid regiter name. Returns the register
  5831. + number from the array on success, or -1 on failure. */
  5832. +
  5833. +static int
  5834. +reg_name_search (regs, regcount, name, accept_numbers)
  5835. + const struct reg_name * regs;
  5836. + int regcount;
  5837. + const char * name;
  5838. + boolean accept_numbers;
  5839. +{
  5840. + int middle, low, high;
  5841. + int cmp;
  5842. + symbolS * symbolP;
  5843. +#if 0
  5844. + /* If the register name is a symbol, then evaluate it. */
  5845. + if ((symbolP = symbol_find (name)) != NULL)
  5846. + {
  5847. + /* If the symbol is an alias for another name then use that.
  5848. + If the symbol is an alias for a number, then return the number. */
  5849. + if (symbol_equated_p (symbolP))
  5850. + {
  5851. + name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
  5852. + }
  5853. + else if (accept_numbers)
  5854. + {
  5855. + int reg = S_GET_VALUE (symbolP);
  5856. +
  5857. + if (reg >= 0 && reg <= 31)
  5858. + return reg;
  5859. + }
  5860. +#endif
  5861. +
  5862. + low = 0;
  5863. + high = regcount - 1;
  5864. +
  5865. + do
  5866. + {
  5867. + middle = (low + high) / 2;
  5868. + cmp = strcasecmp (name, regs[middle].name);
  5869. + if (cmp < 0)
  5870. + high = middle - 1;
  5871. + else if (cmp > 0)
  5872. + low = middle + 1;
  5873. + else
  5874. + return regs[middle].value;
  5875. + }
  5876. + while (low <= high);
  5877. +
  5878. + return -1;
  5879. +}
  5880. +
  5881. +
  5882. +/******************************************************************************
  5883. + INPUT expressionS * The pointer to a command code information structure object
  5884. + RETURN boolean TRUE ok
  5885. + FALSE error
  5886. + Explanation A register operand is changed into a command code.
  5887. +******************************************************************************/
  5888. +/* Summary of register_name().
  5889. + *
  5890. + * in: Input_line_pointer points to 1st char of operand.
  5891. + *
  5892. + * out: A expressionS.
  5893. + * The operand may have been a register: in this case, X_op == O_register,
  5894. + * X_add_number is set to the register number, and truth is returned.
  5895. + * Input_line_pointer->(next non-blank) char after operand, or is in
  5896. + * its original state.
  5897. + */
  5898. +static boolean
  5899. +register_name (expressionP)
  5900. + expressionS * expressionP;
  5901. +{
  5902. + int reg_number;
  5903. + char * name;
  5904. + char * start;
  5905. + char c;
  5906. + char *pNameEnd;
  5907. +
  5908. + /* Find the spelling of the operand */
  5909. + start = name = input_line_pointer;
  5910. +
  5911. + c = get_symbol_end ();
  5912. +
  5913. + /* Get register number */
  5914. + reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
  5915. + name, FALSE);
  5916. +
  5917. + * input_line_pointer = c; /* put back the delimiting char */
  5918. +
  5919. + /* look to see if it's in the register table */
  5920. + if (reg_number >= 0)
  5921. + {
  5922. + /* YES The right register number was acquirable. */
  5923. +
  5924. + /* That it is a register and a register number are saved. */
  5925. + expressionP->X_op = O_register;
  5926. + expressionP->X_add_number = reg_number;
  5927. +
  5928. + /* make the rest nice */
  5929. + expressionP->X_add_symbol = NULL;
  5930. + expressionP->X_op_symbol = NULL;
  5931. +
  5932. + return true;
  5933. + }
  5934. + else
  5935. + {
  5936. + /* 不正 */
  5937. + /* reset the line as if we had not done anything */
  5938. + input_line_pointer = start;
  5939. +
  5940. + return false;
  5941. + }
  5942. +}
  5943. +
  5944. +/******************************************************************************
  5945. + INPUT expressionS * The pointer to a command code information structure object
  5946. + boolean
  5947. + boolean
  5948. + RETURN boolean TRUE ok
  5949. + FALSE error
  5950. + Explanation A system register operand is changed into a command code.
  5951. +******************************************************************************/
  5952. +/* Summary of system_register_name().
  5953. + *
  5954. + * in: Input_line_pointer points to 1st char of operand.
  5955. + * expressionP points to an expression structure to be filled in.
  5956. + * accept_numbers is true iff numerical register names may be used.
  5957. + * accept_list_names is true iff the special names PS and SR may be
  5958. + * accepted.
  5959. + *
  5960. + * out: A expressionS structure in expressionP.
  5961. + * The operand may have been a register: in this case, X_op == O_register,
  5962. + * X_add_number is set to the register number, and truth is returned.
  5963. + * Input_line_pointer->(next non-blank) char after operand, or is in
  5964. + * its original state.
  5965. + */
  5966. +static boolean
  5967. +system_register_name (expressionP, accept_numbers, accept_list_names)
  5968. + expressionS * expressionP;
  5969. + boolean accept_numbers;
  5970. + boolean accept_list_names;
  5971. +{
  5972. + int reg_number;
  5973. + char * name;
  5974. + char * start;
  5975. + char c;
  5976. +
  5977. +
  5978. + /* Find the spelling of the operand */
  5979. + start = name = input_line_pointer;
  5980. +
  5981. + c = get_symbol_end ();
  5982. +
  5983. + /* get register number */
  5984. + if( g_iAdvance == 0 )
  5985. + {
  5986. + if( g_iPE == 0 )
  5987. + {
  5988. + /* STD */
  5989. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  5990. + accept_numbers);
  5991. + }
  5992. + else
  5993. + {
  5994. + /* PE */ /* add T.Tazaki 2003/11/18 */
  5995. + reg_number = reg_name_search (pe_system_registers, PE_SYSREG_NAME_CNT, name,
  5996. + accept_numbers);
  5997. + }
  5998. + }else{
  5999. + /* add tazaki 2001.11.12 */
  6000. + /* ADV */
  6001. + reg_number = reg_name_search (adv_system_registers, ADV_SYSREG_NAME_CNT, name,
  6002. + accept_numbers);
  6003. + }
  6004. +
  6005. + * input_line_pointer = c; /* put back the delimiting char */
  6006. +
  6007. +#if 0
  6008. + if (reg_number < 0 && accept_numbers)
  6009. + {
  6010. + input_line_pointer = start; /* reset input_line pointer */
  6011. +
  6012. + if (isdigit (* input_line_pointer))
  6013. + {
  6014. + reg_number = strtol (input_line_pointer, & input_line_pointer, 10);
  6015. +
  6016. + /* Make sure that the register number is allowable. */
  6017. + if ( reg_number < 0
  6018. + || reg_number > 5
  6019. + && reg_number < 16
  6020. + || reg_number > 20
  6021. + )
  6022. + {
  6023. + reg_number = -1;
  6024. + }
  6025. + }
  6026. + else if (accept_list_names)
  6027. + {
  6028. + c = get_symbol_end ();
  6029. +
  6030. +#if 0 /* c33 */
  6031. + reg_number = reg_name_search (system_list_registers,
  6032. + SYSREGLIST_NAME_CNT, name, FALSE);
  6033. +#endif
  6034. + * input_line_pointer = c; /* put back the delimiting char */
  6035. +
  6036. + }
  6037. + }
  6038. +#endif
  6039. + /* look to see if it's in the register table */
  6040. + if (reg_number >= 0)
  6041. + {
  6042. + expressionP->X_op = O_register;
  6043. + expressionP->X_add_number = reg_number;
  6044. +
  6045. + /* make the rest nice */
  6046. + expressionP->X_add_symbol = NULL;
  6047. + expressionP->X_op_symbol = NULL;
  6048. +
  6049. + return true;
  6050. + }
  6051. + else
  6052. + {
  6053. + /* reset the line as if we had not done anything */
  6054. + input_line_pointer = start;
  6055. +
  6056. + return false;
  6057. + }
  6058. +}
  6059. +
  6060. +
  6061. +CONST char * md_shortopts = "m:";
  6062. +
  6063. +struct option md_longopts[] =
  6064. +{
  6065. + {NULL, no_argument, NULL, 0}
  6066. +};
  6067. +size_t md_longopts_size = sizeof md_longopts;
  6068. +
  6069. +/******************************************************************************
  6070. + INPUT expressionS * The pointer to a command code information structure object
  6071. + boolean
  6072. + boolean
  6073. + RETURN boolean TRUE ok
  6074. + FALSE error
  6075. + Explanation A system register operand is changed into a command code.
  6076. + false : ld.w %pc,%rs
  6077. +******************************************************************************/
  6078. +static boolean
  6079. +load_system_register_name (expressionP, accept_numbers, accept_list_names)
  6080. + expressionS * expressionP;
  6081. + boolean accept_numbers;
  6082. + boolean accept_list_names;
  6083. +{
  6084. + int reg_number;
  6085. + char * name;
  6086. + char * start;
  6087. + char c;
  6088. +
  6089. +
  6090. + /* Find the spelling of the operand */
  6091. + start = name = input_line_pointer;
  6092. +
  6093. + c = get_symbol_end ();
  6094. +
  6095. + /* get register number */
  6096. + if( g_iAdvance == 0 )
  6097. + {
  6098. + if( g_iPE == 0 )
  6099. + {
  6100. + /* STD */
  6101. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  6102. + accept_numbers);
  6103. + }
  6104. + else
  6105. + {
  6106. + /* PE add T.Tazaki 2003/11/18 */
  6107. + reg_number = reg_name_search (pe_load_system_registers, PE_LOAD_SYSREG_NAME_CNT, name,
  6108. + accept_numbers);
  6109. + }
  6110. + }else{
  6111. + /* ADV */
  6112. + reg_number = reg_name_search (adv_load_system_registers, ADV_LOAD_SYSREG_NAME_CNT, name,
  6113. + accept_numbers);
  6114. + }
  6115. +
  6116. + * input_line_pointer = c; /* put back the delimiting char */
  6117. +
  6118. + /* look to see if it's in the register table */
  6119. + if (reg_number >= 0)
  6120. + {
  6121. + expressionP->X_op = O_register;
  6122. + expressionP->X_add_number = reg_number;
  6123. +
  6124. + /* make the rest nice */
  6125. + expressionP->X_add_symbol = NULL;
  6126. + expressionP->X_op_symbol = NULL;
  6127. +
  6128. + return true;
  6129. + }
  6130. + else
  6131. + {
  6132. + /* reset the line as if we had not done anything */
  6133. + input_line_pointer = start;
  6134. +
  6135. + return false;
  6136. + }
  6137. +}
  6138. +/******************************************************************************
  6139. + INPUT expressionS * The pointer to a command code information structure object
  6140. + boolean
  6141. + boolean
  6142. + RETURN boolean TRUE ok
  6143. + FALSE error
  6144. + Explanation A system register operand is changed into a command code.
  6145. + true : pushs %psr,%sp,%alr,%ahr,%lco,%lsa,%lea,%sor,%ttbr,%dp,%usp,%ssp,%pc
  6146. +******************************************************************************/
  6147. +static boolean
  6148. +pushs_system_register_name (expressionP, accept_numbers, accept_list_names)
  6149. + expressionS * expressionP;
  6150. + boolean accept_numbers;
  6151. + boolean accept_list_names;
  6152. +{
  6153. + int reg_number;
  6154. + char * name;
  6155. + char * start;
  6156. + char c;
  6157. +
  6158. +
  6159. + /* Find the spelling of the operand */
  6160. + start = name = input_line_pointer;
  6161. +
  6162. + c = get_symbol_end ();
  6163. +
  6164. + /* get register number */
  6165. + if( g_iAdvance == 0 )
  6166. + {
  6167. + if( g_iPE == 0 )
  6168. + {
  6169. + /* STD */
  6170. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  6171. + accept_numbers);
  6172. + }
  6173. + else
  6174. + {
  6175. + /* PE add T.Tazaki 2003/11/18 */
  6176. + reg_number = reg_name_search (pe_pushs_system_registers, PE_PUSHS_SYSREG_NAME_CNT, name,
  6177. + accept_numbers);
  6178. + }
  6179. + }else{
  6180. + /* ADV */
  6181. + reg_number = reg_name_search (adv_pushs_system_registers, ADV_PUSHS_SYSREG_NAME_CNT, name,
  6182. + accept_numbers);
  6183. + }
  6184. +
  6185. + * input_line_pointer = c; /* put back the delimiting char */
  6186. +
  6187. + /* look to see if it's in the register table */
  6188. + if (reg_number >= 0)
  6189. + {
  6190. + expressionP->X_op = O_register;
  6191. + expressionP->X_add_number = reg_number;
  6192. +
  6193. + /* make the rest nice */
  6194. + expressionP->X_add_symbol = NULL;
  6195. + expressionP->X_op_symbol = NULL;
  6196. +
  6197. + return true;
  6198. + }
  6199. + else
  6200. + {
  6201. + /* reset the line as if we had not done anything */
  6202. + input_line_pointer = start;
  6203. +
  6204. + return false;
  6205. + }
  6206. +}
  6207. +
  6208. +/******************************************************************************
  6209. + INPUT FILE* not used
  6210. + RETURN void
  6211. + Explanation display option
  6212. +******************************************************************************/
  6213. +void
  6214. +md_show_usage (stream)
  6215. + FILE * stream;
  6216. +{
  6217. + /* The special option for c33 is nothing. */
  6218. +}
  6219. +
  6220. +/******************************************************************************
  6221. + INPUT int not used
  6222. + char* not used
  6223. + RETURN int TRUE ok
  6224. + Explanation Argument (option) analysis
  6225. +******************************************************************************/
  6226. +int
  6227. +md_parse_option (c, arg)
  6228. + int c;
  6229. + char * arg;
  6230. +{
  6231. +#if 0
  6232. + int Num;
  6233. + int i;
  6234. + if (c != 'm')
  6235. + {
  6236. + /* xgettext:c-format */
  6237. + fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg);
  6238. + return 0;
  6239. + }
  6240. +
  6241. +#endif
  6242. + return 1;
  6243. +}
  6244. +
  6245. +/******************************************************************************
  6246. + INPUT char* not used
  6247. + RETURN symbolS* NULL
  6248. + Explanation Treatment of the symbol which is not defined
  6249. +******************************************************************************/
  6250. +symbolS *
  6251. +md_undefined_symbol (name)
  6252. + char * name;
  6253. +{
  6254. + return 0;
  6255. +}
  6256. +
  6257. +char *
  6258. +md_atof (type, litp, sizep)
  6259. + int type;
  6260. + char * litp;
  6261. + int * sizep;
  6262. +{
  6263. + int prec;
  6264. + LITTLENUM_TYPE words[4];
  6265. + char * t;
  6266. + int i;
  6267. +
  6268. + switch (type)
  6269. + {
  6270. + case 'f':
  6271. + prec = 2;
  6272. + break;
  6273. +
  6274. + case 'd':
  6275. + prec = 4;
  6276. + break;
  6277. +
  6278. + default:
  6279. + *sizep = 0;
  6280. + return _("bad call to md_atof");
  6281. + }
  6282. +
  6283. + t = atof_ieee (input_line_pointer, type, words);
  6284. + if (t)
  6285. + input_line_pointer = t;
  6286. +
  6287. + *sizep = prec * 2;
  6288. +
  6289. + for (i = prec - 1; i >= 0; i--)
  6290. + {
  6291. + md_number_to_chars (litp, (valueT) words[i], 2);
  6292. + litp += 2;
  6293. + }
  6294. +
  6295. + return NULL;
  6296. +}
  6297. +
  6298. +
  6299. +/* Very gross. */
  6300. +void
  6301. +md_convert_frag (abfd, sec, fragP)
  6302. + bfd * abfd;
  6303. + asection * sec;
  6304. + fragS * fragP;
  6305. +{
  6306. + subseg_change (sec, 0);
  6307. +
  6308. + /* In range conditional or unconditional branch. */
  6309. + if (fragP->fr_subtype == 0 || fragP->fr_subtype == 2)
  6310. + {
  6311. + fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
  6312. + fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int)fragP->fr_opcode);
  6313. + fragP->fr_var = 0;
  6314. + fragP->fr_fix += 2;
  6315. + }
  6316. + /* Out of range conditional branch. Emit a branch around a jump. */
  6317. + else if (fragP->fr_subtype == 1)
  6318. + {
  6319. + unsigned char *buffer =
  6320. + (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
  6321. +
  6322. + /* Reverse the condition of the first branch. */
  6323. + buffer[0] ^= 0x08;
  6324. + /* Mask off all the displacement bits. */
  6325. + buffer[0] &= 0x8f;
  6326. + buffer[1] &= 0x07;
  6327. + /* Now set the displacement bits so that we branch
  6328. + around the unconditional branch. */
  6329. + buffer[0] |= 0x30;
  6330. +
  6331. + /* Now create the unconditional branch + fixup to the final
  6332. + target. */
  6333. + md_number_to_chars (buffer + 2, 0x00000780, 4);
  6334. + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
  6335. + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
  6336. + (int) fragP->fr_opcode + 1);
  6337. + fragP->fr_var = 0;
  6338. + fragP->fr_fix += 6;
  6339. + }
  6340. + /* Out of range unconditional branch. Emit a jump. */
  6341. + else if (fragP->fr_subtype == 3)
  6342. + {
  6343. + md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
  6344. + fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  6345. + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
  6346. + (int) fragP->fr_opcode + 1);
  6347. + fragP->fr_var = 0;
  6348. + fragP->fr_fix += 4;
  6349. + }
  6350. + else
  6351. + abort ();
  6352. +}
  6353. +
  6354. +valueT
  6355. +md_section_align (seg, addr)
  6356. + asection * seg;
  6357. + valueT addr;
  6358. +{
  6359. + int align = bfd_get_section_alignment (stdoutput, seg);
  6360. + return ((addr + (1 << align) - 1) & (-1 << align));
  6361. +}
  6362. +
  6363. +/******************************************************************************
  6364. + INPUT NONE
  6365. + RETURN void
  6366. + Explanation An assembler initial cofiguration peculiar to a model
  6367. +******************************************************************************/
  6368. +void
  6369. +md_begin ()
  6370. +{
  6371. + char * prev_name = "";
  6372. + register const struct c33_opcode * op;
  6373. + flagword applicable;
  6374. +
  6375. + /* Create hash table */
  6376. + c33_hash = hash_new();
  6377. +
  6378. + /* Insert unique names into hash table. The C33 instruction set
  6379. + has many identical opcode names that have different opcodes based
  6380. + on the operands. This hash table then provides a quick index to
  6381. + the first opcode with a particular name in the opcode table. */
  6382. +
  6383. + /* nemonic registered into the operation code table is registered into a hash table.*/
  6384. +
  6385. + /* >>>>>> tazaki 2001.11.07 */
  6386. + if( g_iAdvance == 0 ) /* cpu = standard ? */
  6387. + {
  6388. + if( g_iPE == 0 )
  6389. + {
  6390. + if( g_iMedda32 == 0 )
  6391. + {
  6392. + op = c33_opcodes; /* STANDARD table */
  6393. + }
  6394. + else
  6395. + {
  6396. + op = c33_opcodes32; /* STANDARD table : No use default data area add T.Tazaki 2004/07/30 */
  6397. + }
  6398. + }
  6399. + else
  6400. + {
  6401. + if( g_iMedda32 == 0 )
  6402. + {
  6403. + op = c33_pe_opcodes; /* PE table add T.Tazaki 2003/11/18 */
  6404. + }
  6405. + else
  6406. + {
  6407. + op = c33_pe_opcodes32; /* PE table : No use default data area add T.Tazaki 2004/07/30 */
  6408. + }
  6409. + }
  6410. + }
  6411. + else
  6412. + {
  6413. + if( g_iMedda32 == 0 )
  6414. + {
  6415. + op = c33_advance_opcodes; /* ADVANCE table */
  6416. + }
  6417. + else
  6418. + {
  6419. + op = c33_advance_opcodes32; /* ADVANCE table : No use default data area add T.Tazaki 2004/07/30 */
  6420. + }
  6421. + }
  6422. + /* <<<<<< tazaki 2001.11.07 */
  6423. +
  6424. + while (op->name)
  6425. + {
  6426. + if (strcmp (prev_name, op->name))
  6427. + {
  6428. + prev_name = (char *) op->name;
  6429. + hash_insert (c33_hash, op->name, (char *) op);
  6430. + }
  6431. + op++;
  6432. + }
  6433. +#if 0 /* c33 */
  6434. + bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
  6435. +#endif /* c33 */
  6436. +
  6437. + applicable = bfd_applicable_section_flags (stdoutput);
  6438. +}
  6439. +
  6440. +/******************************************************************************
  6441. + INPUT int NONE
  6442. + RETURN bfd_reloc_code_real_type
  6443. + Explanation analysys symbol mask
  6444. +******************************************************************************/
  6445. +/* Warning: The code in this function relies upon the definitions
  6446. + in the c33_operands[] array (defined in opcodes/c33-opc.c)
  6447. + matching the hard coded values contained herein. */
  6448. +
  6449. +static bfd_reloc_code_real_type
  6450. +c33_reloc_prefix ()
  6451. +{
  6452. +
  6453. + /* Is it the prefix of a symbol mask? */
  6454. + if (*input_line_pointer == '@'){
  6455. + input_line_pointer++;
  6456. + }else{
  6457. +
  6458. + /* NO */
  6459. + return BFD_RELOC_UNUSED;
  6460. + }
  6461. +#define CHECK_(name, reloc) \
  6462. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  6463. + { \
  6464. + input_line_pointer += strlen (name); \
  6465. + return reloc; \
  6466. + }
  6467. +
  6468. + CHECK_ ("ah", BFD_RELOC_C33_AH); /* LABEL(25:13) */
  6469. + CHECK_ ("al", BFD_RELOC_C33_AL); /* LABEL(12:0) */
  6470. + CHECK_ ("rh", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
  6471. + CHECK_ ("rm", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
  6472. + CHECK_ ("rl", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
  6473. + CHECK_ ("h", BFD_RELOC_C33_H); /* LABEL(31:19) */
  6474. + CHECK_ ("m", BFD_RELOC_C33_M); /* LABEL(18:6) */
  6475. + CHECK_ ("l", BFD_RELOC_C33_L); /* LABEL(5:0) */
  6476. +
  6477. + CHECK_ ("AH", BFD_RELOC_C33_AH); /* LABEL(25:13) */
  6478. + CHECK_ ("AL", BFD_RELOC_C33_AL); /* LABEL(12:0) */
  6479. + CHECK_ ("RH", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
  6480. + CHECK_ ("RM", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
  6481. + CHECK_ ("RL", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
  6482. + CHECK_ ("H", BFD_RELOC_C33_H); /* LABEL(31:19) */
  6483. + CHECK_ ("M", BFD_RELOC_C33_M); /* LABEL(18:6) */
  6484. + CHECK_ ("L", BFD_RELOC_C33_L); /* LABEL(5:0) */
  6485. +
  6486. + return BFD_RELOC_UNUSED;
  6487. +}
  6488. +
  6489. +/* add tazaki 2001.12.03 >>>>> */
  6490. +
  6491. +/* Warning: The code in this function relies upon the definitions
  6492. + in the c33_operands[] array (defined in opcodes/c33-opc.c)
  6493. + matching the hard coded values contained herein. */
  6494. +
  6495. +/******************************************************************************
  6496. + INPUT int NONE
  6497. + RETURN bfd_reloc_code_real_type
  6498. + Explanation analisys symbol offset
  6499. +******************************************************************************/
  6500. +static bfd_reloc_code_real_type
  6501. +c33_reloc_prefix_offset ()
  6502. +{
  6503. + boolean paren_skipped = false;
  6504. +
  6505. +
  6506. +#define CHECK2_(name, reloc) \
  6507. + if (strncmp (input_line_pointer, name##"(", strlen (name) + 1 ) == 0) \
  6508. + { \
  6509. + input_line_pointer += strlen (name); \
  6510. + return reloc; \
  6511. + }
  6512. +
  6513. + CHECK2_ ("doff_hi", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
  6514. + CHECK2_ ("doff_lo", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
  6515. + CHECK2_ ("goff_lo", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
  6516. + CHECK2_ ("soff_hi", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
  6517. + CHECK2_ ("soff_lo", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
  6518. + CHECK2_ ("toff_hi", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
  6519. + CHECK2_ ("toff_lo", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
  6520. + CHECK2_ ("zoff_hi", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
  6521. + CHECK2_ ("zoff_lo", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
  6522. + CHECK2_ ("dpoff_h", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
  6523. + CHECK2_ ("dpoff_m", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
  6524. + CHECK2_ ("dpoff_l", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
  6525. +
  6526. + CHECK2_ ("DOFF_HI", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
  6527. + CHECK2_ ("DOFF_LO", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
  6528. + CHECK2_ ("GOFF_LO", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
  6529. + CHECK2_ ("SOFF_HI", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
  6530. + CHECK2_ ("SOFF_LO", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
  6531. + CHECK2_ ("TOFF_HI", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
  6532. + CHECK2_ ("TOFF_LO", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
  6533. + CHECK2_ ("ZOFF_HI", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
  6534. + CHECK2_ ("ZOFF_LO", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
  6535. + CHECK2_ ("DPOFF_H", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
  6536. + CHECK2_ ("DPOFF_M", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
  6537. + CHECK2_ ("DPOFF_L", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
  6538. +
  6539. + return BFD_RELOC_UNUSED;
  6540. +
  6541. +}
  6542. +
  6543. +/* add tazaki 2002.02.29 >>>>> */
  6544. +/******************************************************************************
  6545. + INPUT NONE
  6546. + RETURN operand code
  6547. + advanced macro "EXT COND" instruction operand analysis
  6548. +******************************************************************************/
  6549. +static int
  6550. +c33_condition ()
  6551. +{
  6552. + boolean paren_skipped = false;
  6553. +
  6554. +
  6555. +#define CHECK3_(name, cond) \
  6556. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  6557. + { \
  6558. + input_line_pointer += strlen (name); \
  6559. + return cond; \
  6560. + }
  6561. +
  6562. + CHECK3_ ("gt", 0x04);
  6563. + CHECK3_ ("ge", 0x05);
  6564. + CHECK3_ ("lt", 0x06);
  6565. + CHECK3_ ("le", 0x07);
  6566. + CHECK3_ ("ugt", 0x08);
  6567. + CHECK3_ ("uge", 0x09);
  6568. + CHECK3_ ("ult", 0x0a);
  6569. + CHECK3_ ("ule", 0x0b);
  6570. + CHECK3_ ("eq", 0x0c);
  6571. + CHECK3_ ("ne", 0x0d);
  6572. +
  6573. + return 0;
  6574. +
  6575. +}
  6576. +/* add tazaki 2002.02.29 >>>>> */
  6577. +/******************************************************************************
  6578. + INPUT NONE
  6579. + RETURN operand code
  6580. + advanced macro "EXT OP,imm2" or "EXT %RB,OP,imm2" instruction operand analysis
  6581. +******************************************************************************/
  6582. +static int
  6583. +c33_op_shift ()
  6584. +{
  6585. + boolean paren_skipped = false;
  6586. +
  6587. +
  6588. +#define CHECK4_(name, op_shift_code) \
  6589. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  6590. + { \
  6591. + input_line_pointer += strlen (name); \
  6592. + return op_shift_code; \
  6593. + }
  6594. +
  6595. + CHECK4_ ("sra", 0x01);
  6596. + CHECK4_ ("srl", 0x02);
  6597. + CHECK4_ ("sll", 0x03);
  6598. +
  6599. + return 0;
  6600. +
  6601. +}
  6602. +
  6603. +/******************************************************************************
  6604. + INPUT unsigned long
  6605. + const struct c33_operand* operand
  6606. + offsetT
  6607. + char*
  6608. + unsigned int
  6609. + char*
  6610. + int
  6611. + RETURN unsigned long
  6612. + Explanation An operand and an operation code are made into a command code.
  6613. +******************************************************************************/
  6614. + unsigned long ulrd; /* add T.Tazaki 2004/07/23 */
  6615. +
  6616. +/* Insert an operand value into an instruction. */
  6617. +static unsigned long
  6618. +c33_insert_operand (insn, operand, val, file, line, str,flags)
  6619. + unsigned long insn;
  6620. + const struct c33_operand * operand;
  6621. + offsetT val;
  6622. + char * file;
  6623. + unsigned int line;
  6624. + char * str;
  6625. + int flags;
  6626. +{
  6627. +
  6628. + long min, max, lval;
  6629. + unsigned long ulValue, ulMask;
  6630. + int iSign;
  6631. +
  6632. + /* Does a function exist? */
  6633. + if (operand->insert)
  6634. + {
  6635. + /* YES */
  6636. +
  6637. + const char * message = NULL;
  6638. +
  6639. + insn = operand->insert (insn, val, & message);
  6640. + if (message != NULL)
  6641. + {
  6642. + if (str)
  6643. + {
  6644. + if (file == (char *) NULL)
  6645. + as_warn ("%s: %s", str, message);
  6646. + else
  6647. + as_warn_where (file, line, "%s: %s", str, message);
  6648. + }
  6649. + else
  6650. + {
  6651. + if (file == (char *) NULL)
  6652. + as_warn (message);
  6653. + else
  6654. + as_warn_where (file, line, message);
  6655. + }
  6656. + }
  6657. + }
  6658. + else
  6659. + {
  6660. + /* NO */
  6661. +
  6662. +// long min, max, lval;
  6663. +// unsigned long ulValue, ulMask;
  6664. +// int iSign;
  6665. +
  6666. + lval = val; /* T.Tazaki 2002.02.27 */
  6667. +
  6668. + if( operand->range < 32 ){
  6669. +
  6670. + /* Restore min and mix to expected values for decimal ranges. */
  6671. +
  6672. + if (flags & C33_OPERAND_SIGNED){
  6673. +
  6674. + ulValue = val;
  6675. +
  6676. + ulMask = 0xffffffff >> ( operand->range - 1 );
  6677. + ulMask <<= ( operand->range - 1 );
  6678. + if(( ulValue & ulMask ) == ulMask ){
  6679. + iSign = 1; /* (-) */ /* "jp 0xffffff81" */
  6680. + }else{
  6681. + if( ( ulValue & ulMask ) == (1 << ( operand->range - 1 )) ){ /* only sign bit = 1 ? */
  6682. + iSign = 1; /* (-) */ /* "jp 0x81" */
  6683. + }else{
  6684. + if(( ulValue & ulMask ) == 0 ){ /* sign bit = 0 ? */
  6685. + iSign = 0; /* (+) */ /* "jp 0x40" */
  6686. + }else{
  6687. + iSign = 2; /* Warninng */
  6688. + }
  6689. + }
  6690. + }
  6691. +
  6692. + if( iSign == 2 ){ /* Invalid range ? "jp 0x102" */
  6693. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  6694. + char buf[100];
  6695. +
  6696. + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
  6697. + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
  6698. + if (str)
  6699. + {
  6700. + sprintf (buf, "%s: ", str);
  6701. +
  6702. + sprint_value (buf + strlen (buf), val);
  6703. + }
  6704. + else
  6705. + sprint_value (buf, lval);
  6706. +
  6707. + if (file == (char *) NULL)
  6708. + as_warn (err, buf, min, max);
  6709. + else
  6710. + as_warn_where (file, line, err, buf, min, max);
  6711. + }
  6712. + else
  6713. + {
  6714. + if( iSign == 0 ){ /* (+) ? */
  6715. + lval = val;
  6716. + }else{
  6717. + if( iSign == 1 ){ /* (-) ? */
  6718. + lval = ulValue | ulMask; /* sign extend */
  6719. + }
  6720. + }
  6721. +
  6722. + /* max = (1 << ( operand->bits - 1 )) - 1;
  6723. + min = - (1 << (operand->bits - 1)); */
  6724. + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
  6725. + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
  6726. +
  6727. + if (lval < min || lval > max)
  6728. + {
  6729. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  6730. + char buf[100];
  6731. +
  6732. + if (str)
  6733. + {
  6734. + sprintf (buf, "%s: ", str);
  6735. +
  6736. + sprint_value (buf + strlen (buf), lval);
  6737. + }
  6738. + else
  6739. + sprint_value (buf, lval);
  6740. +
  6741. + if (file == (char *) NULL)
  6742. + as_warn (err, buf, min, max);
  6743. + else
  6744. + as_warn_where (file, line, err, buf, min, max);
  6745. + }
  6746. + }
  6747. + }
  6748. + else {
  6749. + /* It asks for the range of effective value. */
  6750. + max = (1 << operand->bits) - 1;
  6751. + min = 0;
  6752. +
  6753. + /* Value is range outside. */
  6754. + if (lval < (offsetT) min || lval > (offsetT) max)
  6755. + {
  6756. + /* xgettext:c-format */
  6757. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  6758. + char buf[100];
  6759. +
  6760. + if (str)
  6761. + {
  6762. + sprintf (buf, "%s: ", str);
  6763. +
  6764. + sprint_value (buf + strlen (buf), lval);
  6765. + }
  6766. + else
  6767. + sprint_value (buf, lval);
  6768. +
  6769. + if (file == (char *) NULL)
  6770. + as_warn (err, buf, min, max);
  6771. + else
  6772. + as_warn_where (file, line, err, buf, min, max);
  6773. + }
  6774. + }
  6775. + }
  6776. +
  6777. + /* An operand and an operation code are made into a command code. */
  6778. +// insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
  6779. + insn |= (((long) lval & ((1 << operand->bits) - 1)) << operand->shift); /* T.Tazaki 2002.02.27 */
  6780. +/* >>>> add tazaki advanced macro */
  6781. + if (flags & C33_OPERAND_01) {
  6782. + insn |= 0x0010; /* bit 5,4 = 0,1 set */
  6783. + }
  6784. + if (flags & C33_OPERAND_OP3_01) {
  6785. + insn |= 0x0040; /* bit 7,6 = 0,1 set : psrset imm5 */
  6786. + }
  6787. + if (flags & C33_OPERAND_OP3_10){
  6788. + insn |= 0x0080; /* bit 7,6 = 1,0 set : psrclr imm5 */
  6789. + }
  6790. +/* <<<< add tazaki advanced macro */
  6791. + }
  6792. + return insn;
  6793. +}
  6794. +
  6795. +
  6796. +static char copy_of_instruction [128];
  6797. +
  6798. +void
  6799. +md_assemble (str)
  6800. + char * str;
  6801. +{
  6802. + char * s;
  6803. + char * start_of_operands;
  6804. + struct c33_opcode * opcode;
  6805. + struct c33_opcode * opcode2; /* add tazaki 2001.08.10 */
  6806. + struct c33_opcode * next_opcode;
  6807. + const unsigned char * opindex_ptr;
  6808. + int next_opindex;
  6809. + int relaxable;
  6810. + unsigned short insn;
  6811. + unsigned short insn_wk; /* add tazaki 2001.12.11 */
  6812. + unsigned short copy_insn;
  6813. + char * f; /* insn address */
  6814. + char * where; /* insn address */
  6815. + int i;
  6816. + int match;
  6817. + boolean extra_data_befor_insn = false;
  6818. + unsigned int extra_data_len;
  6819. + unsigned short extraInsnBuf[10];
  6820. + char * saved_input_line_pointer;
  6821. + char * check_input_line_pointer;
  6822. + char * temp_input_line_pointer;
  6823. + unsigned short * fromP;
  6824. + int iNumber;
  6825. + unsigned int uiNumber; /* add tazaki 2002.03.11 */
  6826. +
  6827. + int i_ext_off; /* add tazaki 2001.08.07 */
  6828. + int iMEM_IMM26_flag; /* add tazaki 2001.10.11 */
  6829. + char * pSymbolName ; /* for [imm26] add tazaki 2001.11.28 */
  6830. + char szSymbolName[300]; /* for [imm26] add tazaki 2001.11.28 */
  6831. + char * temp_pointer; /* for [imm26] add tazaki 2001.11.28 */
  6832. +
  6833. + int g_iBitTest = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
  6834. + int g_iBitTest_range = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
  6835. + int g_iXload = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
  6836. + int g_iXload_range = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
  6837. +
  6838. + pSymbolName = &szSymbolName[0]; /* Symbol name pointer domain initialization for [imm26] add tazaki 2001.11.28*/
  6839. +
  6840. + /* The command character sequence for one line is copied. */
  6841. + strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
  6842. +
  6843. + /* It is made a character sequence as an operation code. */
  6844. + /* Get the opcode. */
  6845. + for (s = str; *s != '\0' && ! isspace (*s); s++)
  6846. + continue;
  6847. +
  6848. + if (*s != '\0')
  6849. + *s++ = '\0';
  6850. +
  6851. + /* find the first opcode with the proper name */
  6852. + opcode = (struct c33_opcode *) hash_find (c33_hash, str);
  6853. +
  6854. + /* not find operation code? */
  6855. + if (opcode == NULL) {
  6856. + /* xgettext:c-format */
  6857. + as_bad (_("Unrecognized opcode: `%s'"), str);
  6858. + ignore_rest_of_line ();
  6859. + return;
  6860. + }
  6861. +
  6862. + /* The space from an operation code to an operand is skipped. */
  6863. + str = s;
  6864. + while (isspace (* str))
  6865. + ++ str;
  6866. +
  6867. + /* The start position of an operand is held. */
  6868. + start_of_operands = str;
  6869. +
  6870. + saved_input_line_pointer = input_line_pointer;
  6871. +
  6872. + /* An interpretation of an operand */
  6873. + for (;;) {
  6874. + const char * errmsg = NULL;
  6875. +
  6876. + match = 0;
  6877. +
  6878. + relaxable = 0;
  6879. + fc = 0;
  6880. + next_opindex = 0;
  6881. + insn = opcode->opcode;
  6882. + extra_data_befor_insn = false;
  6883. +
  6884. + iMEM_IMM26_flag = 0; /* add tazaki 2001.10.11 */
  6885. +
  6886. + /* The start position of an operand is held. */
  6887. + input_line_pointer = str = start_of_operands;
  6888. +
  6889. + /* Only the number of operands is repeated. */
  6890. + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr ++)
  6891. + {
  6892. + const struct c33_operand * operand;
  6893. + char * hold;
  6894. + expressionS ex;
  6895. + expressionS ext_ex;
  6896. + bfd_reloc_code_real_type reloc;
  6897. +
  6898. + int flags;
  6899. +
  6900. + if (next_opindex == 0)
  6901. + {
  6902. + /* An operand is acquired. */
  6903. + operand = & c33_operands[ * opindex_ptr ];
  6904. + }
  6905. + else
  6906. + {
  6907. + operand = & c33_operands[ next_opindex ];
  6908. + next_opindex = 0;
  6909. + }
  6910. +
  6911. + flags = operand->flags;
  6912. + errmsg = NULL;
  6913. +
  6914. + while (*str == ' ' || *str == ',' || *str == ']')
  6915. + ++ str;
  6916. +
  6917. + /* Gather the operand. */
  6918. + hold = input_line_pointer;
  6919. + input_line_pointer = str;
  6920. +
  6921. + errmsg = NULL;
  6922. +
  6923. + /* tazaki 2002.01.11 >>>>>> */
  6924. + i_ext_off = 0;
  6925. + opcode2 = (struct c33_opcode *)c33_ext_opcodes;
  6926. + if( opcode->opcode == opcode2->opcode ){
  6927. + /* ext xoff_hi(sym),ext xoff_lo(sym),ext dpoff_h,m(sym) : analisys symbol offset */
  6928. + reloc = c33_reloc_prefix_offset ();
  6929. + if( reloc != BFD_RELOC_UNUSED ){
  6930. + i_ext_off = 1;
  6931. + }
  6932. + }
  6933. + if( i_ext_off == 1 )
  6934. + {
  6935. + /* ext 命令 and xoff_hi(sym),ext xoff_lo(sym),dpoff_h,m(sym) ? */
  6936. +
  6937. + /* read symbol , disp */
  6938. +
  6939. + expression (& ex);
  6940. +
  6941. + if (fc >= MAX_INSN_FIXUPS)
  6942. + as_fatal (_("too many fixups"));
  6943. +
  6944. + fixups[ fc ].exp = ex;
  6945. + fixups[ fc ].opindex = * opcode->operands;
  6946. + fixups[ fc ].reloc = reloc;
  6947. + ++fc;
  6948. +
  6949. + }
  6950. + else
  6951. + {
  6952. + /* >>>> add tazaki 2002.02.29 class1 : ext cond*/
  6953. + if ((operand->flags & C33_OPERAND_COND) == C33_OPERAND_COND)
  6954. + {
  6955. + int iCond = c33_condition(); /* get operand code */
  6956. + if( iCond != 0 ){
  6957. +
  6958. + ex.X_op = O_cond;
  6959. + ex.X_add_number = iCond;
  6960. +
  6961. + }else{
  6962. + errmsg = _("invalid operand");
  6963. + }
  6964. + }
  6965. + /* >>>> add tazaki 2002.02.29 class1 : ext OP,imm2 | ext %rb,OP,imm2 */
  6966. + else if ((operand->flags & C33_OPERAND_OP_SHIFT) == C33_OPERAND_OP_SHIFT)
  6967. + {
  6968. + int iShiftCode = c33_op_shift(); /* get operand code */
  6969. + if( iShiftCode != 0 ){
  6970. +
  6971. + ex.X_op = O_op_shift;
  6972. + ex.X_add_number = iShiftCode;
  6973. +
  6974. + }else{
  6975. + errmsg = _("invalid operand");
  6976. + }
  6977. + }
  6978. + /* >>>> add tazaki 2001.09.18 class7 : [%dp+imm6]*/
  6979. + else if ((operand->flags & C33_OPERAND_DPMEM) == C33_OPERAND_DPMEM)
  6980. + {
  6981. + if (*str == '['){
  6982. + str++;
  6983. + while (isspace (*str))
  6984. + ++str;
  6985. +
  6986. + input_line_pointer = str;
  6987. +
  6988. + /* %dp ? */
  6989. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  6990. + {
  6991. + /* YES */
  6992. + errmsg = _("invalid system register name");
  6993. + }
  6994. + else {
  6995. + str+=3;
  6996. + while (isspace (*str))
  6997. + ++str;
  6998. +
  6999. + /* IF ']' */
  7000. + if (*str == ']'){
  7001. + /* YES only register */
  7002. + /* Support only"[%dp]" */
  7003. + ex.X_op = O_constant;
  7004. + ex.X_add_symbol = NULL;
  7005. + ex.X_op_symbol = NULL;
  7006. + ex.X_add_number = 0;
  7007. + str++;
  7008. + input_line_pointer = str;
  7009. + }
  7010. + else if (*str == '+'){
  7011. + str++;
  7012. + input_line_pointer = str;
  7013. +
  7014. + reloc = c33_reloc_prefix_offset();
  7015. + if( reloc != BFD_RELOC_UNUSED ){ /* dpoff_l() ? */
  7016. + errmsg = _("invalid operand");
  7017. + }
  7018. + else
  7019. + {
  7020. + /* An operand is developed at a formula. */
  7021. + expression (& ex);
  7022. +
  7023. + iNumber = ex.X_add_number;
  7024. +
  7025. + if (operand->range <= 6){
  7026. + /* EMPTY */
  7027. + }
  7028. + else if (operand->range == 32) {
  7029. + /* update tazaki 2002.03.08 >>> */
  7030. + if (opcode->specialFlag == 1){
  7031. + /* ld.b */
  7032. + if ((unsigned int)iNumber <= 0x3f){
  7033. + ex.X_add_number /= 1;
  7034. +
  7035. + }else if ((unsigned int)iNumber <= 0x7ffff){
  7036. + /* 1 ext */
  7037. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7038. + extra_data_befor_insn = true;
  7039. + extra_data_len = 1;
  7040. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7041. + ex.X_add_number = iNumber & 0x3f;
  7042. + }
  7043. + else {
  7044. + /* 2 ext */
  7045. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7046. + extra_data_befor_insn = true;
  7047. + extra_data_len = 2;
  7048. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  7049. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  7050. + ex.X_add_number = iNumber & 0x3f;
  7051. + }
  7052. + }
  7053. + else if (opcode->specialFlag == 2){
  7054. + /* ld.h */
  7055. + if ((unsigned int)iNumber <= 0x7f){
  7056. + ex.X_add_number /= 2;
  7057. +
  7058. + }else if ((unsigned int)iNumber <= 0x7ffff){
  7059. + /* 1 ext */
  7060. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7061. + extra_data_befor_insn = true;
  7062. + extra_data_len = 1;
  7063. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7064. + ex.X_add_number = iNumber & 0x3f;
  7065. + }
  7066. + else {
  7067. + /* 2 ext */
  7068. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7069. + extra_data_befor_insn = true;
  7070. + extra_data_len = 2;
  7071. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  7072. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  7073. + ex.X_add_number = iNumber & 0x3f;
  7074. + }
  7075. + }
  7076. + else if (opcode->specialFlag == 4){
  7077. + /* ld.w */
  7078. + if ((unsigned int)iNumber <= 0xff){
  7079. + ex.X_add_number /= 4;
  7080. +
  7081. + }else if ((unsigned int)iNumber <= 0x7ffff){
  7082. + /* 1 ext */
  7083. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7084. + extra_data_befor_insn = true;
  7085. + extra_data_len = 1;
  7086. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7087. + ex.X_add_number = iNumber & 0x3f;
  7088. + }
  7089. + else {
  7090. + /* 2 ext */
  7091. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7092. + extra_data_befor_insn = true;
  7093. + extra_data_len = 2;
  7094. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  7095. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  7096. + ex.X_add_number = iNumber & 0x3f;
  7097. + }
  7098. + }
  7099. + /* update tazaki 2002.03.08 <<< */
  7100. + }
  7101. + else {
  7102. + errmsg = _("constant too big to fit into instruction");
  7103. + }
  7104. + }
  7105. + }
  7106. + else{
  7107. + /* YES */
  7108. + errmsg = _("invalid operand");
  7109. + }
  7110. + }
  7111. + }
  7112. + else
  7113. + errmsg = _("invalid operand");
  7114. + }
  7115. +
  7116. + /* >>>> add tazaki 2002.01.15 class7 : [%dp+dpoff_l(symbol)]*/
  7117. + else if ((operand->flags & C33_OPERAND_DPSYMBOL6) == C33_OPERAND_DPSYMBOL6)
  7118. + {
  7119. + if (*str == '['){
  7120. + str++;
  7121. + while (isspace (*str))
  7122. + ++str;
  7123. +
  7124. + input_line_pointer = str;
  7125. +
  7126. + /* %dp ? */
  7127. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  7128. + {
  7129. + /* YES */
  7130. + errmsg = _("invalid system register name");
  7131. + }
  7132. + else {
  7133. + str+=3;
  7134. + while (isspace (*str))
  7135. + ++str;
  7136. +
  7137. + /* IF ']' */
  7138. + if (*str == ']'){
  7139. + /* YES only register */
  7140. + /* Support only"[%dp] */
  7141. + ex.X_op = O_constant;
  7142. + ex.X_add_symbol = NULL;
  7143. + ex.X_op_symbol = NULL;
  7144. + ex.X_add_number = 0;
  7145. + str++;
  7146. + input_line_pointer = str;
  7147. + }
  7148. + else
  7149. + {
  7150. + if (*str == '+'){
  7151. + /* [%dp+dpoff_l(symbol)] */
  7152. + str++;
  7153. + input_line_pointer = str;
  7154. +
  7155. + reloc = c33_reloc_prefix_offset();
  7156. + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
  7157. +
  7158. + expression (& ex);
  7159. +
  7160. + if (ex.X_op != O_symbol){ /* not symbol ? */
  7161. + errmsg = _("invalid operand");
  7162. + }
  7163. + }else{
  7164. + errmsg = _("invalid operand");
  7165. + }
  7166. + }else{
  7167. + errmsg = _("invalid operand");
  7168. + }
  7169. + }
  7170. + }
  7171. + }
  7172. + else
  7173. + errmsg = _("invalid operand");
  7174. + }
  7175. +
  7176. + /* >>>> add tazaki 2002.01.15 class7 : dpoff_l(symbol) */
  7177. + else if ((operand->flags & C33_OPERAND_DPSYMBOL6_2) == C33_OPERAND_DPSYMBOL6_2)
  7178. + {
  7179. + reloc = c33_reloc_prefix_offset();
  7180. + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
  7181. +
  7182. + expression (& ex);
  7183. +
  7184. + if (ex.X_op != O_symbol){ /* not symbol ? */
  7185. + errmsg = _("invalid operand");
  7186. + }
  7187. + }else{
  7188. + errmsg = _("invalid operand");
  7189. + }
  7190. + }
  7191. + /* >>>> add tazaki 2001.12.21 class0 : %dp */
  7192. +
  7193. + else if ((operand->flags & C33_OPERAND_DP) == C33_OPERAND_DP)
  7194. + {
  7195. + /* check %dp ? */
  7196. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  7197. + {
  7198. + /* NO */
  7199. + errmsg = _("invalid system register name");
  7200. + }else{
  7201. + str+=3;
  7202. + while (isspace (*str))
  7203. + ++str;
  7204. + input_line_pointer = str;
  7205. +
  7206. + ex.X_op = O_dpregister;
  7207. + /* In %dp, an operand is not inserted in a command code. */
  7208. + }
  7209. + /* <<<< add tazaki 2001.12.21 class0 : %dp */
  7210. + }
  7211. + else if ((operand->flags & C33_OPERAND_REG) != 0)
  7212. + {
  7213. + if (!register_name (& ex))
  7214. + {
  7215. + /* YES */
  7216. + errmsg = _("invalid register name");
  7217. + }
  7218. + }
  7219. + else if ((operand->flags & C33_OPERAND_LD_SREG) != 0) /* add 2002.06.19 error : ld.w %pc,%rs */
  7220. + {
  7221. + if (!load_system_register_name (& ex, true, false))
  7222. + {
  7223. + errmsg = _("invalid system register name");
  7224. + }
  7225. + }
  7226. + else if ((operand->flags & C33_OPERAND_PUSHS_SREG) != 0) /* add 2002.06.19 : pushs %ss ,pops %sd */
  7227. + {
  7228. + if (!pushs_system_register_name (& ex, true, false))
  7229. + {
  7230. + errmsg = _("invalid system register name");
  7231. + }
  7232. + }
  7233. + else if (((operand->flags & C33_OPERAND_SREG) != 0) ||
  7234. + ((operand->flags & C33_OPERAND_SP) != 0))
  7235. + {
  7236. + if (!system_register_name (& ex, true, false))
  7237. + {
  7238. + errmsg = _("invalid system register name");
  7239. + }
  7240. + else {
  7241. + /* NO register OK */
  7242. + if ((operand->flags & C33_OPERAND_SP) != 0)
  7243. + {
  7244. + ex.X_op = O_spregister;
  7245. + /* In %sp, an operand is not inserted in a command code. */
  7246. + }
  7247. + }
  7248. + }
  7249. + /* ELSE IF Operand is immidiate ? */
  7250. + else if ((operand->flags & C33_OPERAND_IMM) ||
  7251. + (operand->flags & C33_OPERAND_SIGNED))
  7252. + {
  7253. +
  7254. + expression (& ex);
  7255. +
  7256. + /* IF Operand is constant ?*/
  7257. + if (ex.X_op == O_constant)
  7258. + {
  7259. + if (opcode->specialFlag == 5){
  7260. +
  7261. + /* shift/lotate */
  7262. +
  7263. + iNumber = ex.X_add_number;
  7264. + if( iNumber > 8 ){
  7265. +
  7266. + errmsg = _("operand out of range (not between 0 and 8)");
  7267. + }else{
  7268. + extra_data_len = 0;
  7269. + ex.X_add_number = iNumber;
  7270. + }
  7271. + }else if (opcode->specialFlag == 6){
  7272. +
  7273. + /* 拡張命令のshift/lotate */
  7274. +
  7275. + iNumber = ex.X_add_number;
  7276. + if( iNumber > 31 ){
  7277. + errmsg = _("operand out of range (not between 0 and 31)");
  7278. + }else{
  7279. + extra_data_len = 0;
  7280. + while(iNumber > 8){
  7281. + extra_data_befor_insn = true;
  7282. + copy_insn = c33_insert_operand (insn, operand,8,
  7283. + (char *) NULL, 0,
  7284. + copy_of_instruction,flags);
  7285. + extraInsnBuf[extra_data_len] = copy_insn;
  7286. + extra_data_len++;
  7287. + ex.X_add_number = 8;
  7288. + iNumber -= 8;
  7289. + }
  7290. + ex.X_add_number = iNumber;
  7291. + }
  7292. + }else if (opcode->specialFlag == 7){
  7293. +
  7294. + /* Advanced mode "X" Extended of shift/lotate */
  7295. + iNumber = ex.X_add_number;
  7296. + if( iNumber > 31 ){
  7297. + errmsg = _("operand out of range (not between 0 and 31)");
  7298. + }else{
  7299. + if( iNumber <= 15 ){
  7300. +
  7301. + }else{
  7302. + ex.X_add_number -= 16;
  7303. +
  7304. + /* Convert Opecode */
  7305. + insn_wk = insn & 0xff00;
  7306. +
  7307. + switch( insn_wk ){
  7308. + case 0x8800: insn_wk = 0x2300; break; /* srl -->class 1 : srl */
  7309. + case 0x8c00: insn_wk = 0x2700; break; /* sll -->class 1 : sll */
  7310. + case 0x9000: insn_wk = 0x2b00; break; /* sra -->class 1 : sra */
  7311. + case 0x9400: insn_wk = 0x2f00; break; /* sla -->class 1 : sla */
  7312. + case 0x9800: insn_wk = 0x3300; break; /* rr -->class 1 : rr */
  7313. + case 0x9c00: insn_wk = 0x3700; break; /* rl -->class 1 : rl */
  7314. + default : errmsg = _("invalid operand"); break;
  7315. +
  7316. + }
  7317. + insn = insn_wk | ( insn & 0x00ff );
  7318. + }
  7319. + }
  7320. + }
  7321. + else {
  7322. + /* shift/lotate命令以外 */
  7323. +
  7324. + /* Possible to sign32 */
  7325. + iNumber = ex.X_add_number;
  7326. +
  7327. + if (operand->flags & C33_OPERAND_SIGNED){
  7328. + /* YES signed */
  7329. +
  7330. + if ((operand->range == 19) && ((-262144 <= iNumber && iNumber < -32) ||
  7331. + (31 < iNumber && iNumber <= 262143))){
  7332. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7333. + extra_data_befor_insn = true;
  7334. + extra_data_len = 1;
  7335. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7336. + ex.X_add_number = iNumber & 0x3f;
  7337. + flags = C33_OPERAND_IMM; /* sign(5:0) is not signed */
  7338. + }
  7339. + else if (operand->range == 22) {
  7340. + if (operand->flags & C33_OPERAND_PC){
  7341. + if (-256 <= iNumber && iNumber <= 254){
  7342. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
  7343. + }
  7344. + else if ((-2097152 <= iNumber && iNumber < -256) ||
  7345. + (254 < iNumber && iNumber <= 2097150)){
  7346. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7347. + extra_data_befor_insn = true;
  7348. + extra_data_len = 1;
  7349. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff); /* sign22(21:9) */
  7350. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
  7351. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  7352. + }else{
  7353. + errmsg = _("operand out of range (not between -2097152 and 2097150)");
  7354. + }
  7355. + }
  7356. + }
  7357. + else if (operand->range == 32){
  7358. + /* jp,call */
  7359. + if (operand->flags & C33_OPERAND_PC){
  7360. + if (-256 <= iNumber && iNumber <= 254){
  7361. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  7362. + }
  7363. + else if ((-2097152 <= iNumber && iNumber < -256) ||
  7364. + (254 < iNumber && iNumber <= 2097150)){
  7365. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7366. + extra_data_befor_insn = true;
  7367. + extra_data_len = 1;
  7368. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff);
  7369. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  7370. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  7371. + }
  7372. + else {
  7373. + /* 2 ext */
  7374. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7375. + extra_data_befor_insn = true;
  7376. + extra_data_len = 2;
  7377. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1ff8);
  7378. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 9) & 0x1fff);
  7379. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  7380. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  7381. + }
  7382. + }
  7383. + else {
  7384. + if (-32 <= iNumber && iNumber <= 31){
  7385. + /* EMPTY */
  7386. + }
  7387. + else if ((-262144 <= iNumber && iNumber < -32) ||
  7388. + (31 < iNumber && iNumber <= 262143)){
  7389. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7390. + extra_data_befor_insn = true;
  7391. + extra_data_len = 1;
  7392. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7393. + ex.X_add_number = iNumber & 0x3f;
  7394. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  7395. + }
  7396. + else {
  7397. + /* ext命令 2つ */
  7398. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7399. + extra_data_befor_insn = true;
  7400. + extra_data_len = 2;
  7401. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  7402. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  7403. + ex.X_add_number = iNumber & 0x3f;
  7404. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  7405. + }
  7406. + }
  7407. + }
  7408. + }
  7409. + else {
  7410. + /* IMM */
  7411. + switch( operand->range ){
  7412. + case 19:
  7413. + if ((unsigned int)iNumber <= 0x7ffff){
  7414. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7415. + extra_data_befor_insn = true;
  7416. + extra_data_len = 1;
  7417. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7418. + ex.X_add_number = iNumber & 0x3f;
  7419. + }
  7420. + break;
  7421. + case 32:
  7422. + if ((unsigned int)iNumber <= 0x3f){
  7423. + /* EMPTY */
  7424. + }
  7425. + else if ((unsigned int)iNumber <= 0x7ffff){
  7426. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7427. + extra_data_befor_insn = true;
  7428. + extra_data_len = 1;
  7429. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  7430. + ex.X_add_number = iNumber & 0x3f;
  7431. + }
  7432. + else {
  7433. + /* 2 ext */
  7434. +
  7435. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7436. + extra_data_befor_insn = true;
  7437. + extra_data_len = 2;
  7438. +
  7439. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  7440. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  7441. + ex.X_add_number = iNumber & 0x3f;
  7442. + }
  7443. + break;
  7444. + }
  7445. + }
  7446. + }
  7447. + }
  7448. +
  7449. + /* ELSE IF Operand is LABEL & SYMBOL */
  7450. +
  7451. + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_LABEL)){
  7452. + /* YES jp/call only */
  7453. +
  7454. + if (operand->range == 13){ /* 2001.4.27 ide */
  7455. + /* YES ext */
  7456. +
  7457. + /* Get Symbol mask relocation */
  7458. + reloc = c33_reloc_prefix ();
  7459. + /* Not symbol mask ? : ERROR = ext label, OK = ext label@xx */
  7460. + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2002.03.04 */
  7461. + errmsg = _("invalid operand");
  7462. + }
  7463. + }
  7464. + else if (operand->range == 5){ /* add tazaki 2002.03.04 */
  7465. + /* YES loop */
  7466. + reloc = BFD_RELOC_C33_LOOP; /* Adv : loop operand */
  7467. + }
  7468. + else if (operand->range == 8){
  7469. + /* YES jp,call */
  7470. +
  7471. + reloc = c33_reloc_prefix (); /* add tazaki 2001.08.23 */
  7472. + /* Not symbol mask ? */
  7473. + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2001.08.23 */
  7474. + /* Set Symbol Mask Relocation */
  7475. + reloc = BFD_RELOC_C33_JP; /* Modify BFD_RELOC_C33_RL -->BFD_RELOC_C33_JP 2002.04.22 */
  7476. + }
  7477. + }
  7478. + /* add 2001.08.06 tazaki >>>>> */
  7479. + else if (operand->range == 22){
  7480. + /* YES scall,sjp,sjrxx */
  7481. + /* 1 ext */
  7482. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7483. + extra_data_befor_insn = true;
  7484. + extra_data_len = 1;
  7485. + extraInsnBuf[0] = opcode->opcode;
  7486. + if (fc >= MAX_INSN_FIXUPS)
  7487. + as_fatal (_("too many fixups"));
  7488. +
  7489. + fixups[ fc ].exp = ex;
  7490. + fixups[ fc ].opindex = * opcode->operands;
  7491. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  7492. + ++fc;
  7493. +
  7494. + reloc = BFD_RELOC_C33_S_RL;
  7495. +
  7496. + }
  7497. + /* add 2001.08.06 tazaki <<<<< */
  7498. + else {
  7499. + /* xjp,xcall */
  7500. +
  7501. + /* ext label+imm32@rh */
  7502. + /* ext label+imm32@rm */
  7503. + /* call label+imm32@rl */
  7504. +
  7505. + /* strにシンボル名が入っている。2パス アセンブラのとき、これを比較する。 */
  7506. +
  7507. + /* 2 ext */
  7508. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7509. + extra_data_befor_insn = true;
  7510. + extra_data_len = 2;
  7511. + extraInsnBuf[0] = opcode->opcode;
  7512. + extraInsnBuf[1] = opcode->opcode;
  7513. +
  7514. + if (fc >= MAX_INSN_FIXUPS)
  7515. + as_fatal (_("too many fixups"));
  7516. +
  7517. + fixups[ fc ].exp = ex;
  7518. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  7519. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
  7520. + ++fc;
  7521. +
  7522. + fixups[ fc ].exp = ex;
  7523. + fixups[ fc ].opindex = * opcode->operands;
  7524. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  7525. + ++fc;
  7526. +
  7527. + reloc = BFD_RELOC_C33_S_RL;
  7528. + }
  7529. + }
  7530. + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_SYMBOL)){
  7531. + /* YES ld.w only */
  7532. + if( *str == '[' ){
  7533. + errmsg = _("invalid operand");
  7534. + }
  7535. + else if (operand->range == 6){
  7536. + /* ld.w %rd,LABEL@l */
  7537. +
  7538. + /* Get Symbol mask relocation */
  7539. + reloc = c33_reloc_prefix ();
  7540. + }
  7541. + else if (operand->range == 19){
  7542. + /* xld.w rd,symbol+imm19 */
  7543. +
  7544. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7545. + extra_data_befor_insn = true;
  7546. + extra_data_len = 1;
  7547. + extraInsnBuf[0] = opcode->opcode;
  7548. +
  7549. + if (fc >= MAX_INSN_FIXUPS)
  7550. + as_fatal (_("too many fixups"));
  7551. +
  7552. + fixups[ fc ].exp = ex;
  7553. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  7554. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  7555. + ++fc;
  7556. +
  7557. + reloc = BFD_RELOC_C33_L;
  7558. +
  7559. + }
  7560. + else{
  7561. + if (operand->range == 32){
  7562. + /* ext label+imm32@h */
  7563. + /* ext label+imm32@m */
  7564. + /* xld.w label+imm32@l */
  7565. +
  7566. + /* 2 ext */
  7567. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7568. + extra_data_befor_insn = true;
  7569. + extra_data_len = 2;
  7570. + extraInsnBuf[0] = opcode->opcode;
  7571. + extraInsnBuf[1] = opcode->opcode;
  7572. +
  7573. + if (fc >= MAX_INSN_FIXUPS)
  7574. + as_fatal (_("too many fixups"));
  7575. +
  7576. + fixups[ fc ].exp = ex;
  7577. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  7578. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  7579. + ++fc;
  7580. +
  7581. + fixups[ fc ].exp = ex;
  7582. + fixups[ fc ].opindex = * opcode->operands;
  7583. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  7584. + ++fc;
  7585. +
  7586. + reloc = BFD_RELOC_C33_L;
  7587. + }
  7588. + }
  7589. + }
  7590. + else {
  7591. + errmsg = _("invalid operand");
  7592. + }
  7593. + }
  7594. + /* Operand is register indirectness (memory). */
  7595. +// else if ((operand->flags & C33_OPERAND_RB) != 0) /* del T.Tazaki 2004/07/30 */
  7596. + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) == 0 && g_iMedda32 == 1 ) /* add T.Tazaki 2004/07/30 */
  7597. + {
  7598. + /* Pattern */
  7599. + /* [rb] */
  7600. +
  7601. + if (*str == '['){
  7602. + str++;
  7603. + input_line_pointer = str;
  7604. +
  7605. + if (register_name (& ex))
  7606. + {
  7607. + /* YES register */
  7608. +
  7609. + /* Skip space */
  7610. + while (isspace (*input_line_pointer))
  7611. + ++input_line_pointer;
  7612. +
  7613. + /* IF ']' */
  7614. + if (*input_line_pointer == ']'){
  7615. + /* YES pattern match */
  7616. + input_line_pointer++;
  7617. + }
  7618. + else {
  7619. + /* NO not match */
  7620. + errmsg = _("invalid operand");
  7621. + }
  7622. + }
  7623. + else {
  7624. + /* NO not register */
  7625. + errmsg = _("invalid operand");
  7626. + }
  7627. +
  7628. + }
  7629. + else
  7630. + errmsg = _("invalid operand");
  7631. + }
  7632. + /* add T.Tazaki 2004/07/30 >>> */
  7633. + /* Operand is register indirectness (memory). */
  7634. + else if ((operand->flags & C33_OPERAND_RB) != 0 && g_iMedda32 == 0 ) /* Use data area */
  7635. + {
  7636. + /* Pattern */
  7637. + /* [rb] */
  7638. +
  7639. + if (*str == '['){
  7640. + str++;
  7641. + input_line_pointer = str;
  7642. +
  7643. + if (register_name (& ex))
  7644. + {
  7645. + /* YES register */
  7646. +
  7647. + /* Skip space */
  7648. + while (isspace (*input_line_pointer))
  7649. + ++input_line_pointer;
  7650. +
  7651. + /* IF ']' */
  7652. + if (*input_line_pointer == ']'){
  7653. + /* YES pattern match */
  7654. + input_line_pointer++;
  7655. + }
  7656. + else {
  7657. + /* NO not match */
  7658. + errmsg = _("invalid operand");
  7659. + }
  7660. + }
  7661. + else {
  7662. + /* NO not register */
  7663. + errmsg = _("invalid operand");
  7664. + }
  7665. +
  7666. + }
  7667. + else
  7668. + errmsg = _("invalid operand");
  7669. + }
  7670. + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) != 0 && g_iMedda32 == 1 )
  7671. + {
  7672. + /* Are there any symbol and IMM which follow a register? */
  7673. + /* Pattern */
  7674. + /* [rb+imm26] */
  7675. +
  7676. + if (*str == '['){
  7677. + str++;
  7678. + input_line_pointer = str;
  7679. +
  7680. + if (register_name (& ex))
  7681. + {
  7682. + /* Skip Space */
  7683. + while (isspace (*input_line_pointer))
  7684. + ++input_line_pointer;
  7685. +
  7686. + /* IF ']' */
  7687. + if (*input_line_pointer == ']'){
  7688. + /* YES Register Only */
  7689. + input_line_pointer++;
  7690. + }
  7691. + /* ELSE IF plus */
  7692. + else if (*input_line_pointer == '+'){
  7693. + /* YES plus */
  7694. +
  7695. + input_line_pointer++;
  7696. + /* symbol,imm */
  7697. + expression (& ext_ex);
  7698. +
  7699. + if (ext_ex.X_op == O_constant){
  7700. + /* [%rd+imm26] */
  7701. +
  7702. + uiNumber = ext_ex.X_add_number;
  7703. +
  7704. + if (uiNumber == 0){
  7705. + /* EMPTY */
  7706. + }
  7707. + else if (uiNumber <= 0x1fff){
  7708. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7709. + extra_data_befor_insn = true;
  7710. + extra_data_len = 1;
  7711. + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
  7712. + }
  7713. + else if (uiNumber <= 0x3ffffff){
  7714. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7715. + extra_data_befor_insn = true;
  7716. + extra_data_len = 2;
  7717. + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
  7718. + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
  7719. + }
  7720. + else {
  7721. + /* NO more than 27bit ? */
  7722. +
  7723. + /* tnot support */
  7724. + errmsg = _("invalid operand");
  7725. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  7726. + }
  7727. + }
  7728. + else {
  7729. + /* NO not immidiate */
  7730. + errmsg = _("invalid operand");
  7731. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  7732. + }
  7733. + }
  7734. + else {
  7735. + /* NO any other character */
  7736. + /* error */
  7737. + errmsg = _("invalid operand");
  7738. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  7739. + }
  7740. + }
  7741. + else
  7742. + errmsg = _("invalid operand");
  7743. + }
  7744. + else
  7745. + errmsg = _("invalid operand");
  7746. + }
  7747. +
  7748. + /* add T.Tazaki 2004/07/30 <<< */
  7749. +
  7750. +/* >>> add tazaki 2001.11.20 */
  7751. +
  7752. + else if( ( (operand->flags & C33_OPERAND_MEM) != 0 ) &&
  7753. + ( (operand->flags & C33_OPERAND_DP_SYMBOL) == C33_OPERAND_DP_SYMBOL ) )
  7754. + {
  7755. + if (*str == '['){
  7756. + str++;
  7757. + input_line_pointer = str;
  7758. +
  7759. + if (!register_name (& ex))
  7760. + {
  7761. + /* YES not register */
  7762. +
  7763. + if (system_register_name (& ex, true, false)){
  7764. + /* system register */
  7765. + errmsg = _("invalid operand");
  7766. + }
  7767. + else {
  7768. + check_input_line_pointer = input_line_pointer;
  7769. +
  7770. + expression (& ex);
  7771. +
  7772. + /* if Minus "-", No Support! */
  7773. + while(check_input_line_pointer < input_line_pointer){
  7774. + if (*check_input_line_pointer == '-'){
  7775. + errmsg = _("invalid operand");
  7776. + break;
  7777. + }
  7778. + check_input_line_pointer++;
  7779. + }
  7780. + }
  7781. + if (errmsg != NULL){
  7782. + }
  7783. + /* ELSE IF Operand is SYMBOL */
  7784. + else if (ex.X_op == O_symbol){
  7785. + /* Pattern */
  7786. + /* [symbol+imm32] */
  7787. +
  7788. + if( operand->range == 19 )
  7789. + {
  7790. + if( g_iMedda32 == 0 ) /* add T.Tazaki 2004/07/30 */
  7791. + {
  7792. + /* ext (symbol+imm32-dp)@6-18 : ext imm13 */
  7793. + /* ld.w (symbol+imm32-dp)@0-5 : ld.w r0,[%dp+imm6] */
  7794. +
  7795. + /* 1 ext */
  7796. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7797. + extra_data_befor_insn = true;
  7798. + extra_data_len = 1;
  7799. + extraInsnBuf[0] = opcode->opcode;
  7800. +
  7801. + if (fc >= MAX_INSN_FIXUPS)
  7802. + as_fatal (_("too many fixups"));
  7803. +
  7804. + fixups[ fc ].exp = ex;
  7805. + fixups[ fc ].opindex = * opcode->operands;
  7806. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  7807. + ++fc;
  7808. + reloc = BFD_RELOC_C33_DPL;
  7809. + }
  7810. +#if 0
  7811. + else
  7812. + {
  7813. + /* add T.Tazaki 2004/08/19 >>> */
  7814. + /* 0:pushn %r0 */
  7815. + /* 1:ext label+imm32@m */
  7816. + /* 2:ld.x %r0,label+imm32@l */
  7817. + /* 3:ld.x %rd,[%r0] */
  7818. + /* 4:popn %r0 */
  7819. +
  7820. + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
  7821. + /* 1ext */
  7822. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7823. + extra_data_befor_insn = true;
  7824. + extraInsnBuf[1] = opcode->opcode;
  7825. +
  7826. + if (fc >= MAX_INSN_FIXUPS)
  7827. + as_fatal (_("too many fixups"));
  7828. +
  7829. + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_M に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
  7830. + を追加して、リンカで "pushn %r0" を設定させるためにある。 */
  7831. + fixups[ fc ].exp = ex;
  7832. + fixups[ fc ].opindex = * opcode->operands;
  7833. + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0; /* デフォルトの"pushn %r0" を設定 */
  7834. + ++fc;
  7835. +
  7836. + fixups[ fc ].exp = ex;
  7837. + fixups[ fc ].opindex = * opcode->operands;
  7838. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  7839. + ++fc;
  7840. +
  7841. + reloc = BFD_RELOC_C33_L;
  7842. +
  7843. + extra_data_befor_insn = true;
  7844. + ulrd = insn & 0x000f;
  7845. + insn &= 0xfff0;
  7846. + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
  7847. +
  7848. + if ((operand->flags & C33_XLDB_RD) != 0)
  7849. + {
  7850. + insn = 0x2000 + ulrd; /* ld.b %rd,[%r0] */
  7851. + }
  7852. + else if((operand->flags & C33_XLDB_WR) != 0)
  7853. + {
  7854. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  7855. + g_iXload_range = operand->range;
  7856. + insn = 0x3400; /* ld.b [%r0],%rs */
  7857. + }
  7858. + if ((operand->flags & C33_XLDH_RD) != 0)
  7859. + {
  7860. + insn = 0x2800 + ulrd; /* ld.h %rd,[%r0] */
  7861. + }
  7862. + else if((operand->flags & C33_XLDH_WR) != 0)
  7863. + {
  7864. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  7865. + g_iXload_range = operand->range;
  7866. + insn = 0x3800; /* ld.h [%r0],%rs */
  7867. + }
  7868. + if ((operand->flags & C33_XLDW_RD) != 0)
  7869. + {
  7870. + insn = 0x3000 + ulrd; /* ld.w %rd,[%r0] */
  7871. + }
  7872. + else if((operand->flags & C33_XLDW_WR) != 0)
  7873. + {
  7874. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  7875. + g_iXload_range = operand->range;
  7876. + insn = 0x3c00; /* ld.w [%r0],%rs */
  7877. + }
  7878. + if ((operand->flags & C33_XLDUB_RD) != 0)
  7879. + {
  7880. + insn = 0x2400 + ulrd; /* ld.ub %rd,[%r0] */
  7881. + }
  7882. + else if((operand->flags & C33_XLDUH_RD) != 0)
  7883. + {
  7884. + insn = 0x2c00 + ulrd; /* ld.uh %rd,[%r0] */
  7885. + }
  7886. + extraInsnBuf[3] = insn;
  7887. + insn = 0x0240; /* popn %r0 */
  7888. + extraInsnBuf[4] = insn;
  7889. + extra_data_len = 4;
  7890. +
  7891. + }
  7892. + /* add T.Tazaki 2004/08/19 <<< */
  7893. +#endif
  7894. + }else if ( operand->range == 32 ){
  7895. + /* ext (symbol+imm32-%dp)@19-31 : ext imm13 */
  7896. + /* ext (symbol+imm32-%dp)@6-18 : ext imm13 */
  7897. + /* ld.w (symbol+imm32-%dp)@0-5 : ld.w r0,[%dp+imm6] */
  7898. +
  7899. + /* 2 ext */
  7900. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7901. + extra_data_befor_insn = true;
  7902. + extra_data_len = 2;
  7903. + extraInsnBuf[0] = opcode->opcode;
  7904. + extraInsnBuf[1] = opcode->opcode;
  7905. +
  7906. + if (fc >= MAX_INSN_FIXUPS)
  7907. + as_fatal (_("too many fixups"));
  7908. +
  7909. + fixups[ fc ].exp = ex;
  7910. + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
  7911. + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
  7912. + ++fc;
  7913. +
  7914. + fixups[ fc ].exp = ex;
  7915. + fixups[ fc ].opindex = * opcode->operands;
  7916. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  7917. + ++fc;
  7918. + reloc = BFD_RELOC_C33_DPL;
  7919. + }
  7920. + }
  7921. + }
  7922. + else {
  7923. + errmsg = _("invalid operand");
  7924. + }
  7925. + }
  7926. + else {
  7927. + errmsg = _("invalid operand");
  7928. + }
  7929. + }
  7930. +/* <<< add tazaki 2001.11.20 */
  7931. +
  7932. + /* An operand is register indirectness (memory). */
  7933. + else if ((operand->flags & C33_OPERAND_MEM) != 0)
  7934. + {
  7935. + if (*str == '['){
  7936. + str++;
  7937. + input_line_pointer = str;
  7938. +
  7939. + if (!register_name (& ex))
  7940. + {
  7941. + /* YES not register */
  7942. +
  7943. + if (system_register_name (& ex, true, false)){
  7944. + /* system register */
  7945. + errmsg = _("invalid operand");
  7946. + }
  7947. + else {
  7948. + check_input_line_pointer = input_line_pointer;
  7949. +
  7950. + expression (& ex);
  7951. +
  7952. + /* if Minus "-", No Support! */
  7953. + while(check_input_line_pointer < input_line_pointer){
  7954. + if (*check_input_line_pointer == '-'){
  7955. + errmsg = _("invalid operand");
  7956. + break;
  7957. + }
  7958. + check_input_line_pointer++;
  7959. + }
  7960. + }
  7961. +
  7962. + if (errmsg != NULL){
  7963. + }
  7964. + /* ELSE IF Operand is Immidiate ? */
  7965. + else if (ex.X_op == O_constant){
  7966. + errmsg = _("invalid operand"); /* [imm26] patter : Error! 2001.11.28 */
  7967. + }
  7968. + /* ELSE IF Operand is SYMBOL ? */
  7969. + else if (ex.X_op == O_symbol){
  7970. +
  7971. + /* Pattern */
  7972. + /* [symbol+imm32] */
  7973. +
  7974. +
  7975. + /* ext goff_hi(symbol+imm32) */
  7976. + /* ext goff_lo(symbol+imm32) */
  7977. + /* [r15] */
  7978. +
  7979. + if (operand->range == 13){
  7980. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  7981. + extra_data_befor_insn = true;
  7982. + extra_data_len = 1;
  7983. + extraInsnBuf[0] = opcode->opcode;
  7984. +
  7985. + if (fc >= MAX_INSN_FIXUPS)
  7986. + as_fatal (_("too many fixups"));
  7987. +
  7988. + fixups[ fc ].exp = ex;
  7989. + fixups[ fc ].opindex = * opcode->operands;
  7990. + fixups[ fc ].reloc = BFD_RELOC_C33_GL;
  7991. + ++fc;
  7992. +
  7993. +
  7994. + /* Save Register Number. */
  7995. + ex.X_op = O_register;
  7996. + ex.X_add_number = GP_REG;
  7997. + ex.X_add_symbol = NULL;
  7998. + ex.X_op_symbol = NULL;
  7999. +
  8000. + }
  8001. + else if (operand->range == 26 && g_iMedda32 == 0 ){ /* use data area */
  8002. + /* 2 ext */
  8003. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8004. + extra_data_befor_insn = true;
  8005. + extra_data_len = 2;
  8006. + extraInsnBuf[0] = opcode->opcode;
  8007. + extraInsnBuf[1] = opcode->opcode;
  8008. +
  8009. + if (fc >= MAX_INSN_FIXUPS)
  8010. + as_fatal (_("too many fixups"));
  8011. +
  8012. + fixups[ fc ].exp = ex;
  8013. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  8014. + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
  8015. + ++fc;
  8016. +
  8017. + fixups[ fc ].exp = ex;
  8018. + fixups[ fc ].opindex = * opcode->operands;
  8019. + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
  8020. + ++fc;
  8021. +
  8022. +
  8023. + /* Save Register Number. */
  8024. + ex.X_op = O_register;
  8025. + ex.X_add_number = GP_REG;
  8026. + ex.X_add_symbol = NULL;
  8027. + ex.X_op_symbol = NULL;
  8028. + }
  8029. + /* add T.Tazaki 2004/08/19 >>> */
  8030. + else if ((operand->range == 19 || operand->range == 26) && g_iMedda32 == 1 ){ /* xld と ald 兼用 : no use data area */
  8031. + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
  8032. + /* 0:pushn %r0 */
  8033. + /* 1:ext label+imm32@m */
  8034. + /* 2:ext label+imm32@m */
  8035. + /* 3:ld.x %r0,label+imm32@l */
  8036. + /* 4:ld.x [%r0],%rs */
  8037. + /* 5:popn %r0 */
  8038. +
  8039. + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
  8040. +
  8041. + /* 1 or 2 ext */
  8042. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8043. + extra_data_befor_insn = true;
  8044. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8045. + {
  8046. + extraInsnBuf[0] = opcode->opcode;
  8047. + }
  8048. + else
  8049. + {
  8050. + extraInsnBuf[1] = opcode->opcode;
  8051. + }
  8052. + if( operand->range == 26 )
  8053. + {
  8054. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8055. + {
  8056. + extraInsnBuf[1] = opcode->opcode;
  8057. + }
  8058. + else
  8059. + {
  8060. + extraInsnBuf[2] = opcode->opcode;
  8061. + }
  8062. + }
  8063. + if (fc >= MAX_INSN_FIXUPS)
  8064. + as_fatal (_("too many fixups"));
  8065. +
  8066. + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
  8067. + を追加して、リンカで "pushn %r0" を設定させるためにある。
  8068. + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
  8069. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) == 0 )
  8070. + {
  8071. + fixups[ fc ].exp = ex;
  8072. + fixups[ fc ].opindex = * opcode->operands;
  8073. + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
  8074. + ++fc;
  8075. + }
  8076. +
  8077. + if( operand->range == 26 )
  8078. + {
  8079. + fixups[ fc ].exp = ex;
  8080. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  8081. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  8082. + ++fc;
  8083. + }
  8084. + fixups[ fc ].exp = ex;
  8085. + fixups[ fc ].opindex = * opcode->operands;
  8086. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  8087. + ++fc;
  8088. +
  8089. + reloc = BFD_RELOC_C33_L;
  8090. +
  8091. + extra_data_befor_insn = true;
  8092. + ulrd = insn & 0x000f;
  8093. + if( operand->range == 26 )
  8094. + {
  8095. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8096. + {
  8097. + extraInsnBuf[2] = insn; /* ld.w %rd,sign6 */
  8098. + }
  8099. + else
  8100. + {
  8101. + insn &= 0xfff0;
  8102. + extraInsnBuf[3] = insn; /* ld.w %r0,sign6 */
  8103. + }
  8104. + }
  8105. + else
  8106. + {
  8107. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8108. + {
  8109. + /* xld.x %rd,[symbol+imm] */
  8110. + extraInsnBuf[1] = insn; /* ld.w %rd,sign6 */
  8111. + }
  8112. + else
  8113. + {
  8114. + /* xld.x [symbol+imm],%rs */
  8115. + insn &= 0xfff0;
  8116. + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
  8117. + }
  8118. + }
  8119. + if ((operand->flags & C33_XLDB_RD) != 0)
  8120. + {
  8121. + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
  8122. + }
  8123. + else if((operand->flags & C33_XLDB_WR) != 0)
  8124. + {
  8125. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  8126. + g_iXload_range = operand->range;
  8127. + insn = 0x3400; /* ld.b [%r0],%rs */
  8128. + }
  8129. + if ((operand->flags & C33_XLDH_RD) != 0)
  8130. + {
  8131. + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
  8132. + }
  8133. + else if((operand->flags & C33_XLDH_WR) != 0)
  8134. + {
  8135. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  8136. + g_iXload_range = operand->range;
  8137. + insn = 0x3800; /* ld.h [%r0],%rs */
  8138. + }
  8139. + if ((operand->flags & C33_XLDW_RD) != 0)
  8140. + {
  8141. + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
  8142. + }
  8143. + else if((operand->flags & C33_XLDW_WR) != 0)
  8144. + {
  8145. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  8146. + g_iXload_range = operand->range;
  8147. + insn = 0x3c00; /* ld.w [%r0],%rs */
  8148. + }
  8149. + if ((operand->flags & C33_XLDUB_RD) != 0)
  8150. + {
  8151. + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
  8152. + }
  8153. + else if((operand->flags & C33_XLDUH_RD) != 0)
  8154. + {
  8155. + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
  8156. + }
  8157. + else if((operand->flags & C33_XBTST) != 0)
  8158. + {
  8159. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  8160. + g_iBitTest_range = operand->range;
  8161. + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  8162. + }
  8163. + else if((operand->flags & C33_XBCLR) != 0)
  8164. + {
  8165. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  8166. + g_iBitTest_range = operand->range;
  8167. + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  8168. + }
  8169. + else if((operand->flags & C33_XBSET) != 0)
  8170. + {
  8171. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  8172. + g_iBitTest_range = operand->range;
  8173. + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  8174. + }
  8175. + else if((operand->flags & C33_XBNOT) != 0)
  8176. + {
  8177. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  8178. + g_iBitTest_range = operand->range;
  8179. + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  8180. + }
  8181. + if( operand->range == 26 )
  8182. + {
  8183. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8184. + {
  8185. + extraInsnBuf[3] = insn;
  8186. + extra_data_len = 3;
  8187. + }
  8188. + else
  8189. + {
  8190. + extraInsnBuf[4] = insn;
  8191. + insn = 0x0240; /* popn %r0 */
  8192. + extraInsnBuf[5] = insn;
  8193. + extra_data_len = 5;
  8194. + }
  8195. + }
  8196. + else
  8197. + {
  8198. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  8199. + {
  8200. + extraInsnBuf[2] = insn;
  8201. + extra_data_len = 2;
  8202. + }
  8203. + else
  8204. + {
  8205. + extraInsnBuf[3] = insn;
  8206. + insn = 0x0240; /* popn %r0 */
  8207. + extraInsnBuf[4] = insn;
  8208. + extra_data_len = 4;
  8209. + }
  8210. + }
  8211. +
  8212. +
  8213. + /* add T.Tazaki 2004/08/19 <<< */
  8214. +
  8215. + }
  8216. + else {
  8217. + errmsg = _("invalid operand");
  8218. + }
  8219. + }
  8220. + else {
  8221. + errmsg = _("invalid operand");
  8222. + }
  8223. + }
  8224. + else {
  8225. + /* NO Register */
  8226. + /* Are there any symbol and IMM which follow a register? */
  8227. +
  8228. + /* Pattern */
  8229. + /* [rb+imm32] */
  8230. +
  8231. + /* Skip Space */
  8232. + while (isspace (*input_line_pointer))
  8233. + ++input_line_pointer;
  8234. +
  8235. + /* IF ']' */
  8236. + if (*input_line_pointer == ']'){
  8237. + /* YES Register Only */
  8238. + #if 0
  8239. + errmsg = _("invalid operand");
  8240. + #else
  8241. + input_line_pointer++;
  8242. + #endif
  8243. + }
  8244. + /* ELSE IF plus */
  8245. + else if (*input_line_pointer == '+'){
  8246. + /* YES plus */
  8247. +
  8248. + input_line_pointer++;
  8249. + /* symbol,imm */
  8250. + expression (& ext_ex);
  8251. +
  8252. + if (ext_ex.X_op == O_constant){
  8253. + /* [%rd+imm26] */
  8254. +
  8255. + uiNumber = ext_ex.X_add_number;
  8256. +
  8257. + if (uiNumber == 0){
  8258. + /* EMPTY */
  8259. + }
  8260. + else if (uiNumber <= 0x1fff){
  8261. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8262. + extra_data_befor_insn = true;
  8263. + extra_data_len = 1;
  8264. + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
  8265. + }
  8266. + else if (uiNumber <= 0x3ffffff){
  8267. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8268. + extra_data_befor_insn = true;
  8269. + extra_data_len = 2;
  8270. + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
  8271. + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
  8272. + }
  8273. + else {
  8274. + /* NO more than 27bit ? */
  8275. +
  8276. + /* tnot support */
  8277. + errmsg = _("invalid operand");
  8278. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  8279. + }
  8280. + }
  8281. + else {
  8282. + /* NO not immidiate */
  8283. + errmsg = _("invalid operand");
  8284. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  8285. + }
  8286. + }
  8287. + else {
  8288. + /* NO any other character */
  8289. + /* error */
  8290. + errmsg = _("invalid operand");
  8291. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  8292. + }
  8293. + }
  8294. + }
  8295. + else
  8296. + errmsg = _("invalid operand");
  8297. + }
  8298. + /* an operand -- the register with a post increment -- or [ being indirect ] */
  8299. + else if ((operand->flags & C33_OPERAND_REGINC) != 0)
  8300. + {
  8301. + if (*str == '['){
  8302. + str++;
  8303. + input_line_pointer = str;
  8304. +
  8305. + if (!register_name (& ex))
  8306. + {
  8307. + errmsg = _("invalid register name");
  8308. + }
  8309. + else {
  8310. + str = input_line_pointer;
  8311. +
  8312. + /* Skip space */
  8313. + while (isspace (*str))
  8314. + ++str;
  8315. +
  8316. + if (*str == ']'){
  8317. + ++str;
  8318. +
  8319. + while (isspace (*str))
  8320. + ++str;
  8321. +
  8322. + if (*str == '+'){
  8323. + /* normal end */
  8324. + str++;
  8325. + input_line_pointer = str;
  8326. +
  8327. + }
  8328. + else {
  8329. + errmsg = _("invalid operand");
  8330. + }
  8331. + }
  8332. + else {
  8333. + errmsg = _("invalid operand");
  8334. + }
  8335. + }
  8336. + }
  8337. + else
  8338. + errmsg = _("invalid operand");
  8339. + }
  8340. +
  8341. +
  8342. + /* Register indirectness with the De Dis placement */
  8343. + else if ((operand->flags & C33_OPERAND_SPMEM) != 0)
  8344. + {
  8345. + if (*str == '['){
  8346. + str++;
  8347. + /* Skip space */
  8348. + while (isspace (*str))
  8349. + ++str;
  8350. +
  8351. + input_line_pointer = str;
  8352. +
  8353. + /* check %sp */
  8354. + if ( ( strncmp(str,"%sp",3) != 0 ) && ( strncmp(str,"%SP",3) != 0 ))
  8355. + {
  8356. + /* YES */
  8357. + errmsg = _("invalid system register name");
  8358. + }
  8359. + else {
  8360. + str+=3;
  8361. + while (isspace (*str))
  8362. + ++str;
  8363. +
  8364. + /* IF ']' */
  8365. + if (*str == ']'){
  8366. + /* YES only register */
  8367. + /* Support "[%sp]" 2001.3.29 ide */
  8368. + ex.X_op = O_constant;
  8369. + ex.X_add_symbol = NULL;
  8370. + ex.X_op_symbol = NULL;
  8371. + ex.X_add_number = 0;
  8372. + str++;
  8373. + input_line_pointer = str;
  8374. + }
  8375. + else if (*str == '+'){
  8376. + /* [sp+imm] */
  8377. + str++;
  8378. + input_line_pointer = str;
  8379. +
  8380. + expression (& ex);
  8381. +
  8382. + iNumber = ex.X_add_number;
  8383. +
  8384. + if (operand->range <= 6){
  8385. + /* EMPTY */
  8386. + }
  8387. + else if (operand->range == 32) {
  8388. + /* update tazaki 2002.03.08 >>> */
  8389. + if (opcode->specialFlag == 1){
  8390. + /* ld.b */
  8391. + if ((unsigned int)iNumber <= 0x3f){
  8392. + ex.X_add_number /= 1;
  8393. +
  8394. + }else if ((unsigned int)iNumber <= 0x7ffff){
  8395. + /* 1 ext */
  8396. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8397. + extra_data_befor_insn = true;
  8398. + extra_data_len = 1;
  8399. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  8400. + ex.X_add_number = iNumber & 0x3f;
  8401. + }
  8402. + else {
  8403. + /* 2 ext */
  8404. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8405. + extra_data_befor_insn = true;
  8406. + extra_data_len = 2;
  8407. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  8408. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  8409. + ex.X_add_number = iNumber & 0x3f;
  8410. + }
  8411. + }
  8412. + else if (opcode->specialFlag == 2){
  8413. + /* ld.h */
  8414. + if ((unsigned int)iNumber <= 0x7f){
  8415. + ex.X_add_number /= 2;
  8416. +
  8417. + }else if ((unsigned int)iNumber <= 0x7ffff){
  8418. + /* 1 ext */
  8419. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8420. + extra_data_befor_insn = true;
  8421. + extra_data_len = 1;
  8422. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  8423. + ex.X_add_number = iNumber & 0x3f;
  8424. + }
  8425. + else {
  8426. + /* 2 ext */
  8427. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8428. + extra_data_befor_insn = true;
  8429. + extra_data_len = 2;
  8430. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  8431. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  8432. + ex.X_add_number = iNumber & 0x3f;
  8433. + }
  8434. + }
  8435. + else if (opcode->specialFlag == 4){
  8436. + /* ld.w */
  8437. + if ((unsigned int)iNumber <= 0xff){
  8438. + ex.X_add_number /= 4;
  8439. +
  8440. + }else if ((unsigned int)iNumber <= 0x7ffff){
  8441. + /* 1 ext */
  8442. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8443. + extra_data_befor_insn = true;
  8444. + extra_data_len = 1;
  8445. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  8446. + ex.X_add_number = iNumber & 0x3f;
  8447. + }
  8448. + else {
  8449. + /* 2 ext */
  8450. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  8451. + extra_data_befor_insn = true;
  8452. + extra_data_len = 2;
  8453. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  8454. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  8455. + ex.X_add_number = iNumber & 0x3f;
  8456. + }
  8457. + }
  8458. + /* update tazaki 2002.03.08 <<< */
  8459. + }
  8460. + else {
  8461. + errmsg = _("constant too big to fit into instruction");
  8462. + }
  8463. + }
  8464. + else{
  8465. + errmsg = _("invalid operand");
  8466. + }
  8467. + }
  8468. + }
  8469. + else
  8470. + errmsg = _("invalid operand");
  8471. + }
  8472. +
  8473. + if (errmsg)
  8474. + goto error;
  8475. +
  8476. + switch (ex.X_op)
  8477. + {
  8478. + case O_cond:
  8479. + /* An operand and an operation code are made into a command code. */
  8480. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  8481. + (char *) NULL, 0,
  8482. + copy_of_instruction,flags);
  8483. + break;
  8484. + case O_op_shift:
  8485. + /* An operand and an operation code are made into a command code. */
  8486. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  8487. + (char *) NULL, 0,
  8488. + copy_of_instruction,flags);
  8489. + break;
  8490. + case O_spregister :
  8491. + /* Don't add %sp to a formula as an operand. */
  8492. + break;
  8493. + case O_dpregister :
  8494. + /* Don't add %sp to a formula as an operand. */
  8495. + break;
  8496. + case O_illegal:
  8497. + errmsg = _("illegal operand");
  8498. + goto error;
  8499. + case O_absent:
  8500. + errmsg = _("missing operand");
  8501. + goto error;
  8502. + case O_register:
  8503. + /* An operand and an operation code are made into a command code. */
  8504. + /* add T.Tazaki 2004/08/19 >>> */
  8505. + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
  8506. + {
  8507. + if( g_iXload_range == 26 ) /* xld.x */
  8508. + {
  8509. + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
  8510. + {
  8511. + /* change %r0 --> %r1 */
  8512. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  8513. + {
  8514. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  8515. + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  8516. + }
  8517. + else
  8518. + {
  8519. + /* ADV or PE */
  8520. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  8521. + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  8522. + }
  8523. + extraInsnBuf[3] = 0x6c01; /* ld.w %r1,symbol+imm */
  8524. + extraInsnBuf[4] = (extraInsnBuf[4] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  8525. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  8526. + {
  8527. + extraInsnBuf[5] = 0x0241; /* popn %r1 */
  8528. + insn = 0x0241;
  8529. + }
  8530. + else
  8531. + {
  8532. + /* ADV or PE */
  8533. + extraInsnBuf[5] = 0x0051; /* pop %r1 */
  8534. + insn = 0x0051;
  8535. + }
  8536. + }
  8537. + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
  8538. + (char *) NULL, 0,
  8539. + copy_of_instruction,flags);
  8540. + }
  8541. + else
  8542. + {
  8543. + /* g_iXload_range = 19 : ald.x */
  8544. + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
  8545. + {
  8546. + /* change %r0 --> %r1 */
  8547. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  8548. + {
  8549. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  8550. + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  8551. + }
  8552. + else
  8553. + {
  8554. + /* ADV or PE */
  8555. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  8556. + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  8557. + }
  8558. + extraInsnBuf[2] = 0x6c01; /* ld.w %r1,symbol+imm */
  8559. + extraInsnBuf[3] = (extraInsnBuf[3] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  8560. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  8561. + {
  8562. + extraInsnBuf[4] = 0x0241; /* popn %r1 */
  8563. + insn = 0x0241;
  8564. + }
  8565. + else
  8566. + {
  8567. + /* ADV or PE */
  8568. + extraInsnBuf[4] = 0x0051; /* pop %r1 */
  8569. + insn = 0x0051;
  8570. + }
  8571. + }
  8572. + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
  8573. + (char *) NULL, 0,
  8574. + copy_of_instruction,flags);
  8575. + }
  8576. + g_iXload = 0;
  8577. + g_iXload_range = 0;
  8578. + }
  8579. + /* add T.Tazaki 2004/08/19 <<< */
  8580. + else
  8581. + {
  8582. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  8583. + (char *) NULL, 0,
  8584. + copy_of_instruction,flags);
  8585. + }
  8586. + break;
  8587. +
  8588. + case O_constant:
  8589. + /* An operand and an operation code are made into a command code. */
  8590. +
  8591. + /* add T.Tazaki 2004/07/30 >>> */
  8592. + if (g_iBitTest == 1) /* bit test inst ? */
  8593. + {
  8594. + if( g_iBitTest_range == 26 )
  8595. + {
  8596. + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
  8597. + (char *) NULL, 0,
  8598. + copy_of_instruction,flags);
  8599. + }
  8600. + else
  8601. + {
  8602. + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
  8603. + (char *) NULL, 0,
  8604. + copy_of_instruction,flags);
  8605. + }
  8606. + g_iBitTest = 0;
  8607. + g_iBitTest_range = 0;
  8608. + }
  8609. + /* add T.Tazaki 2004/07/30 <<< */
  8610. + else
  8611. + {
  8612. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  8613. + (char *) NULL, 0,
  8614. + copy_of_instruction,flags);
  8615. + }
  8616. + break;
  8617. +
  8618. + case O_symbol:
  8619. + /* We need to generate a fixup for this expression. */
  8620. + if (fc >= MAX_INSN_FIXUPS)
  8621. + as_fatal (_("too many fixups"));
  8622. +
  8623. + fixups[ fc ].exp = ex;
  8624. + fixups[ fc ].opindex = * opindex_ptr;
  8625. + fixups[ fc ].reloc = reloc;
  8626. + ++fc;
  8627. + break;
  8628. +
  8629. + default:
  8630. + /* We need to generate a fixup for this expression. */
  8631. + if (fc >= MAX_INSN_FIXUPS)
  8632. + as_fatal (_("too many fixups"));
  8633. +
  8634. + fixups[ fc ].exp = ex;
  8635. + fixups[ fc ].opindex = * opindex_ptr;
  8636. + fixups[ fc ].reloc = BFD_RELOC_UNUSED;
  8637. + ++fc;
  8638. + break;
  8639. + }
  8640. + }
  8641. + str = input_line_pointer;
  8642. + input_line_pointer = hold;
  8643. +
  8644. + while (*str == ' ' || *str == ',' || *str == ']' )
  8645. + ++str;
  8646. + }
  8647. + match = 1;
  8648. +
  8649. + error:
  8650. + if (match == 0)
  8651. + {
  8652. +
  8653. + /* xld.w rd,[rs+imm26] : imm26 > 0x3ffffff ? add tazaki 2001.10.11 */
  8654. + if( iMEM_IMM26_flag == 0 ){ /* The following operand form is not seen at the time of range over.。*/
  8655. + next_opcode = opcode + 1;
  8656. + if (next_opcode->name != NULL
  8657. + && strcmp (next_opcode->name, opcode->name) == 0)
  8658. + {
  8659. + opcode = next_opcode;
  8660. + continue;
  8661. + }
  8662. + }
  8663. + as_bad (_("%s: %s"), copy_of_instruction, errmsg);
  8664. +/* as_bad ("%s: %s", copy_of_instruction, errmsg); Modify tazaki 2001.10.11 */
  8665. +
  8666. + if (* input_line_pointer == ']')
  8667. + ++ input_line_pointer;
  8668. +
  8669. + ignore_rest_of_line ();
  8670. + input_line_pointer = saved_input_line_pointer;
  8671. + return;
  8672. + }
  8673. + break;
  8674. + }
  8675. +
  8676. + while (isspace (*str))
  8677. + ++str;
  8678. +
  8679. + if (*str != '\0')
  8680. + /* xgettext:c-format */
  8681. + as_bad (_("junk at end of line: `%s'"), str);
  8682. +
  8683. + input_line_pointer = str;
  8684. +
  8685. + /* Write out the instruction. */
  8686. +
  8687. + if (relaxable && fc > 0)
  8688. + {
  8689. +
  8690. + fc = 0;
  8691. +
  8692. + if (!strcmp (opcode->name, "br"))
  8693. + {
  8694. + f = frag_var (rs_machine_dependent, 4, 2, 2,
  8695. + fixups[0].exp.X_add_symbol,
  8696. + fixups[0].exp.X_add_number,
  8697. + (char *)fixups[0].opindex);
  8698. + md_number_to_chars (f, insn, 2);
  8699. + md_number_to_chars (f + 2, 0, 2);
  8700. + }
  8701. + else
  8702. + {
  8703. + f = frag_var (rs_machine_dependent, 6, 4, 0,
  8704. + fixups[0].exp.X_add_symbol,
  8705. + fixups[0].exp.X_add_number,
  8706. + (char *)fixups[0].opindex);
  8707. + md_number_to_chars (f, insn, 2);
  8708. + md_number_to_chars (f + 2, 0, 4);
  8709. + }
  8710. + }
  8711. + else
  8712. + {
  8713. + /* ext command is set before a command code formula. . */
  8714. + if (extra_data_befor_insn)
  8715. + {
  8716. + /* Domain reservation */
  8717. + f = where = frag_more (extra_data_len*2+2); /* 2byte length instruction */
  8718. +
  8719. + /* The command code for extension (ext command) is acquired. */
  8720. + fromP = &extraInsnBuf[0];
  8721. +
  8722. + /* Only a part for the command code for FOR extensio */
  8723. + for (i = extra_data_len; i; --i)
  8724. + {
  8725. + /* The command code is stored in the buffer in order. */
  8726. + md_number_to_chars (where, (long) (*fromP), 2);
  8727. + where += 2;
  8728. + fromP++;
  8729. + }
  8730. +
  8731. + extra_data_befor_insn = false;
  8732. + }
  8733. + else {
  8734. + /* Domain reservation */
  8735. + f = where = frag_more (2); /* 2byte length instruction */
  8736. + }
  8737. +
  8738. + /* >>> add tazaki 2001.09.13 */
  8739. + /* macclr,ld.cf ? */
  8740. + if (opcode->specialFlag == 10){
  8741. + insn |= 0x0010; /* bit 5,4 = 0,1 set */
  8742. + }
  8743. + /* <<< add tazaki 2001.09.13 */
  8744. +
  8745. + /* The command code of 2 byte length is stored in a buffer. */
  8746. + md_number_to_chars (where, insn, 2);
  8747. + }
  8748. +
  8749. + /* Create any fixups. At this point we do not use a
  8750. + bfd_reloc_code_real_type, but instead just use the
  8751. + BFD_RELOC_UNUSED plus the operand index. This lets us easily
  8752. + handle fixups for any operand type, although that is admittedly
  8753. + not a very exciting feature. We pick a BFD reloc type in
  8754. + md_apply_fix. */
  8755. + for (i = 0; i < fc; i++)
  8756. + {
  8757. + const struct c33_operand * operand;
  8758. + bfd_reloc_code_real_type reloc;
  8759. +
  8760. + operand = & c33_operands[ fixups[i].opindex ];
  8761. +
  8762. + reloc = fixups[i].reloc;
  8763. +
  8764. + if (reloc != BFD_RELOC_UNUSED)
  8765. + {
  8766. + reloc_howto_type * reloc_howto = bfd_reloc_type_lookup (stdoutput,
  8767. + reloc);
  8768. + int size;
  8769. + int address;
  8770. + fixS * fixP;
  8771. +
  8772. + if (!reloc_howto){
  8773. + ;
  8774. + /* abort(); */ /* del tazaki 2001.10.11 */
  8775. + }else{
  8776. +
  8777. + size = bfd_get_reloc_size (reloc_howto);
  8778. +
  8779. + if (size != 2) {
  8780. + ;
  8781. + /* abort (); */ /* del tazaki 2001.10.11 */
  8782. + }else{
  8783. +
  8784. + address = (f - frag_now->fr_literal) + 2 - size;
  8785. +
  8786. + f += 2;
  8787. +
  8788. + fixP = fix_new_exp (frag_now, address, size,
  8789. + & fixups[i].exp,
  8790. + reloc_howto->pc_relative,
  8791. + reloc);
  8792. +
  8793. + switch (reloc)
  8794. + {
  8795. + case BFD_RELOC_C33_RH:
  8796. + case BFD_RELOC_C33_RM:
  8797. + case BFD_RELOC_C33_RL:
  8798. + case BFD_RELOC_C33_S_RH: /* add T.Tazaki 2002.05.02 */
  8799. + case BFD_RELOC_C33_S_RM: /* add T.Tazaki 2002.05.02 */
  8800. + case BFD_RELOC_C33_S_RL: /* add T.Tazaki 2002.05.02 */
  8801. + case BFD_RELOC_C33_JP: /* add T.Tazaki 2002.04.22 */
  8802. + case BFD_RELOC_C33_AH:
  8803. + case BFD_RELOC_C33_AL:
  8804. + case BFD_RELOC_C33_H:
  8805. + case BFD_RELOC_C33_M:
  8806. + case BFD_RELOC_C33_L:
  8807. + /* >>>> add 2002.03.05 tazaki */
  8808. + case BFD_RELOC_C33_DH:
  8809. + case BFD_RELOC_C33_DL:
  8810. + case BFD_RELOC_C33_GL:
  8811. + case BFD_RELOC_C33_SH:
  8812. + case BFD_RELOC_C33_SL:
  8813. + case BFD_RELOC_C33_TH:
  8814. + case BFD_RELOC_C33_TL:
  8815. + case BFD_RELOC_C33_ZH:
  8816. + case BFD_RELOC_C33_ZL:
  8817. + case BFD_RELOC_C33_DPH:
  8818. + case BFD_RELOC_C33_DPM:
  8819. + case BFD_RELOC_C33_DPL:
  8820. + case BFD_RELOC_C33_LOOP:
  8821. + /* <<<< add 2002.03.05 tazaki */
  8822. + case BFD_RELOC_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
  8823. + case BFD_RELOC_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
  8824. + case BFD_RELOC_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
  8825. + fixP->fx_no_overflow = 1;
  8826. + break;
  8827. + default:
  8828. + break;
  8829. + }
  8830. + }
  8831. + }
  8832. + }
  8833. + else
  8834. + {
  8835. + fix_new_exp (
  8836. + frag_now,
  8837. + f - frag_now->fr_literal, 4,
  8838. + & fixups[i].exp,
  8839. + 1 /* FIXME: C33_OPERAND_RELATIVE ??? */,
  8840. + (bfd_reloc_code_real_type) (fixups[i].opindex
  8841. + + (int) BFD_RELOC_UNUSED)
  8842. + );
  8843. + }
  8844. + }
  8845. +
  8846. + input_line_pointer = saved_input_line_pointer;
  8847. +}
  8848. +
  8849. +
  8850. +/* If while processing a fixup, a reloc really needs to be created */
  8851. +/* then it is done here. */
  8852. +
  8853. +arelent *
  8854. +tc_gen_reloc (seg, fixp)
  8855. + asection * seg;
  8856. + fixS * fixp;
  8857. +{
  8858. + arelent * reloc;
  8859. +
  8860. + reloc = (arelent *) xmalloc (sizeof (arelent));
  8861. + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
  8862. + *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
  8863. + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
  8864. + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
  8865. +
  8866. + if (reloc->howto == (reloc_howto_type *) NULL)
  8867. + {
  8868. + as_bad_where (fixp->fx_file, fixp->fx_line,
  8869. + /* xgettext:c-format */
  8870. + _("reloc %d not supported by object file format"),
  8871. + (int) fixp->fx_r_type);
  8872. +
  8873. + xfree (reloc);
  8874. +
  8875. + return NULL;
  8876. + }
  8877. +
  8878. + reloc->addend = fixp->fx_addnumber;
  8879. +
  8880. + return reloc;
  8881. +}
  8882. +
  8883. +/* Assume everything will fit in two bytes, then expand as necessary. */
  8884. +int
  8885. +md_estimate_size_before_relax (fragp, seg)
  8886. + fragS * fragp;
  8887. + asection * seg;
  8888. +{
  8889. + if (fragp->fr_subtype == 0)
  8890. + fragp->fr_var = 4;
  8891. + else if (fragp->fr_subtype == 2)
  8892. + fragp->fr_var = 2;
  8893. + else
  8894. + abort ();
  8895. + return 2;
  8896. +}
  8897. +
  8898. +long
  8899. +c33_pcrel_from_section (fixp, section)
  8900. + fixS * fixp;
  8901. + segT section;
  8902. +{
  8903. + /* If the symbol is undefined, or in a section other than our own,
  8904. + or it is weak (in which case it may well be in another section,
  8905. + then let the linker figure it out. */
  8906. + if (fixp->fx_addsy != (symbolS *) NULL
  8907. + && (! S_IS_DEFINED (fixp->fx_addsy)
  8908. + || S_IS_WEAK (fixp->fx_addsy)
  8909. + || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
  8910. + return 0;
  8911. +
  8912. + return fixp->fx_frag->fr_address + fixp->fx_where;
  8913. +}
  8914. +
  8915. +/*
  8916. +The symbol which can be decided inside a file is decided here.
  8917. +
  8918. +The tc_gen_reloc function which is in bfd library further is passed,
  8919. + and, finally the symbol changed by referring to the exterior, the link,
  8920. + and relocation is on HOWTO broad view of bfd.
  8921. + It is processed by the defined method.
  8922. +*/
  8923. +
  8924. +/* add T.Tazaki 2002.04.25 >>> */
  8925. +long g_where_rh = 0xffffffff;
  8926. +long g_where_rm = 0xffffffff;
  8927. +
  8928. +char *g_pwhere_rh = 0;
  8929. +char *g_pwhere_rm = 0;
  8930. +
  8931. +/* add T.Tazaki 2002.04.25 <<< */
  8932. +
  8933. +int
  8934. +md_apply_fix3 (fixp, valuep, seg)
  8935. + fixS * fixp;
  8936. + valueT * valuep;
  8937. + segT seg;
  8938. +{
  8939. + valueT value;
  8940. + char * where;
  8941. + long insn;
  8942. + int iNumber; /* add T.Tazaki 2002.04.25 */
  8943. + long lNumber; /* add T.Tazaki 2002.04.25 */
  8944. +
  8945. + if (fixp->fx_addsy == (symbolS *) NULL)
  8946. + {
  8947. + value = * valuep;
  8948. + fixp->fx_done = 1;
  8949. + }
  8950. + else if (fixp->fx_pcrel)
  8951. + value = * valuep;
  8952. + else
  8953. + {
  8954. + value = fixp->fx_offset;
  8955. + if (fixp->fx_subsy != (symbolS *) NULL)
  8956. + {
  8957. + if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
  8958. + value -= S_GET_VALUE (fixp->fx_subsy);
  8959. + else
  8960. + {
  8961. + /* We don't actually support subtracting a symbol. */
  8962. + as_bad_where (fixp->fx_file, fixp->fx_line,
  8963. + _("expression too complex"));
  8964. + }
  8965. + }
  8966. + }
  8967. +
  8968. + if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
  8969. + {
  8970. + int opindex;
  8971. + const struct c33_operand * operand;
  8972. + unsigned long insn;
  8973. +
  8974. + opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
  8975. + operand = & c33_operands[ opindex ];
  8976. +
  8977. + /* Fetch the instruction, insert the fully resolved operand
  8978. + value, and stuff the instruction back again.
  8979. +
  8980. + Note the instruction has been stored in little endian
  8981. + format! */
  8982. + where = fixp->fx_frag->fr_literal + fixp->fx_where;
  8983. +
  8984. + insn = bfd_getl16 ((unsigned char *) where);
  8985. + insn = c33_insert_operand (insn, operand, (offsetT) value,
  8986. + fixp->fx_file, fixp->fx_line, NULL);
  8987. + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
  8988. +
  8989. + if (fixp->fx_done)
  8990. + {
  8991. + /* Nothing else to do here. */
  8992. + return 1;
  8993. + }
  8994. + }
  8995. + else if (fixp->fx_done)
  8996. + {
  8997. + /* We still have to insert the value into memory! */
  8998. + where = fixp->fx_frag->fr_literal + fixp->fx_where;
  8999. +
  9000. + if (fixp->fx_size == 1)
  9001. + * where = value & 0xff;
  9002. + else if (fixp->fx_size == 2){
  9003. +
  9004. + /* An address when a symbol is decided is buried here
  9005. + and crowded with the inside of a file. */
  9006. +
  9007. + /* A command code is acquired. */
  9008. + insn = bfd_getl16 ((unsigned char *) where);
  9009. +
  9010. + switch (fixp->fx_r_type)
  9011. + {
  9012. + case BFD_RELOC_C33_AH: /* @ah (25:13) */ /* NO USE : Absolute symbol */
  9013. +
  9014. + insn += ((value >> 13) & 0x1fff);
  9015. + break;
  9016. +
  9017. + case BFD_RELOC_C33_AL: /* @ah (12:0) */ /* NO USE : Absolute symbol */
  9018. + insn += (value & 0x1fff);
  9019. + break;
  9020. +
  9021. + case BFD_RELOC_C33_RH: /* LABEL-PC(31:22) */
  9022. +// if( g_listing == 0 ){ /* No -a option ? */
  9023. +// g_where_rh = fixp->fx_where;
  9024. +// }
  9025. +// else{
  9026. +// g_pwhere_rh = where;
  9027. +// }
  9028. +//
  9029. + insn += (((value - 4) >> 19) & 0x1ff8);
  9030. + break;
  9031. +
  9032. + case BFD_RELOC_C33_RM: /* LABEL-PC(21:9) */
  9033. +
  9034. +// if( g_listing == 0 ){ /* No -a option ? */
  9035. +//
  9036. +// g_where_rm = fixp->fx_where;
  9037. +// if( g_where_rh != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
  9038. +//
  9039. +// lNumber = value;
  9040. +// /* over signed 22bit ? */
  9041. +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  9042. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9043. +// /* as_bad_where = ERROR */
  9044. +// }
  9045. +// g_where_rh = 0xffffffff;
  9046. +// }
  9047. +// else
  9048. +// {
  9049. +// g_pwhere_rm = where;
  9050. +// if( g_pwhere_rh != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
  9051. +//
  9052. +// lNumber = value;
  9053. +// /* over signed 22bit ? */
  9054. +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  9055. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9056. +// /* as_bad_where = ERROR */
  9057. +// }
  9058. +// g_pwhere_rh = 0;
  9059. +// }
  9060. + insn += (((value - 2) >> 9) & 0x1fff);
  9061. + break;
  9062. +
  9063. + case BFD_RELOC_C33_RL: /* LABEL-PC(8:0) */
  9064. +
  9065. +// -al オプション付きのとき、where値が必ずしも@rm のPC+100とは限らないため、不採用。
  9066. +// -al無し( fixp->fx_where )ではOKだが、-alの有無でワーニング表示が異なるのは変なので両方削除した。
  9067. +
  9068. +// if( g_listing == 0 ){ /* No -a option ? */
  9069. +//
  9070. +// if( g_where_rm != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
  9071. +//
  9072. +// lNumber = value;
  9073. +// /* over signed 8bit ? */
  9074. +// if (lNumber > 254 || lNumber < -256)
  9075. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9076. +// /* as_bad_where = ERROR */
  9077. +// }
  9078. +// g_where_rh = 0xffffffff;
  9079. +// g_where_rm = 0xffffffff;
  9080. +// }
  9081. +// else
  9082. +// {
  9083. +//
  9084. +// if( g_pwhere_rm != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
  9085. +//
  9086. +// lNumber = value;
  9087. +// /* over signed 8bit ? */
  9088. +// if (lNumber > 254 || lNumber < -256)
  9089. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9090. +// /* as_bad_where = ERROR */
  9091. +// }
  9092. +// g_pwhere_rh = 0;
  9093. +// g_pwhere_rm = 0;
  9094. +// }
  9095. +
  9096. + insn += ((value >> 1) & 0xff);
  9097. + break;
  9098. +
  9099. +/* add T.Tazaki 2002.05.02 >>> */
  9100. +
  9101. + case BFD_RELOC_C33_S_RH: /* LABEL-PC(31:22) */ /* sjp,scall, xjp,xcall */
  9102. + g_where_rh = fixp->fx_where;
  9103. +
  9104. + insn += (((value - 4) >> 19) & 0x1ff8);
  9105. + break;
  9106. +
  9107. + case BFD_RELOC_C33_S_RM: /* LABEL-PC(21:9) */ /* sjp,scall, xjp,xcall */
  9108. +
  9109. + g_where_rm = fixp->fx_where;
  9110. + if( g_where_rh != ( fixp->fx_where - 2 ) ){
  9111. +
  9112. + lNumber = value;
  9113. + /* over signed 22bit ? */
  9114. + if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  9115. + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9116. + /* as_bad_where = ERROR */
  9117. + }
  9118. + g_where_rh = 0xffffffff;
  9119. + insn += (((value - 2) >> 9) & 0x1fff);
  9120. + break;
  9121. +
  9122. + case BFD_RELOC_C33_S_RL: /* LABEL-PC(8:0) */ /* sjp,scall, xjp,xcall */
  9123. +
  9124. + if( g_where_rm != ( fixp->fx_where - 2 ) ){
  9125. +
  9126. + lNumber = value;
  9127. + /* over signed 8bit ? */
  9128. + if (lNumber > 254 || lNumber < -256)
  9129. + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9130. + /* as_bad_where = ERROR */
  9131. + }
  9132. + g_where_rh = 0xffffffff;
  9133. + g_where_rm = 0xffffffff;
  9134. +
  9135. + insn += ((value >> 1) & 0xff);
  9136. + break;
  9137. +
  9138. +/* add T.Tazaki 2002.05.02 <<< */
  9139. +
  9140. + case BFD_RELOC_C33_JP: /* LABEL-PC(8:0) */ /* add T.Tazaki 2002.04.22 */
  9141. + /* jp label */
  9142. +
  9143. + /* over signed 8bit ? */
  9144. + iNumber = value;
  9145. +
  9146. + if (iNumber > 254 || iNumber < -256)
  9147. + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9148. +
  9149. + insn += ((value >> 1) & 0xff);
  9150. + break;
  9151. +
  9152. + case BFD_RELOC_C33_H: /* LABEL(31:19) */ /* NO USE : Absolute symbol */
  9153. + insn += ((value >> 19) & 0x1fff);
  9154. + break;
  9155. +
  9156. + case BFD_RELOC_C33_M: /* LABEL(18:6) */ /* NO USE : Absolute symbol */
  9157. + insn += ((value >> 6) & 0x1fff);
  9158. + break;
  9159. +
  9160. + case BFD_RELOC_C33_L: /* LABEL(5:0) */ /* NO USE : Absolute symbol */
  9161. + /* ld.w rd,LABEL@l */
  9162. + insn += (value & 0x3f) << 4;
  9163. + break;
  9164. +
  9165. + case BFD_RELOC_C33_LOOP: /* LABEL-PC(4:0) */
  9166. +
  9167. + /* over imm 5bit ? */
  9168. + iNumber = value;
  9169. +
  9170. + if (iNumber > 30 || iNumber < 0)
  9171. + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  9172. +
  9173. + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
  9174. + /* " nop " */
  9175. + /* " nop " */
  9176. + /* "Label: " */
  9177. +
  9178. + --value;
  9179. +
  9180. + /* add T.Tazaki 2004/09/22 <<< */
  9181. +
  9182. + /* imm5=imm(4:1) imm5(0)=0 */
  9183. + insn += (value & 0x1e) << 3;
  9184. + break;
  9185. +
  9186. + default:
  9187. + break;
  9188. + }
  9189. +
  9190. + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
  9191. + }
  9192. + else if (fixp->fx_size == 4)
  9193. + bfd_putl32 (value, (unsigned char *) where);
  9194. + }
  9195. +
  9196. + fixp->fx_addnumber = value;
  9197. +
  9198. + return 1;
  9199. +}
  9200. +
  9201. +
  9202. +/* Parse a cons expression. */
  9203. +void
  9204. +parse_cons_expression_c33 (exp)
  9205. + expressionS * exp;
  9206. +{
  9207. + /* See if there's a reloc prefix like hi() we have to handle. */
  9208. + hold_cons_reloc = c33_reloc_prefix ();
  9209. +
  9210. + /* Do normal expression parsing. */
  9211. + expression (exp);
  9212. +}
  9213. +
  9214. +/* Create a fixup for a cons expression. If parse_cons_expression_c33
  9215. + found a reloc prefix, then we use that reloc, else we choose an
  9216. + appropriate one based on the size of the expression. */
  9217. +void
  9218. +cons_fix_new_c33 (frag, where, size, exp)
  9219. + fragS * frag;
  9220. + int where;
  9221. + int size;
  9222. + expressionS *exp;
  9223. +{
  9224. + if (hold_cons_reloc == BFD_RELOC_UNUSED)
  9225. + {
  9226. + if (size == 4)
  9227. + hold_cons_reloc = BFD_RELOC_32;
  9228. + if (size == 2)
  9229. + hold_cons_reloc = BFD_RELOC_16;
  9230. + if (size == 1)
  9231. + hold_cons_reloc = BFD_RELOC_8;
  9232. + }
  9233. +
  9234. + if (exp != NULL)
  9235. + fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc);
  9236. + else
  9237. + fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
  9238. +}
  9239. +
  9240. +boolean
  9241. +c33_fix_adjustable (fixP)
  9242. + fixS * fixP;
  9243. +{
  9244. + if (fixP->fx_addsy == NULL)
  9245. + return 1;
  9246. +
  9247. + /* Prevent all adjustments to global symbols. */
  9248. + if (S_IS_EXTERN (fixP->fx_addsy))
  9249. + return 0;
  9250. +
  9251. + if (S_IS_WEAK (fixP->fx_addsy))
  9252. + return 0;
  9253. +
  9254. + /* Don't adjust function names */
  9255. + if (S_IS_FUNCTION (fixP->fx_addsy))
  9256. + return 0;
  9257. +
  9258. + return 1;
  9259. +}
  9260. +
  9261. +int
  9262. +c33_force_relocation (fixP)
  9263. + struct fix * fixP;
  9264. +{
  9265. + if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
  9266. + return 1;
  9267. +
  9268. + return 0;
  9269. +}
  9270. diff --git a/gas/config/tc-c33.c b/gas/config/tc-c33.c
  9271. new file mode 100644
  9272. index 0000000..3dd3b44
  9273. --- /dev/null
  9274. +++ b/gas/config/tc-c33.c
  9275. @@ -0,0 +1,5098 @@
  9276. +/* tc-c33.c -- Assembler code for the EPSON EOC33
  9277. + Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation.
  9278. +
  9279. + This file is part of GAS, the GNU Assembler.
  9280. +
  9281. + GAS is free software; you can redistribute it and/or modify
  9282. + it under the terms of the GNU General Public License as published by
  9283. + the Free Software Foundation; either version 2, or (at your option)
  9284. + any later version.
  9285. +
  9286. + GAS is distributed in the hope that it will be useful,
  9287. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  9288. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9289. + GNU General Public License for more details.
  9290. +
  9291. + You should have received a copy of the GNU General Public License
  9292. + along with GAS; see the file COPYING. If not, write to
  9293. + the Free Software Foundation, 59 Temple Place - Suite 330,
  9294. + Boston, MA 02111-1307, USA. */
  9295. +
  9296. +#include <stdio.h>
  9297. +#include <ctype.h>
  9298. +#include "as.h"
  9299. +#include "subsegs.h"
  9300. +#include "opcode/c33.h"
  9301. +#include "ext_remove.h" // add D.Fujimoto 2007/06/21
  9302. +
  9303. +#define AREA_CDA 0
  9304. +#define AREA_GDA 1
  9305. +#define AREA_ZDA 2
  9306. +#define AREA_SDA 3
  9307. +#define AREA_TDA 4
  9308. +#define AREA_LCDA 5
  9309. +#define AREA_LGDA 6
  9310. +#define AREA_LZDA 7
  9311. +#define AREA_LSDA 8
  9312. +#define AREA_LTDA 9
  9313. +
  9314. +
  9315. +#define O_spregister O_md1 /* for c33 %sp */
  9316. +#define O_dpregister O_md2 /* for c33 %dp */
  9317. +#define O_cond O_md3 /* for c33 ext cond */
  9318. +#define O_op_shift O_md4 /* for c33 ext OP */
  9319. +
  9320. +#define SGP_REG 12 /* GP register */
  9321. +#define TGP_REG 13 /* GP register */
  9322. +#define ZGP_REG 14 /* GP register */
  9323. +#define GP_REG 15 /* GP register */
  9324. +
  9325. +/* Temporarily holds the reloc in a cons expression. */
  9326. +static bfd_reloc_code_real_type hold_cons_reloc;
  9327. +
  9328. +
  9329. +
  9330. +/* Structure to hold information about predefined registers. */
  9331. +struct reg_name
  9332. +{
  9333. + const char * name;
  9334. + int value;
  9335. +};
  9336. +
  9337. +/* Generic assembler global variables which must be defined by all targets. */
  9338. +
  9339. +/* Characters which always start a comment. */
  9340. +const char comment_chars[] = ";";
  9341. +
  9342. +/* Characters which start a comment at the beginning of a line. */
  9343. +const char line_comment_chars[] = "";
  9344. +
  9345. +/* Characters which may be used to separate multiple commands on a
  9346. + single line. */
  9347. +const char line_separator_chars[] = "";
  9348. +
  9349. +/* Characters which are used to indicate an exponent in a floating
  9350. + point number. */
  9351. +const char EXP_CHARS[] = "eE";
  9352. +
  9353. +/* Characters which mean that a number is a floating point constant,
  9354. + as in 0d1.0. */
  9355. +const char FLT_CHARS[] = "dD";
  9356. +
  9357. +
  9358. +const relax_typeS md_relax_table[] =
  9359. +{
  9360. + /* Conditional branches. */
  9361. + {0xff, -0x100, 2, 1},
  9362. + {0x1fffff, -0x200000, 6, 0},
  9363. + /* Unconditional branches. */
  9364. + {0xff, -0x100, 2, 3},
  9365. + {0x1fffff, -0x200000, 4, 0},
  9366. +};
  9367. +
  9368. +/* add tazaki 2001.12.03 */
  9369. +static segT comm_section = NULL;
  9370. +static segT gcomm_section = NULL;
  9371. +static segT scomm_section = NULL;
  9372. +static segT tcomm_section = NULL;
  9373. +static segT zcomm_section = NULL;
  9374. +static segT gbss_section = NULL;
  9375. +static segT sbss_section = NULL;
  9376. +static segT tbss_section = NULL;
  9377. +static segT zbss_section = NULL;
  9378. +/* add tazaki 2001.12.03 */
  9379. +
  9380. +/* add T.Tazaki 2002.04.26 >>> */
  9381. +extern int g_listing;
  9382. +/* add T.Tazaki 2002.04.26 <<< */
  9383. +
  9384. +/* fixups */
  9385. +#define MAX_INSN_FIXUPS (5)
  9386. +struct c33_fixup
  9387. +{
  9388. + expressionS exp;
  9389. + int opindex;
  9390. + bfd_reloc_code_real_type reloc;
  9391. +};
  9392. +
  9393. +struct c33_fixup fixups [MAX_INSN_FIXUPS];
  9394. +static int fc;
  9395. +
  9396. +
  9397. +
  9398. +/******************************************************************************
  9399. + INPUT int area of symbol
  9400. + RETURN void
  9401. + Explanation assembler false instruction(.gcomm/.scomm/.tcomm/.zcomm) Evaluation
  9402. +******************************************************************************/
  9403. +/* Copied from obj_elf_common() in gas/config/obj-elf.c */
  9404. +static void
  9405. +c33_comm (area)
  9406. + int area;
  9407. +{
  9408. + char * name;
  9409. + char c;
  9410. + char * p;
  9411. + int temp;
  9412. + int size;
  9413. + symbolS * symbolP;
  9414. + int have_align;
  9415. + char * pfrag;
  9416. +
  9417. + name = input_line_pointer;
  9418. + c = get_symbol_end ();
  9419. +
  9420. + /* just after name is now '\0' */
  9421. + p = input_line_pointer;
  9422. + *p = c;
  9423. +
  9424. + /* skip space */
  9425. + SKIP_WHITESPACE ();
  9426. +
  9427. + /* Is the character after ".comm" a pause character? */
  9428. + if (*input_line_pointer != ',')
  9429. + {
  9430. + as_bad (_("Expected comma after symbol-name"));
  9431. + ignore_rest_of_line ();
  9432. + return;
  9433. + }
  9434. +
  9435. + input_line_pointer ++; /* skip ',' */
  9436. +
  9437. + if ((temp = get_absolute_expression ()) < 0)
  9438. + {
  9439. + /* xgettext:c-format */
  9440. + as_bad (_(".COMMon length (%d.) < 0! Ignored."), temp);
  9441. + ignore_rest_of_line ();
  9442. + return;
  9443. + }
  9444. +
  9445. + size = temp;
  9446. + *p = 0;
  9447. + symbolP = symbol_find_or_make (name);
  9448. + *p = c;
  9449. +
  9450. +/* if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP)) */
  9451. + if (S_IS_DEFINED (symbolP) )
  9452. + {
  9453. + as_bad (_("Ignoring attempt to re-define symbol"));
  9454. + ignore_rest_of_line ();
  9455. + return;
  9456. + }
  9457. +
  9458. + if (S_GET_VALUE (symbolP) != 0)
  9459. + {
  9460. + if (S_GET_VALUE (symbolP) != size)
  9461. + {
  9462. + /* xgettext:c-format */
  9463. + as_warn (_("Length of .comm \"%s\" is already %ld. Not changed to %d."),
  9464. + S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
  9465. + }
  9466. + }
  9467. +
  9468. + know (symbol_get_frag (symbolP) == & zero_address_frag);
  9469. +
  9470. + if (*input_line_pointer != ',')
  9471. + have_align = 0;
  9472. + else
  9473. + {
  9474. + have_align = 1;
  9475. + input_line_pointer++;
  9476. + SKIP_WHITESPACE ();
  9477. + }
  9478. +
  9479. + if (! have_align || *input_line_pointer != '"')
  9480. + {
  9481. + if (! have_align)
  9482. + temp = 0;
  9483. + else
  9484. + {
  9485. + temp = get_absolute_expression ();
  9486. +
  9487. + if (temp < 0)
  9488. + {
  9489. + temp = 0;
  9490. + as_warn (_("Common alignment negative; 0 assumed"));
  9491. + }
  9492. + }
  9493. +
  9494. +
  9495. +/* if (symbol_get_obj (symbolP)->local)*/
  9496. + if (!(area == AREA_CDA || area == AREA_GDA || area == AREA_SDA || area == AREA_TDA || area == AREA_ZDA ))
  9497. + {
  9498. + /* NOT EXIST ROUTINE */
  9499. +
  9500. + segT old_sec;
  9501. + int old_subsec;
  9502. + int align;
  9503. + flagword applicable;
  9504. +
  9505. + old_sec = now_seg;
  9506. + old_subsec = now_subseg;
  9507. +
  9508. + applicable = bfd_applicable_section_flags (stdoutput);
  9509. +
  9510. + applicable &= SEC_ALLOC;
  9511. +
  9512. + switch (area)
  9513. + {
  9514. + case AREA_CDA:
  9515. + if (comm_section == NULL)
  9516. + {
  9517. +
  9518. + comm_section = subseg_new (".comm", 0);
  9519. +
  9520. + bfd_set_section_flags (stdoutput, comm_section, applicable);
  9521. +
  9522. + seg_info (comm_section)->bss = 1;
  9523. + }
  9524. + break;
  9525. +
  9526. + case AREA_GDA:
  9527. + if (gcomm_section == NULL)
  9528. + {
  9529. + gcomm_section = subseg_new (".gcomm", 0);
  9530. +
  9531. + bfd_set_section_flags (stdoutput, gcomm_section, applicable);
  9532. +
  9533. + seg_info (gcomm_section)->bss = 1;
  9534. + }
  9535. + break;
  9536. +
  9537. + case AREA_SDA:
  9538. + if (scomm_section == NULL)
  9539. + {
  9540. + scomm_section = subseg_new (".scomm", 0);
  9541. +
  9542. + bfd_set_section_flags (stdoutput, scomm_section, applicable);
  9543. +
  9544. + seg_info (scomm_section)->bss = 1;
  9545. + }
  9546. + break;
  9547. +
  9548. + case AREA_TDA:
  9549. + if (tcomm_section == NULL)
  9550. + {
  9551. + tcomm_section = subseg_new (".tcomm", 0);
  9552. +
  9553. + bfd_set_section_flags (stdoutput, tcomm_section, applicable);
  9554. +
  9555. + seg_info (tcomm_section)->bss = 1;
  9556. + }
  9557. + break;
  9558. +
  9559. + case AREA_ZDA:
  9560. + if (zcomm_section == NULL)
  9561. + {
  9562. + zcomm_section = subseg_new (".zcomm", 0);
  9563. +
  9564. + bfd_set_section_flags (stdoutput, zcomm_section, applicable);
  9565. +
  9566. + seg_info (zcomm_section)->bss = 1;
  9567. + }
  9568. + break;
  9569. +
  9570. + }
  9571. +
  9572. + if (temp)
  9573. + {
  9574. + /* convert to a power of 2 alignment */
  9575. + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
  9576. + ;
  9577. +
  9578. + if (temp != 1)
  9579. + {
  9580. + as_bad (_("Common alignment not a power of 2"));
  9581. + ignore_rest_of_line ();
  9582. + return;
  9583. + }
  9584. + }
  9585. + else
  9586. + align = 0;
  9587. +
  9588. + switch (area)
  9589. + {
  9590. + case AREA_CDA:
  9591. + record_alignment (comm_section, align);
  9592. + obj_elf_section_change_hook();
  9593. + subseg_set (comm_section, 0);
  9594. + break;
  9595. +
  9596. + case AREA_GDA:
  9597. + record_alignment (gcomm_section, align);
  9598. + obj_elf_section_change_hook();
  9599. + subseg_set (gcomm_section, 0);
  9600. + break;
  9601. +
  9602. + case AREA_SDA:
  9603. + record_alignment (scomm_section, align);
  9604. + obj_elf_section_change_hook();
  9605. + subseg_set (scomm_section, 0);
  9606. + break;
  9607. +
  9608. + case AREA_TDA:
  9609. + record_alignment (tcomm_section, align);
  9610. + obj_elf_section_change_hook();
  9611. + subseg_set (tcomm_section, 0);
  9612. + break;
  9613. +
  9614. + case AREA_ZDA:
  9615. + record_alignment (zcomm_section, align);
  9616. + obj_elf_section_change_hook();
  9617. + subseg_set (zcomm_section, 0);
  9618. + break;
  9619. +
  9620. + default:
  9621. + abort();
  9622. + }
  9623. +
  9624. + if (align)
  9625. + frag_align (align, 0, 0);
  9626. +
  9627. + switch (area)
  9628. + {
  9629. + case AREA_CDA:
  9630. + if (S_GET_SEGMENT (symbolP) == comm_section)
  9631. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9632. + break;
  9633. +
  9634. + case AREA_GDA:
  9635. + if (S_GET_SEGMENT (symbolP) == gcomm_section)
  9636. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9637. + break;
  9638. +
  9639. + case AREA_SDA:
  9640. + if (S_GET_SEGMENT (symbolP) == scomm_section)
  9641. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9642. + break;
  9643. +
  9644. + case AREA_TDA:
  9645. + if (S_GET_SEGMENT (symbolP) == tcomm_section)
  9646. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9647. + break;
  9648. +
  9649. + case AREA_ZDA:
  9650. + if (S_GET_SEGMENT (symbolP) == zcomm_section)
  9651. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9652. + break;
  9653. +
  9654. + default:
  9655. + abort ();
  9656. + }
  9657. +
  9658. + symbol_set_frag (symbolP, frag_now);
  9659. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9660. + (offsetT) size, (char *) 0);
  9661. + *pfrag = 0;
  9662. + S_SET_SIZE (symbolP, size);
  9663. +
  9664. + switch (area)
  9665. + {
  9666. + case AREA_CDA:
  9667. + S_SET_SEGMENT (symbolP, comm_section);
  9668. + break;
  9669. +
  9670. + case AREA_GDA:
  9671. + S_SET_SEGMENT (symbolP, gcomm_section);
  9672. + break;
  9673. +
  9674. + case AREA_SDA:
  9675. + S_SET_SEGMENT (symbolP, scomm_section);
  9676. + break;
  9677. +
  9678. + case AREA_TDA:
  9679. + S_SET_SEGMENT (symbolP, tcomm_section);
  9680. + break;
  9681. +
  9682. + case AREA_ZDA:
  9683. + S_SET_SEGMENT (symbolP, zcomm_section);
  9684. + break;
  9685. +
  9686. + default:
  9687. + abort();
  9688. + }
  9689. +
  9690. + if (symbol_get_obj (symbolP)->local)
  9691. + S_CLEAR_EXTERNAL (symbolP);
  9692. + else
  9693. + S_SET_EXTERNAL (symbolP);
  9694. +
  9695. + obj_elf_section_change_hook();
  9696. + subseg_set (old_sec, old_subsec);
  9697. + }
  9698. + else
  9699. + {
  9700. + /*==========================================================================*/
  9701. + /* Evaluation of .comm */
  9702. + /*==========================================================================*/
  9703. + segT old_sec;
  9704. + int old_subsec;
  9705. + int align;
  9706. + int i_now_align; /* add 2002.01.21 */
  9707. + i_now_align = temp; /* add 2002.01.21 */
  9708. +
  9709. + /* computing of alignment */
  9710. + if (temp)
  9711. + {
  9712. + /* convert to a power of 2 alignment */
  9713. + for (align = 0; (temp & 1) == 0; temp >>= 1, ++align)
  9714. + ;
  9715. +
  9716. + if (temp != 1)
  9717. + {
  9718. + as_bad (_("Common alignment not a power of 2"));
  9719. + ignore_rest_of_line ();
  9720. + return;
  9721. + }
  9722. + }
  9723. + else
  9724. + align = 0;
  9725. +
  9726. + old_sec = now_seg;
  9727. + old_subsec = now_subseg;
  9728. +
  9729. + allocate_common:
  9730. +
  9731. + /* Convert .local + .xcomm to local section. */
  9732. +
  9733. + if (symbol_get_obj (symbolP)->local){
  9734. + switch (area)
  9735. + {
  9736. + case AREA_CDA:
  9737. + area = AREA_LCDA;
  9738. + break;
  9739. + case AREA_GDA:
  9740. + area = AREA_LGDA;
  9741. + break;
  9742. + case AREA_SDA:
  9743. + area = AREA_LSDA;
  9744. + break;
  9745. + case AREA_TDA:
  9746. + area = AREA_LTDA;
  9747. + break;
  9748. + case AREA_ZDA:
  9749. + area = AREA_LZDA;
  9750. + break;
  9751. + }
  9752. + }
  9753. +
  9754. + switch (area)
  9755. + {
  9756. + case AREA_CDA:
  9757. + if (comm_section == NULL)
  9758. + {
  9759. + flagword applicable;
  9760. +
  9761. + applicable = bfd_applicable_section_flags (stdoutput);
  9762. +
  9763. + comm_section = subseg_new (".comm", 0);
  9764. +
  9765. + bfd_set_section_flags (stdoutput, comm_section, applicable
  9766. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  9767. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  9768. + }
  9769. + S_SET_SEGMENT (symbolP, comm_section);
  9770. + record_alignment (comm_section, align);
  9771. +
  9772. + break;
  9773. +
  9774. + case AREA_GDA:
  9775. + if (gcomm_section == NULL)
  9776. + {
  9777. + flagword applicable;
  9778. +
  9779. + applicable = bfd_applicable_section_flags (stdoutput);
  9780. +
  9781. + gcomm_section = subseg_new (".gcomm", 0);
  9782. +
  9783. + bfd_set_section_flags (stdoutput, gcomm_section, applicable
  9784. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  9785. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  9786. + }
  9787. + S_SET_SEGMENT (symbolP, gcomm_section);
  9788. + record_alignment (gcomm_section, align);
  9789. + break;
  9790. +
  9791. + case AREA_SDA:
  9792. + if (scomm_section == NULL)
  9793. + {
  9794. + flagword applicable;
  9795. +
  9796. + applicable = bfd_applicable_section_flags (stdoutput);
  9797. +
  9798. + scomm_section = subseg_new (".scomm", 0);
  9799. +
  9800. + bfd_set_section_flags (stdoutput, scomm_section, applicable
  9801. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  9802. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  9803. + }
  9804. + S_SET_SEGMENT (symbolP, scomm_section);
  9805. + record_alignment (scomm_section, align);
  9806. + break;
  9807. +
  9808. + case AREA_TDA:
  9809. + if (tcomm_section == NULL)
  9810. + {
  9811. + flagword applicable;
  9812. +
  9813. + applicable = bfd_applicable_section_flags (stdoutput);
  9814. +
  9815. + tcomm_section = subseg_new (".tcomm", 0);
  9816. +
  9817. + bfd_set_section_flags (stdoutput, tcomm_section, applicable
  9818. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  9819. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  9820. + }
  9821. + S_SET_SEGMENT (symbolP, tcomm_section);
  9822. + record_alignment (tcomm_section, align);
  9823. + break;
  9824. +
  9825. + case AREA_ZDA:
  9826. + if (zcomm_section == NULL)
  9827. + {
  9828. + flagword applicable;
  9829. +
  9830. + applicable = bfd_applicable_section_flags (stdoutput);
  9831. +
  9832. + zcomm_section = subseg_new (".zcomm", 0);
  9833. +
  9834. + bfd_set_section_flags (stdoutput, zcomm_section, applicable
  9835. + & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA
  9836. + | SEC_HAS_CONTENTS) | SEC_IS_COMMON);
  9837. + }
  9838. + S_SET_SEGMENT (symbolP, zcomm_section);
  9839. + record_alignment (zcomm_section, align);
  9840. + break;
  9841. +
  9842. +
  9843. + case AREA_LCDA:
  9844. + /* Convert local comm to .bss section. */
  9845. + obj_elf_section_change_hook();
  9846. + subseg_set (bss_section, 0);
  9847. +
  9848. + if (S_GET_SEGMENT (symbolP) == bss_section)
  9849. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9850. +
  9851. + if (align)
  9852. + frag_align (align, 0, 0);
  9853. +
  9854. + symbol_set_frag (symbolP, frag_now);
  9855. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9856. + (offsetT) size, (char *) 0);
  9857. + *pfrag = 0;
  9858. +
  9859. + S_SET_SIZE (symbolP, size);
  9860. + S_SET_SEGMENT (symbolP, bss_section);
  9861. + record_alignment (bss_section, align);
  9862. +
  9863. + break;
  9864. +
  9865. + case AREA_LGDA:
  9866. + if (gbss_section == NULL)
  9867. + {
  9868. + flagword applicable;
  9869. +
  9870. + applicable = bfd_applicable_section_flags (stdoutput);
  9871. +
  9872. + gbss_section = subseg_new (".gbss", 0);
  9873. +
  9874. + bfd_set_section_flags (stdoutput, gbss_section, applicable & SEC_ALLOC);
  9875. +
  9876. + seg_info (gbss_section)->bss = 1;
  9877. + }
  9878. +
  9879. + record_alignment (gbss_section, align);
  9880. + obj_elf_section_change_hook();
  9881. + subseg_set (gbss_section, 0);
  9882. +
  9883. + if (align)
  9884. + frag_align (align, 0, 0);
  9885. +
  9886. + if (S_GET_SEGMENT (symbolP) == gbss_section)
  9887. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9888. +
  9889. + symbol_set_frag (symbolP, frag_now);
  9890. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9891. + (offsetT) size, (char *) 0);
  9892. + *pfrag = 0;
  9893. + S_SET_SIZE (symbolP, size);
  9894. + S_SET_SEGMENT (symbolP, gbss_section);
  9895. +
  9896. + break;
  9897. +
  9898. + case AREA_LSDA:
  9899. + if (sbss_section == NULL)
  9900. + {
  9901. + flagword applicable;
  9902. +
  9903. + applicable = bfd_applicable_section_flags (stdoutput);
  9904. +
  9905. + sbss_section = subseg_new (".sbss", 0);
  9906. +
  9907. + bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC);
  9908. +
  9909. + seg_info (sbss_section)->bss = 1;
  9910. + }
  9911. +
  9912. + record_alignment (sbss_section, align);
  9913. + obj_elf_section_change_hook();
  9914. + subseg_set (sbss_section, 0);
  9915. +
  9916. + if (align)
  9917. + frag_align (align, 0, 0);
  9918. +
  9919. + if (S_GET_SEGMENT (symbolP) == sbss_section)
  9920. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9921. +
  9922. + symbol_set_frag (symbolP, frag_now);
  9923. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9924. + (offsetT) size, (char *) 0);
  9925. + *pfrag = 0;
  9926. + S_SET_SIZE (symbolP, size);
  9927. + S_SET_SEGMENT (symbolP, sbss_section);
  9928. +
  9929. + break;
  9930. +
  9931. + case AREA_LTDA:
  9932. + if (tbss_section == NULL)
  9933. + {
  9934. + flagword applicable;
  9935. +
  9936. + applicable = bfd_applicable_section_flags (stdoutput);
  9937. +
  9938. + tbss_section = subseg_new (".tbss", 0);
  9939. +
  9940. + bfd_set_section_flags (stdoutput, tbss_section, applicable & SEC_ALLOC);
  9941. +
  9942. + seg_info (tbss_section)->bss = 1;
  9943. + }
  9944. +
  9945. + record_alignment (tbss_section, align);
  9946. + obj_elf_section_change_hook();
  9947. + subseg_set (tbss_section, 0);
  9948. +
  9949. + if (align)
  9950. + frag_align (align, 0, 0);
  9951. +
  9952. + if (S_GET_SEGMENT (symbolP) == tbss_section)
  9953. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9954. +
  9955. + symbol_set_frag (symbolP, frag_now);
  9956. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9957. + (offsetT) size, (char *) 0);
  9958. + *pfrag = 0;
  9959. + S_SET_SIZE (symbolP, size);
  9960. + S_SET_SEGMENT (symbolP, tbss_section);
  9961. +
  9962. + break;
  9963. +
  9964. + case AREA_LZDA:
  9965. + if (zbss_section == NULL)
  9966. + {
  9967. + flagword applicable;
  9968. +
  9969. + applicable = bfd_applicable_section_flags (stdoutput);
  9970. +
  9971. + zbss_section = subseg_new (".zbss", 0);
  9972. +
  9973. + bfd_set_section_flags (stdoutput, zbss_section, applicable & SEC_ALLOC);
  9974. +
  9975. + seg_info (zbss_section)->bss = 1;
  9976. + }
  9977. +
  9978. + record_alignment (zbss_section, align);
  9979. + obj_elf_section_change_hook();
  9980. + subseg_set (zbss_section, 0);
  9981. +
  9982. + if (align)
  9983. + frag_align (align, 0, 0);
  9984. +
  9985. + if (S_GET_SEGMENT (symbolP) == zbss_section)
  9986. + symbol_get_frag (symbolP)->fr_symbol = 0;
  9987. +
  9988. + symbol_set_frag (symbolP, frag_now);
  9989. + pfrag = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
  9990. + (offsetT) size, (char *) 0);
  9991. + *pfrag = 0;
  9992. + S_SET_SIZE (symbolP, size);
  9993. + S_SET_SEGMENT (symbolP, zbss_section);
  9994. +
  9995. + break;
  9996. +
  9997. + default:
  9998. + abort();
  9999. + }
  10000. +
  10001. + if (area == AREA_LCDA || area == AREA_LGDA || area == AREA_LSDA || area == AREA_LTDA || area == AREA_LZDA) /* ローカル? */
  10002. + {
  10003. + S_CLEAR_EXTERNAL (symbolP);
  10004. + }else{
  10005. + S_SET_VALUE (symbolP, (valueT) size);
  10006. +// S_SET_ALIGN (symbolP, temp);
  10007. + if( i_now_align )
  10008. + S_SET_ALIGN (symbolP, i_now_align);
  10009. + S_SET_EXTERNAL (symbolP);
  10010. + }
  10011. +
  10012. + obj_elf_section_change_hook();
  10013. + subseg_set (old_sec, old_subsec);
  10014. +
  10015. + }
  10016. +}
  10017. + else
  10018. + {
  10019. + input_line_pointer++;
  10020. + /* @@ Some use the dot, some don't. Can we get some consistency?? */
  10021. + if (*input_line_pointer == '.')
  10022. + input_line_pointer++;
  10023. + /* @@ Some say data, some say bss. */
  10024. + if (strncmp (input_line_pointer, "bss\"", 4)
  10025. + && strncmp (input_line_pointer, "data\"", 5))
  10026. + {
  10027. + while (*--input_line_pointer != '"')
  10028. + ;
  10029. + input_line_pointer--;
  10030. + goto bad_common_segment;
  10031. + }
  10032. + while (*input_line_pointer++ != '"')
  10033. + ;
  10034. + goto allocate_common;
  10035. + }
  10036. +
  10037. + symbol_get_bfdsym (symbolP)->flags |= BSF_OBJECT;
  10038. +
  10039. + demand_empty_rest_of_line ();
  10040. + return;
  10041. +
  10042. + {
  10043. + bad_common_segment:
  10044. + p = input_line_pointer;
  10045. + while (*p && *p != '\n')
  10046. + p++;
  10047. + c = *p;
  10048. + *p = '\0';
  10049. + as_bad (_("bad .common segment %s"), input_line_pointer + 1);
  10050. + *p = c;
  10051. + input_line_pointer = p;
  10052. + ignore_rest_of_line ();
  10053. + return;
  10054. + }
  10055. +}
  10056. +
  10057. +/* The target specific pseudo-ops which we support. */
  10058. +const pseudo_typeS md_pseudo_table[] =
  10059. +{
  10060. + {"comm", c33_comm, AREA_CDA},
  10061. + {"gcomm", c33_comm, AREA_GDA},
  10062. + {"scomm", c33_comm, AREA_SDA},
  10063. + {"tcomm", c33_comm, AREA_TDA},
  10064. + {"zcomm", c33_comm, AREA_ZDA},
  10065. + { NULL, NULL, 0}
  10066. +};
  10067. +
  10068. +/*****************************************************************************/
  10069. +
  10070. +
  10071. +
  10072. +/* Opcode hash table. */
  10073. +static struct hash_control *c33_hash;
  10074. +
  10075. +/* This table is sorted. Suitable for searching by a binary search. */
  10076. +static const struct reg_name pre_defined_registers[] =
  10077. +{
  10078. + { "%r0", 0 },
  10079. + { "%r1", 1 },
  10080. + { "%r10", 10 },
  10081. + { "%r11", 11 },
  10082. + { "%r12", 12 },
  10083. + { "%r13", 13 },
  10084. + { "%r14", 14 },
  10085. + { "%r15", 15 },
  10086. + { "%r2", 2 },
  10087. + { "%r3", 3 },
  10088. + { "%r4", 4 },
  10089. + { "%r5", 5 },
  10090. + { "%r6", 6 },
  10091. + { "%r7", 7 },
  10092. + { "%r8", 8 },
  10093. + { "%r9", 9 },
  10094. +};
  10095. +#define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct reg_name))
  10096. +
  10097. +/* standard macro spesial registers */
  10098. +static const struct reg_name system_registers[] =
  10099. +{
  10100. + { "%ahr", 3 },
  10101. + { "%alr", 2 },
  10102. + { "%psr", 0 },
  10103. + { "%sp", 1 },
  10104. +};
  10105. +
  10106. +/* advanced macro spesial registers */
  10107. +static const struct reg_name adv_system_registers[] =
  10108. +{
  10109. + { "%ahr", 3 },
  10110. + { "%alr", 2 },
  10111. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  10112. + { "%dp", 9 }, /* Adv */
  10113. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  10114. + { "%lco", 4 }, /* Adv */
  10115. + { "%lea", 6 }, /* Adv */
  10116. + { "%lsa", 5 }, /* Adv */
  10117. + { "%pc", 15},
  10118. + { "%psr", 0 },
  10119. + { "%sor", 7 }, /* Adv */
  10120. + { "%sp", 1 },
  10121. + { "%ssp", 14 }, /* Adv */
  10122. + { "%ttbr", 8 }, /* Adv */
  10123. + { "%usp", 13 }, /* Adv */
  10124. +};
  10125. +
  10126. +/* ld.w %sd,%rs special registers */
  10127. +static const struct reg_name adv_load_system_registers[] =
  10128. +{
  10129. + { "%ahr", 3 },
  10130. + { "%alr", 2 },
  10131. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  10132. + { "%dp", 9 }, /* Adv */
  10133. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  10134. + { "%lco", 4 }, /* Adv */
  10135. + { "%lea", 6 }, /* Adv */
  10136. + { "%lsa", 5 }, /* Adv */
  10137. + { "%psr", 0 },
  10138. + { "%sor", 7 }, /* Adv */
  10139. + { "%sp", 1 },
  10140. + { "%ssp", 14 }, /* Adv */
  10141. + { "%ttbr", 8 }, /* Adv */
  10142. + { "%usp", 13 }, /* Adv */
  10143. +};
  10144. +
  10145. +/* pushs , pops special registers */
  10146. +static const struct reg_name adv_pushs_system_registers[] =
  10147. +{
  10148. + { "%ahr", 3 },
  10149. + { "%alr", 2 },
  10150. + { "%dbbr", 11 }, /* Adv add T.Tazaki 2003/11/18 */
  10151. + { "%dp", 9 }, /* Adv */
  10152. + { "%idir", 10 }, /* Adv add T.Tazaki 2003/11/18 */
  10153. + { "%lco", 4 }, /* Adv */
  10154. + { "%lea", 6 }, /* Adv */
  10155. + { "%lsa", 5 }, /* Adv */
  10156. + { "%pc", 15 },
  10157. + { "%psr", 0 },
  10158. + { "%sor", 7 }, /* Adv */
  10159. + { "%sp", 1 },
  10160. + { "%ssp", 14 }, /* Adv */
  10161. + { "%ttbr", 8 }, /* Adv */
  10162. + { "%usp", 13 }, /* Adv */
  10163. +};
  10164. +
  10165. +/* PE add T.Tazaki 2003/11/18 >>> */
  10166. +
  10167. +/* PE macro spesial registers */
  10168. +static const struct reg_name pe_system_registers[] =
  10169. +{
  10170. + { "%ahr", 3 },
  10171. + { "%alr", 2 },
  10172. + { "%dbbr", 11 },
  10173. + { "%idir", 10 },
  10174. + { "%pc", 15},
  10175. + { "%psr", 0 },
  10176. + { "%sp", 1 },
  10177. + { "%ttbr", 8 },
  10178. +};
  10179. +
  10180. +/* ld.w %sd,%rs special registers */
  10181. +static const struct reg_name pe_load_system_registers[] =
  10182. +{
  10183. + { "%ahr", 3 },
  10184. + { "%alr", 2 },
  10185. + { "%psr", 0 },
  10186. + { "%sp", 1 },
  10187. + { "%ttbr", 8 },
  10188. +};
  10189. +
  10190. +/* pushs , pops special registers */
  10191. +static const struct reg_name pe_pushs_system_registers[] =
  10192. +{
  10193. + { "%ahr", 3 },
  10194. + { "%alr", 2 },
  10195. +};
  10196. +
  10197. +/* PE add T.Tazaki 2003/11/18 <<< */
  10198. +
  10199. +#define SYSREG_NAME_CNT (sizeof (system_registers) / sizeof (struct reg_name))
  10200. +#define ADV_SYSREG_NAME_CNT (sizeof (adv_system_registers) / sizeof (struct reg_name))
  10201. +#define ADV_LOAD_SYSREG_NAME_CNT (sizeof (adv_load_system_registers) / sizeof (struct reg_name))
  10202. +#define ADV_PUSHS_SYSREG_NAME_CNT (sizeof (adv_pushs_system_registers) / sizeof (struct reg_name))
  10203. +
  10204. +/* PE add T.Tazaki 2003/11/18 >>> */
  10205. +#define PE_SYSREG_NAME_CNT (sizeof (pe_system_registers) / sizeof (struct reg_name))
  10206. +#define PE_LOAD_SYSREG_NAME_CNT (sizeof (pe_load_system_registers) / sizeof (struct reg_name))
  10207. +#define PE_PUSHS_SYSREG_NAME_CNT (sizeof (pe_pushs_system_registers) / sizeof (struct reg_name))
  10208. +/* PE add T.Tazaki 2003/11/18 <<< */
  10209. +
  10210. +/******************************************************************************
  10211. + INPUT const struct reg_name * register name
  10212. + int register string size
  10213. + const char * check register string
  10214. + boolean not used
  10215. + RETURN int register number
  10216. + Explanation Get register number
  10217. +******************************************************************************/
  10218. +/* reg_name_search does a binary search of the given register table
  10219. + to see if "name" is a valid regiter name. Returns the register
  10220. + number from the array on success, or -1 on failure. */
  10221. +
  10222. +static int
  10223. +reg_name_search (regs, regcount, name, accept_numbers)
  10224. + const struct reg_name * regs;
  10225. + int regcount;
  10226. + const char * name;
  10227. + boolean accept_numbers;
  10228. +{
  10229. + int middle, low, high;
  10230. + int cmp;
  10231. + symbolS * symbolP;
  10232. +#if 0
  10233. + /* If the register name is a symbol, then evaluate it. */
  10234. + if ((symbolP = symbol_find (name)) != NULL)
  10235. + {
  10236. + /* If the symbol is an alias for another name then use that.
  10237. + If the symbol is an alias for a number, then return the number. */
  10238. + if (symbol_equated_p (symbolP))
  10239. + {
  10240. + name = S_GET_NAME (symbol_get_value_expression (symbolP)->X_add_symbol);
  10241. + }
  10242. + else if (accept_numbers)
  10243. + {
  10244. + int reg = S_GET_VALUE (symbolP);
  10245. +
  10246. + if (reg >= 0 && reg <= 31)
  10247. + return reg;
  10248. + }
  10249. +#endif
  10250. +
  10251. + low = 0;
  10252. + high = regcount - 1;
  10253. +
  10254. + do
  10255. + {
  10256. + middle = (low + high) / 2;
  10257. + cmp = strcasecmp (name, regs[middle].name);
  10258. + if (cmp < 0)
  10259. + high = middle - 1;
  10260. + else if (cmp > 0)
  10261. + low = middle + 1;
  10262. + else
  10263. + return regs[middle].value;
  10264. + }
  10265. + while (low <= high);
  10266. +
  10267. + return -1;
  10268. +}
  10269. +
  10270. +
  10271. +/******************************************************************************
  10272. + INPUT expressionS * The pointer to a command code information structure object
  10273. + RETURN boolean TRUE ok
  10274. + FALSE error
  10275. + Explanation A register operand is changed into a command code.
  10276. +******************************************************************************/
  10277. +/* Summary of register_name().
  10278. + *
  10279. + * in: Input_line_pointer points to 1st char of operand.
  10280. + *
  10281. + * out: A expressionS.
  10282. + * The operand may have been a register: in this case, X_op == O_register,
  10283. + * X_add_number is set to the register number, and truth is returned.
  10284. + * Input_line_pointer->(next non-blank) char after operand, or is in
  10285. + * its original state.
  10286. + */
  10287. +static boolean
  10288. +register_name (expressionP)
  10289. + expressionS * expressionP;
  10290. +{
  10291. + int reg_number;
  10292. + char * name;
  10293. + char * start;
  10294. + char c;
  10295. + char *pNameEnd;
  10296. +
  10297. + /* Find the spelling of the operand */
  10298. + start = name = input_line_pointer;
  10299. +
  10300. + c = get_symbol_end ();
  10301. +
  10302. + /* Get register number */
  10303. + reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT,
  10304. + name, FALSE);
  10305. +
  10306. + * input_line_pointer = c; /* put back the delimiting char */
  10307. +
  10308. + /* look to see if it's in the register table */
  10309. + if (reg_number >= 0)
  10310. + {
  10311. + /* YES The right register number was acquirable. */
  10312. +
  10313. + /* That it is a register and a register number are saved. */
  10314. + expressionP->X_op = O_register;
  10315. + expressionP->X_add_number = reg_number;
  10316. +
  10317. + /* make the rest nice */
  10318. + expressionP->X_add_symbol = NULL;
  10319. + expressionP->X_op_symbol = NULL;
  10320. +
  10321. + return true;
  10322. + }
  10323. + else
  10324. + {
  10325. + /* 不正 */
  10326. + /* reset the line as if we had not done anything */
  10327. + input_line_pointer = start;
  10328. +
  10329. + return false;
  10330. + }
  10331. +}
  10332. +
  10333. +/******************************************************************************
  10334. + INPUT expressionS * The pointer to a command code information structure object
  10335. + boolean
  10336. + boolean
  10337. + RETURN boolean TRUE ok
  10338. + FALSE error
  10339. + Explanation A system register operand is changed into a command code.
  10340. +******************************************************************************/
  10341. +/* Summary of system_register_name().
  10342. + *
  10343. + * in: Input_line_pointer points to 1st char of operand.
  10344. + * expressionP points to an expression structure to be filled in.
  10345. + * accept_numbers is true iff numerical register names may be used.
  10346. + * accept_list_names is true iff the special names PS and SR may be
  10347. + * accepted.
  10348. + *
  10349. + * out: A expressionS structure in expressionP.
  10350. + * The operand may have been a register: in this case, X_op == O_register,
  10351. + * X_add_number is set to the register number, and truth is returned.
  10352. + * Input_line_pointer->(next non-blank) char after operand, or is in
  10353. + * its original state.
  10354. + */
  10355. +static boolean
  10356. +system_register_name (expressionP, accept_numbers, accept_list_names)
  10357. + expressionS * expressionP;
  10358. + boolean accept_numbers;
  10359. + boolean accept_list_names;
  10360. +{
  10361. + int reg_number;
  10362. + char * name;
  10363. + char * start;
  10364. + char c;
  10365. +
  10366. +
  10367. + /* Find the spelling of the operand */
  10368. + start = name = input_line_pointer;
  10369. +
  10370. + c = get_symbol_end ();
  10371. +
  10372. + /* get register number */
  10373. + if( g_iAdvance == 0 )
  10374. + {
  10375. + if( g_iPE == 0 )
  10376. + {
  10377. + /* STD */
  10378. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  10379. + accept_numbers);
  10380. + }
  10381. + else
  10382. + {
  10383. + /* PE */ /* add T.Tazaki 2003/11/18 */
  10384. + reg_number = reg_name_search (pe_system_registers, PE_SYSREG_NAME_CNT, name,
  10385. + accept_numbers);
  10386. + }
  10387. + }else{
  10388. + /* add tazaki 2001.11.12 */
  10389. + /* ADV */
  10390. + reg_number = reg_name_search (adv_system_registers, ADV_SYSREG_NAME_CNT, name,
  10391. + accept_numbers);
  10392. + }
  10393. +
  10394. + * input_line_pointer = c; /* put back the delimiting char */
  10395. +
  10396. +#if 0
  10397. + if (reg_number < 0 && accept_numbers)
  10398. + {
  10399. + input_line_pointer = start; /* reset input_line pointer */
  10400. +
  10401. + if (isdigit (* input_line_pointer))
  10402. + {
  10403. + reg_number = strtol (input_line_pointer, & input_line_pointer, 10);
  10404. +
  10405. + /* Make sure that the register number is allowable. */
  10406. + if ( reg_number < 0
  10407. + || reg_number > 5
  10408. + && reg_number < 16
  10409. + || reg_number > 20
  10410. + )
  10411. + {
  10412. + reg_number = -1;
  10413. + }
  10414. + }
  10415. + else if (accept_list_names)
  10416. + {
  10417. + c = get_symbol_end ();
  10418. +
  10419. +#if 0 /* c33 */
  10420. + reg_number = reg_name_search (system_list_registers,
  10421. + SYSREGLIST_NAME_CNT, name, FALSE);
  10422. +#endif
  10423. + * input_line_pointer = c; /* put back the delimiting char */
  10424. +
  10425. + }
  10426. + }
  10427. +#endif
  10428. + /* look to see if it's in the register table */
  10429. + if (reg_number >= 0)
  10430. + {
  10431. + expressionP->X_op = O_register;
  10432. + expressionP->X_add_number = reg_number;
  10433. +
  10434. + /* make the rest nice */
  10435. + expressionP->X_add_symbol = NULL;
  10436. + expressionP->X_op_symbol = NULL;
  10437. +
  10438. + return true;
  10439. + }
  10440. + else
  10441. + {
  10442. + /* reset the line as if we had not done anything */
  10443. + input_line_pointer = start;
  10444. +
  10445. + return false;
  10446. + }
  10447. +}
  10448. +
  10449. +
  10450. +CONST char * md_shortopts = "m:";
  10451. +
  10452. +struct option md_longopts[] =
  10453. +{
  10454. + {NULL, no_argument, NULL, 0}
  10455. +};
  10456. +size_t md_longopts_size = sizeof md_longopts;
  10457. +
  10458. +/******************************************************************************
  10459. + INPUT expressionS * The pointer to a command code information structure object
  10460. + boolean
  10461. + boolean
  10462. + RETURN boolean TRUE ok
  10463. + FALSE error
  10464. + Explanation A system register operand is changed into a command code.
  10465. + false : ld.w %pc,%rs
  10466. +******************************************************************************/
  10467. +static boolean
  10468. +load_system_register_name (expressionP, accept_numbers, accept_list_names)
  10469. + expressionS * expressionP;
  10470. + boolean accept_numbers;
  10471. + boolean accept_list_names;
  10472. +{
  10473. + int reg_number;
  10474. + char * name;
  10475. + char * start;
  10476. + char c;
  10477. +
  10478. +
  10479. + /* Find the spelling of the operand */
  10480. + start = name = input_line_pointer;
  10481. +
  10482. + c = get_symbol_end ();
  10483. +
  10484. + /* get register number */
  10485. + if( g_iAdvance == 0 )
  10486. + {
  10487. + if( g_iPE == 0 )
  10488. + {
  10489. + /* STD */
  10490. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  10491. + accept_numbers);
  10492. + }
  10493. + else
  10494. + {
  10495. + /* PE add T.Tazaki 2003/11/18 */
  10496. + reg_number = reg_name_search (pe_load_system_registers, PE_LOAD_SYSREG_NAME_CNT, name,
  10497. + accept_numbers);
  10498. + }
  10499. + }else{
  10500. + /* ADV */
  10501. + reg_number = reg_name_search (adv_load_system_registers, ADV_LOAD_SYSREG_NAME_CNT, name,
  10502. + accept_numbers);
  10503. + }
  10504. +
  10505. + * input_line_pointer = c; /* put back the delimiting char */
  10506. +
  10507. + /* look to see if it's in the register table */
  10508. + if (reg_number >= 0)
  10509. + {
  10510. + expressionP->X_op = O_register;
  10511. + expressionP->X_add_number = reg_number;
  10512. +
  10513. + /* make the rest nice */
  10514. + expressionP->X_add_symbol = NULL;
  10515. + expressionP->X_op_symbol = NULL;
  10516. +
  10517. + return true;
  10518. + }
  10519. + else
  10520. + {
  10521. + /* reset the line as if we had not done anything */
  10522. + input_line_pointer = start;
  10523. +
  10524. + return false;
  10525. + }
  10526. +}
  10527. +/******************************************************************************
  10528. + INPUT expressionS * The pointer to a command code information structure object
  10529. + boolean
  10530. + boolean
  10531. + RETURN boolean TRUE ok
  10532. + FALSE error
  10533. + Explanation A system register operand is changed into a command code.
  10534. + true : pushs %psr,%sp,%alr,%ahr,%lco,%lsa,%lea,%sor,%ttbr,%dp,%usp,%ssp,%pc
  10535. +******************************************************************************/
  10536. +static boolean
  10537. +pushs_system_register_name (expressionP, accept_numbers, accept_list_names)
  10538. + expressionS * expressionP;
  10539. + boolean accept_numbers;
  10540. + boolean accept_list_names;
  10541. +{
  10542. + int reg_number;
  10543. + char * name;
  10544. + char * start;
  10545. + char c;
  10546. +
  10547. +
  10548. + /* Find the spelling of the operand */
  10549. + start = name = input_line_pointer;
  10550. +
  10551. + c = get_symbol_end ();
  10552. +
  10553. + /* get register number */
  10554. + if( g_iAdvance == 0 )
  10555. + {
  10556. + if( g_iPE == 0 )
  10557. + {
  10558. + /* STD */
  10559. + reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name,
  10560. + accept_numbers);
  10561. + }
  10562. + else
  10563. + {
  10564. + /* PE add T.Tazaki 2003/11/18 */
  10565. + reg_number = reg_name_search (pe_pushs_system_registers, PE_PUSHS_SYSREG_NAME_CNT, name,
  10566. + accept_numbers);
  10567. + }
  10568. + }else{
  10569. + /* ADV */
  10570. + reg_number = reg_name_search (adv_pushs_system_registers, ADV_PUSHS_SYSREG_NAME_CNT, name,
  10571. + accept_numbers);
  10572. + }
  10573. +
  10574. + * input_line_pointer = c; /* put back the delimiting char */
  10575. +
  10576. + /* look to see if it's in the register table */
  10577. + if (reg_number >= 0)
  10578. + {
  10579. + expressionP->X_op = O_register;
  10580. + expressionP->X_add_number = reg_number;
  10581. +
  10582. + /* make the rest nice */
  10583. + expressionP->X_add_symbol = NULL;
  10584. + expressionP->X_op_symbol = NULL;
  10585. +
  10586. + return true;
  10587. + }
  10588. + else
  10589. + {
  10590. + /* reset the line as if we had not done anything */
  10591. + input_line_pointer = start;
  10592. +
  10593. + return false;
  10594. + }
  10595. +}
  10596. +
  10597. +/******************************************************************************
  10598. + INPUT FILE* not used
  10599. + RETURN void
  10600. + Explanation display option
  10601. +******************************************************************************/
  10602. +void
  10603. +md_show_usage (stream)
  10604. + FILE * stream;
  10605. +{
  10606. + /* The special option for c33 is nothing. */
  10607. +}
  10608. +
  10609. +/******************************************************************************
  10610. + INPUT int not used
  10611. + char* not used
  10612. + RETURN int TRUE ok
  10613. + Explanation Argument (option) analysis
  10614. +******************************************************************************/
  10615. +int
  10616. +md_parse_option (c, arg)
  10617. + int c;
  10618. + char * arg;
  10619. +{
  10620. +#if 0
  10621. + int Num;
  10622. + int i;
  10623. + if (c != 'm')
  10624. + {
  10625. + /* xgettext:c-format */
  10626. + fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg);
  10627. + return 0;
  10628. + }
  10629. +
  10630. +#endif
  10631. + return 1;
  10632. +}
  10633. +
  10634. +/******************************************************************************
  10635. + INPUT char* not used
  10636. + RETURN symbolS* NULL
  10637. + Explanation Treatment of the symbol which is not defined
  10638. +******************************************************************************/
  10639. +symbolS *
  10640. +md_undefined_symbol (name)
  10641. + char * name;
  10642. +{
  10643. + return 0;
  10644. +}
  10645. +
  10646. +char *
  10647. +md_atof (type, litp, sizep)
  10648. + int type;
  10649. + char * litp;
  10650. + int * sizep;
  10651. +{
  10652. + int prec;
  10653. + LITTLENUM_TYPE words[4];
  10654. + char * t;
  10655. + int i;
  10656. +
  10657. + switch (type)
  10658. + {
  10659. + case 'f':
  10660. + prec = 2;
  10661. + break;
  10662. +
  10663. + case 'd':
  10664. + prec = 4;
  10665. + break;
  10666. +
  10667. + default:
  10668. + *sizep = 0;
  10669. + return _("bad call to md_atof");
  10670. + }
  10671. +
  10672. + t = atof_ieee (input_line_pointer, type, words);
  10673. + if (t)
  10674. + input_line_pointer = t;
  10675. +
  10676. + *sizep = prec * 2;
  10677. +
  10678. + for (i = prec - 1; i >= 0; i--)
  10679. + {
  10680. + md_number_to_chars (litp, (valueT) words[i], 2);
  10681. + litp += 2;
  10682. + }
  10683. +
  10684. + return NULL;
  10685. +}
  10686. +
  10687. +
  10688. +/* Very gross. */
  10689. +void
  10690. +md_convert_frag (abfd, sec, fragP)
  10691. + bfd * abfd;
  10692. + asection * sec;
  10693. + fragS * fragP;
  10694. +{
  10695. + subseg_change (sec, 0);
  10696. +
  10697. + /* In range conditional or unconditional branch. */
  10698. + if (fragP->fr_subtype == 0 || fragP->fr_subtype == 2)
  10699. + {
  10700. + fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol,
  10701. + fragP->fr_offset, 1, BFD_RELOC_UNUSED + (int)fragP->fr_opcode);
  10702. + fragP->fr_var = 0;
  10703. + fragP->fr_fix += 2;
  10704. + }
  10705. + /* Out of range conditional branch. Emit a branch around a jump. */
  10706. + else if (fragP->fr_subtype == 1)
  10707. + {
  10708. + unsigned char *buffer =
  10709. + (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
  10710. +
  10711. + /* Reverse the condition of the first branch. */
  10712. + buffer[0] ^= 0x08;
  10713. + /* Mask off all the displacement bits. */
  10714. + buffer[0] &= 0x8f;
  10715. + buffer[1] &= 0x07;
  10716. + /* Now set the displacement bits so that we branch
  10717. + around the unconditional branch. */
  10718. + buffer[0] |= 0x30;
  10719. +
  10720. + /* Now create the unconditional branch + fixup to the final
  10721. + target. */
  10722. + md_number_to_chars (buffer + 2, 0x00000780, 4);
  10723. + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol,
  10724. + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
  10725. + (int) fragP->fr_opcode + 1);
  10726. + fragP->fr_var = 0;
  10727. + fragP->fr_fix += 6;
  10728. + }
  10729. + /* Out of range unconditional branch. Emit a jump. */
  10730. + else if (fragP->fr_subtype == 3)
  10731. + {
  10732. + md_number_to_chars (fragP->fr_fix + fragP->fr_literal, 0x00000780, 4);
  10733. + fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol,
  10734. + fragP->fr_offset, 1, BFD_RELOC_UNUSED +
  10735. + (int) fragP->fr_opcode + 1);
  10736. + fragP->fr_var = 0;
  10737. + fragP->fr_fix += 4;
  10738. + }
  10739. + else
  10740. + abort ();
  10741. +}
  10742. +
  10743. +valueT
  10744. +md_section_align (seg, addr)
  10745. + asection * seg;
  10746. + valueT addr;
  10747. +{
  10748. + int align = bfd_get_section_alignment (stdoutput, seg);
  10749. + return ((addr + (1 << align) - 1) & (-1 << align));
  10750. +}
  10751. +
  10752. +/******************************************************************************
  10753. + INPUT NONE
  10754. + RETURN void
  10755. + Explanation An assembler initial cofiguration peculiar to a model
  10756. +******************************************************************************/
  10757. +void
  10758. +md_begin ()
  10759. +{
  10760. + char * prev_name = "";
  10761. + register const struct c33_opcode * op;
  10762. + flagword applicable;
  10763. +
  10764. + /* Create hash table */
  10765. + c33_hash = hash_new();
  10766. +
  10767. + /* Insert unique names into hash table. The C33 instruction set
  10768. + has many identical opcode names that have different opcodes based
  10769. + on the operands. This hash table then provides a quick index to
  10770. + the first opcode with a particular name in the opcode table. */
  10771. +
  10772. + /* nemonic registered into the operation code table is registered into a hash table.*/
  10773. +
  10774. + /* >>>>>> tazaki 2001.11.07 */
  10775. + if( g_iAdvance == 0 ) /* cpu = standard ? */
  10776. + {
  10777. + if( g_iPE == 0 )
  10778. + {
  10779. + if( g_iMedda32 == 0 )
  10780. + {
  10781. + op = c33_opcodes; /* STANDARD table */
  10782. + }
  10783. + else
  10784. + {
  10785. + op = c33_opcodes32; /* STANDARD table : No use default data area add T.Tazaki 2004/07/30 */
  10786. + }
  10787. + }
  10788. + else
  10789. + {
  10790. + if( g_iMedda32 == 0 )
  10791. + {
  10792. + op = c33_pe_opcodes; /* PE table add T.Tazaki 2003/11/18 */
  10793. + }
  10794. + else
  10795. + {
  10796. + op = c33_pe_opcodes32; /* PE table : No use default data area add T.Tazaki 2004/07/30 */
  10797. + }
  10798. + }
  10799. + }
  10800. + else
  10801. + {
  10802. + if( g_iMedda32 == 0 )
  10803. + {
  10804. + op = c33_advance_opcodes; /* ADVANCE table */
  10805. + }
  10806. + else
  10807. + {
  10808. + op = c33_advance_opcodes32; /* ADVANCE table : No use default data area add T.Tazaki 2004/07/30 */
  10809. + }
  10810. + }
  10811. + /* <<<<<< tazaki 2001.11.07 */
  10812. +
  10813. + while (op->name)
  10814. + {
  10815. + if (strcmp (prev_name, op->name))
  10816. + {
  10817. + prev_name = (char *) op->name;
  10818. + hash_insert (c33_hash, op->name, (char *) op);
  10819. + }
  10820. + op++;
  10821. + }
  10822. +#if 0 /* c33 */
  10823. + bfd_set_arch_mach (stdoutput, TARGET_ARCH, machine);
  10824. +#endif /* c33 */
  10825. +
  10826. + applicable = bfd_applicable_section_flags (stdoutput);
  10827. +}
  10828. +
  10829. +/******************************************************************************
  10830. + INPUT int NONE
  10831. + RETURN bfd_reloc_code_real_type
  10832. + Explanation analysys symbol mask
  10833. +******************************************************************************/
  10834. +/* Warning: The code in this function relies upon the definitions
  10835. + in the c33_operands[] array (defined in opcodes/c33-opc.c)
  10836. + matching the hard coded values contained herein. */
  10837. +
  10838. +static bfd_reloc_code_real_type
  10839. +c33_reloc_prefix ()
  10840. +{
  10841. +
  10842. + /* Is it the prefix of a symbol mask? */
  10843. + if (*input_line_pointer == '@'){
  10844. + input_line_pointer++;
  10845. + }else{
  10846. +
  10847. + /* NO */
  10848. + return BFD_RELOC_UNUSED;
  10849. + }
  10850. +#define CHECK_(name, reloc) \
  10851. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  10852. + { \
  10853. + input_line_pointer += strlen (name); \
  10854. + return reloc; \
  10855. + }
  10856. +
  10857. + CHECK_ ("ah", BFD_RELOC_C33_AH); /* LABEL(25:13) */
  10858. + CHECK_ ("al", BFD_RELOC_C33_AL); /* LABEL(12:0) */
  10859. + CHECK_ ("rh", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
  10860. + CHECK_ ("rm", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
  10861. + CHECK_ ("rl", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
  10862. + CHECK_ ("h", BFD_RELOC_C33_H); /* LABEL(31:19) */
  10863. + CHECK_ ("m", BFD_RELOC_C33_M); /* LABEL(18:6) */
  10864. + CHECK_ ("l", BFD_RELOC_C33_L); /* LABEL(5:0) */
  10865. +
  10866. + CHECK_ ("AH", BFD_RELOC_C33_AH); /* LABEL(25:13) */
  10867. + CHECK_ ("AL", BFD_RELOC_C33_AL); /* LABEL(12:0) */
  10868. + CHECK_ ("RH", BFD_RELOC_C33_RH); /* <LABEL-PC>(32:22) */
  10869. + CHECK_ ("RM", BFD_RELOC_C33_RM); /* <LABEL-PC>(21:9) */
  10870. + CHECK_ ("RL", BFD_RELOC_C33_RL); /* <LABEL-PC>(8:0) */
  10871. + CHECK_ ("H", BFD_RELOC_C33_H); /* LABEL(31:19) */
  10872. + CHECK_ ("M", BFD_RELOC_C33_M); /* LABEL(18:6) */
  10873. + CHECK_ ("L", BFD_RELOC_C33_L); /* LABEL(5:0) */
  10874. +
  10875. + return BFD_RELOC_UNUSED;
  10876. +}
  10877. +
  10878. +/* add tazaki 2001.12.03 >>>>> */
  10879. +
  10880. +/* Warning: The code in this function relies upon the definitions
  10881. + in the c33_operands[] array (defined in opcodes/c33-opc.c)
  10882. + matching the hard coded values contained herein. */
  10883. +
  10884. +/******************************************************************************
  10885. + INPUT int NONE
  10886. + RETURN bfd_reloc_code_real_type
  10887. + Explanation analisys symbol offset
  10888. +******************************************************************************/
  10889. +static bfd_reloc_code_real_type
  10890. +c33_reloc_prefix_offset ()
  10891. +{
  10892. + boolean paren_skipped = false;
  10893. +
  10894. +
  10895. +
  10896. +/* Modify name## --> name : for gcc-3.3.6 T.Tazaki 2005/08/04 */
  10897. +#define CHECK2_(name, reloc) \
  10898. + if (strncmp (input_line_pointer, name"(", strlen (name) + 1 ) == 0) \
  10899. + { \
  10900. + input_line_pointer += strlen (name); \
  10901. + return reloc; \
  10902. + }
  10903. +
  10904. + CHECK2_ ("doff_hi", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
  10905. + CHECK2_ ("doff_lo", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
  10906. + CHECK2_ ("goff_lo", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
  10907. + CHECK2_ ("soff_hi", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
  10908. + CHECK2_ ("soff_lo", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
  10909. + CHECK2_ ("toff_hi", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
  10910. + CHECK2_ ("toff_lo", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
  10911. + CHECK2_ ("zoff_hi", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
  10912. + CHECK2_ ("zoff_lo", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
  10913. + CHECK2_ ("dpoff_h", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
  10914. + CHECK2_ ("dpoff_m", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
  10915. + CHECK2_ ("dpoff_l", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
  10916. +
  10917. + CHECK2_ ("DOFF_HI", BFD_RELOC_C33_DH); /* (symbol - default data pointer) */
  10918. + CHECK2_ ("DOFF_LO", BFD_RELOC_C33_DL); /* (symbol - default data pointer) */
  10919. + CHECK2_ ("GOFF_LO", BFD_RELOC_C33_GL); /* (symbol - g data pointer) */
  10920. + CHECK2_ ("SOFF_HI", BFD_RELOC_C33_SH); /* (symbol - s data pointer) */
  10921. + CHECK2_ ("SOFF_LO", BFD_RELOC_C33_SL); /* (symbol - s data pointer) */
  10922. + CHECK2_ ("TOFF_HI", BFD_RELOC_C33_TH); /* (symbol - t data pointer) */
  10923. + CHECK2_ ("TOFF_LO", BFD_RELOC_C33_TL); /* (symbol - t data pointer) */
  10924. + CHECK2_ ("ZOFF_HI", BFD_RELOC_C33_ZH); /* (symbol - z data pointer) */
  10925. + CHECK2_ ("ZOFF_LO", BFD_RELOC_C33_ZL); /* (symbol - z data pointer) */
  10926. + CHECK2_ ("DPOFF_H", BFD_RELOC_C33_DPH); /* (symbol - default data pointer) */
  10927. + CHECK2_ ("DPOFF_M", BFD_RELOC_C33_DPM); /* (symbol - default data pointer) */
  10928. + CHECK2_ ("DPOFF_L", BFD_RELOC_C33_DPL); /* (symbol - default data pointer) */
  10929. +
  10930. + return BFD_RELOC_UNUSED;
  10931. +
  10932. +}
  10933. +
  10934. +/* add tazaki 2002.02.29 >>>>> */
  10935. +/******************************************************************************
  10936. + INPUT NONE
  10937. + RETURN operand code
  10938. + advanced macro "EXT COND" instruction operand analysis
  10939. +******************************************************************************/
  10940. +static int
  10941. +c33_condition ()
  10942. +{
  10943. + boolean paren_skipped = false;
  10944. +
  10945. +
  10946. +#define CHECK3_(name, cond) \
  10947. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  10948. + { \
  10949. + input_line_pointer += strlen (name); \
  10950. + return cond; \
  10951. + }
  10952. +
  10953. + CHECK3_ ("gt", 0x04);
  10954. + CHECK3_ ("ge", 0x05);
  10955. + CHECK3_ ("lt", 0x06);
  10956. + CHECK3_ ("le", 0x07);
  10957. + CHECK3_ ("ugt", 0x08);
  10958. + CHECK3_ ("uge", 0x09);
  10959. + CHECK3_ ("ult", 0x0a);
  10960. + CHECK3_ ("ule", 0x0b);
  10961. + CHECK3_ ("eq", 0x0c);
  10962. + CHECK3_ ("ne", 0x0d);
  10963. +
  10964. + return 0;
  10965. +
  10966. +}
  10967. +/* add tazaki 2002.02.29 >>>>> */
  10968. +/******************************************************************************
  10969. + INPUT NONE
  10970. + RETURN operand code
  10971. + advanced macro "EXT OP,imm2" or "EXT %RB,OP,imm2" instruction operand analysis
  10972. +******************************************************************************/
  10973. +static int
  10974. +c33_op_shift ()
  10975. +{
  10976. + boolean paren_skipped = false;
  10977. +
  10978. +
  10979. +#define CHECK4_(name, op_shift_code) \
  10980. + if (strncmp (input_line_pointer, name, strlen (name) ) == 0) \
  10981. + { \
  10982. + input_line_pointer += strlen (name); \
  10983. + return op_shift_code; \
  10984. + }
  10985. +
  10986. + CHECK4_ ("sra", 0x01);
  10987. + CHECK4_ ("srl", 0x02);
  10988. + CHECK4_ ("sll", 0x03);
  10989. +
  10990. + return 0;
  10991. +
  10992. +}
  10993. +
  10994. +/******************************************************************************
  10995. + INPUT unsigned long
  10996. + const struct c33_operand* operand
  10997. + offsetT
  10998. + char*
  10999. + unsigned int
  11000. + char*
  11001. + int
  11002. + RETURN unsigned long
  11003. + Explanation An operand and an operation code are made into a command code.
  11004. +******************************************************************************/
  11005. + unsigned long ulrd; /* add T.Tazaki 2004/07/23 */
  11006. +
  11007. +/* Insert an operand value into an instruction. */
  11008. +static unsigned long
  11009. +c33_insert_operand (insn, operand, val, file, line, str,flags)
  11010. + unsigned long insn;
  11011. + const struct c33_operand * operand;
  11012. + offsetT val;
  11013. + char * file;
  11014. + unsigned int line;
  11015. + char * str;
  11016. + int flags;
  11017. +{
  11018. +
  11019. + long min, max, lval;
  11020. + unsigned long ulValue, ulMask;
  11021. + int iSign;
  11022. +
  11023. + /* Does a function exist? */
  11024. + if (operand->insert)
  11025. + {
  11026. + /* YES */
  11027. +
  11028. + const char * message = NULL;
  11029. +
  11030. + insn = operand->insert (insn, val, & message);
  11031. + if (message != NULL)
  11032. + {
  11033. + if (str)
  11034. + {
  11035. + if (file == (char *) NULL)
  11036. + as_warn ("%s: %s", str, message);
  11037. + else
  11038. + as_warn_where (file, line, "%s: %s", str, message);
  11039. + }
  11040. + else
  11041. + {
  11042. + if (file == (char *) NULL)
  11043. + as_warn (message);
  11044. + else
  11045. + as_warn_where (file, line, message);
  11046. + }
  11047. + }
  11048. + }
  11049. + else
  11050. + {
  11051. + /* NO */
  11052. +
  11053. +// long min, max, lval;
  11054. +// unsigned long ulValue, ulMask;
  11055. +// int iSign;
  11056. +
  11057. + lval = val; /* T.Tazaki 2002.02.27 */
  11058. +
  11059. + if( operand->range < 32 ){
  11060. +
  11061. + /* Restore min and mix to expected values for decimal ranges. */
  11062. +
  11063. + if (flags & C33_OPERAND_SIGNED){
  11064. +
  11065. + ulValue = val;
  11066. +
  11067. + ulMask = 0xffffffff >> ( operand->range - 1 );
  11068. + ulMask <<= ( operand->range - 1 );
  11069. + if(( ulValue & ulMask ) == ulMask ){
  11070. + iSign = 1; /* (-) */ /* "jp 0xffffff81" */
  11071. + }else{
  11072. + if( ( ulValue & ulMask ) == (1 << ( operand->range - 1 )) ){ /* only sign bit = 1 ? */
  11073. + iSign = 1; /* (-) */ /* "jp 0x81" */
  11074. + }else{
  11075. + if(( ulValue & ulMask ) == 0 ){ /* sign bit = 0 ? */
  11076. + iSign = 0; /* (+) */ /* "jp 0x40" */
  11077. + }else{
  11078. + iSign = 2; /* Warninng */
  11079. + }
  11080. + }
  11081. + }
  11082. +
  11083. + if( iSign == 2 ){ /* Invalid range ? "jp 0x102" */
  11084. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  11085. + char buf[100];
  11086. +
  11087. + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
  11088. + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
  11089. + if (str)
  11090. + {
  11091. + sprintf (buf, "%s: ", str);
  11092. +
  11093. + sprint_value (buf + strlen (buf), val);
  11094. + }
  11095. + else
  11096. + sprint_value (buf, lval);
  11097. +
  11098. + if (file == (char *) NULL)
  11099. + as_warn (err, buf, min, max);
  11100. + else
  11101. + as_warn_where (file, line, err, buf, min, max);
  11102. + }
  11103. + else
  11104. + {
  11105. + if( iSign == 0 ){ /* (+) ? */
  11106. + lval = val;
  11107. + }else{
  11108. + if( iSign == 1 ){ /* (-) ? */
  11109. + lval = ulValue | ulMask; /* sign extend */
  11110. + }
  11111. + }
  11112. +
  11113. + /* max = (1 << ( operand->bits - 1 )) - 1;
  11114. + min = - (1 << (operand->bits - 1)); */
  11115. + max = (1 << ( operand->range - 1 )) - 1; /* T.Tazaki 2002.02.27 */
  11116. + min = - (1 << (operand->range - 1)); /* T.Tazaki 2002.02.27 */
  11117. +
  11118. + if (lval < min || lval > max)
  11119. + {
  11120. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  11121. + char buf[100];
  11122. +
  11123. + if (str)
  11124. + {
  11125. + sprintf (buf, "%s: ", str);
  11126. +
  11127. + sprint_value (buf + strlen (buf), lval);
  11128. + }
  11129. + else
  11130. + sprint_value (buf, lval);
  11131. +
  11132. + if (file == (char *) NULL)
  11133. + as_warn (err, buf, min, max);
  11134. + else
  11135. + as_warn_where (file, line, err, buf, min, max);
  11136. + }
  11137. + }
  11138. + }
  11139. + else {
  11140. + /* It asks for the range of effective value. */
  11141. + max = (1 << operand->bits) - 1;
  11142. + min = 0;
  11143. +
  11144. + /* Value is range outside. */
  11145. + if (lval < (offsetT) min || lval > (offsetT) max)
  11146. + {
  11147. + /* xgettext:c-format */
  11148. + const char * err = _("operand out of range (%s not between %ld and %ld)");
  11149. + char buf[100];
  11150. +
  11151. + if (str)
  11152. + {
  11153. + sprintf (buf, "%s: ", str);
  11154. +
  11155. + sprint_value (buf + strlen (buf), lval);
  11156. + }
  11157. + else
  11158. + sprint_value (buf, lval);
  11159. +
  11160. + if (file == (char *) NULL)
  11161. + as_warn (err, buf, min, max);
  11162. + else
  11163. + as_warn_where (file, line, err, buf, min, max);
  11164. + }
  11165. + }
  11166. + }
  11167. +
  11168. + /* An operand and an operation code are made into a command code. */
  11169. +// insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
  11170. + insn |= (((long) lval & ((1 << operand->bits) - 1)) << operand->shift); /* T.Tazaki 2002.02.27 */
  11171. +/* >>>> add tazaki advanced macro */
  11172. + if (flags & C33_OPERAND_01) {
  11173. + insn |= 0x0010; /* bit 5,4 = 0,1 set */
  11174. + }
  11175. + if (flags & C33_OPERAND_OP3_01) {
  11176. + insn |= 0x0040; /* bit 7,6 = 0,1 set : psrset imm5 */
  11177. + }
  11178. + if (flags & C33_OPERAND_OP3_10){
  11179. + insn |= 0x0080; /* bit 7,6 = 1,0 set : psrclr imm5 */
  11180. + }
  11181. +/* <<<< add tazaki advanced macro */
  11182. + }
  11183. + return insn;
  11184. +}
  11185. +
  11186. +
  11187. +static char copy_of_instruction [128];
  11188. +
  11189. +void
  11190. +md_assemble (str)
  11191. + char * str;
  11192. +{
  11193. + char * s;
  11194. + char * start_of_operands;
  11195. + struct c33_opcode * opcode;
  11196. + struct c33_opcode * opcode2; /* add tazaki 2001.08.10 */
  11197. + struct c33_opcode * next_opcode;
  11198. + const unsigned char * opindex_ptr;
  11199. + int next_opindex;
  11200. + int relaxable;
  11201. + unsigned short insn;
  11202. + unsigned short insn_wk; /* add tazaki 2001.12.11 */
  11203. + unsigned short copy_insn;
  11204. + char * f; /* insn address */
  11205. + char * where; /* insn address */
  11206. + int i;
  11207. + int match;
  11208. + boolean extra_data_befor_insn = false;
  11209. + unsigned int extra_data_len;
  11210. + unsigned short extraInsnBuf[10];
  11211. + char * saved_input_line_pointer;
  11212. + char * check_input_line_pointer;
  11213. + char * temp_input_line_pointer;
  11214. + unsigned short * fromP;
  11215. + int iNumber;
  11216. + unsigned int uiNumber; /* add tazaki 2002.03.11 */
  11217. +
  11218. + int i_ext_off; /* add tazaki 2001.08.07 */
  11219. + int iMEM_IMM26_flag; /* add tazaki 2001.10.11 */
  11220. + char * pSymbolName ; /* for [imm26] add tazaki 2001.11.28 */
  11221. + char szSymbolName[300]; /* for [imm26] add tazaki 2001.11.28 */
  11222. + char * temp_pointer; /* for [imm26] add tazaki 2001.11.28 */
  11223. +
  11224. + int g_iBitTest = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
  11225. + int g_iBitTest_range = 0; /* for Bit Test命令のオペランド imm3 用 add T.Tazaki 2004/07/30 */
  11226. + int g_iXload = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
  11227. + int g_iXload_range = 0; /* for xld.x [symbol+imm],%rs命令のオペランド %rs 用 add T.Tazaki 2004/07/30 */
  11228. +
  11229. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  11230. + int i_ext_cnt = -1; // numbers of ext to add (default when -1)
  11231. +
  11232. + // indices for extraInsnBuf
  11233. + unsigned int insn_idx_high = 0; // for ext @h
  11234. + unsigned int insn_idx_mid = 0; // for ext @m
  11235. + unsigned int insn_idx_low = 0; // for ld @l (always present)
  11236. + unsigned int insn_idx_load = 0; // for ld.* (always present)
  11237. + unsigned int insn_idx_pop = 0; // for mem write
  11238. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  11239. +
  11240. +
  11241. +// ADD D.Fujimoto 2007/06/21 >>>>>>>
  11242. +#ifdef EXT_REMOVE
  11243. + if( g_c33_ext == 1 ){
  11244. + // get the offset from the nearest symbol
  11245. + evaluate_offset_from_symbol();
  11246. + }
  11247. +#endif
  11248. +// ADD D.Fujimoto 2007/06/21 <<<<<<<
  11249. +
  11250. + pSymbolName = &szSymbolName[0]; /* Symbol name pointer domain initialization for [imm26] add tazaki 2001.11.28*/
  11251. +
  11252. + /* The command character sequence for one line is copied. */
  11253. + strncpy (copy_of_instruction, str, sizeof (copy_of_instruction) - 1);
  11254. +
  11255. + /* It is made a character sequence as an operation code. */
  11256. + /* Get the opcode. */
  11257. + for (s = str; *s != '\0' && ! isspace (*s); s++)
  11258. + continue;
  11259. +
  11260. + if (*s != '\0')
  11261. + *s++ = '\0';
  11262. +
  11263. + /* find the first opcode with the proper name */
  11264. + opcode = (struct c33_opcode *) hash_find (c33_hash, str);
  11265. +
  11266. + /* not find operation code? */
  11267. + if (opcode == NULL) {
  11268. + /* xgettext:c-format */
  11269. + as_bad (_("Unrecognized opcode: `%s'"), str);
  11270. + ignore_rest_of_line ();
  11271. + return;
  11272. + }
  11273. +
  11274. + /* The space from an operation code to an operand is skipped. */
  11275. + str = s;
  11276. + while (isspace (* str))
  11277. + ++ str;
  11278. +
  11279. + /* The start position of an operand is held. */
  11280. + start_of_operands = str;
  11281. +
  11282. + saved_input_line_pointer = input_line_pointer;
  11283. +
  11284. + /* An interpretation of an operand */
  11285. + for (;;) {
  11286. + const char * errmsg = NULL;
  11287. +
  11288. + match = 0;
  11289. +
  11290. + relaxable = 0;
  11291. + fc = 0;
  11292. + next_opindex = 0;
  11293. + insn = opcode->opcode;
  11294. + extra_data_befor_insn = false;
  11295. +
  11296. + iMEM_IMM26_flag = 0; /* add tazaki 2001.10.11 */
  11297. +
  11298. + /* The start position of an operand is held. */
  11299. + input_line_pointer = str = start_of_operands;
  11300. +
  11301. + /* Only the number of operands is repeated. */
  11302. + for (opindex_ptr = opcode->operands; *opindex_ptr != 0; opindex_ptr ++)
  11303. + {
  11304. + const struct c33_operand * operand;
  11305. + char * hold;
  11306. + expressionS ex;
  11307. + expressionS ext_ex;
  11308. + bfd_reloc_code_real_type reloc;
  11309. +
  11310. + int flags;
  11311. +
  11312. + if (next_opindex == 0)
  11313. + {
  11314. + /* An operand is acquired. */
  11315. + operand = & c33_operands[ * opindex_ptr ];
  11316. + }
  11317. + else
  11318. + {
  11319. + operand = & c33_operands[ next_opindex ];
  11320. + next_opindex = 0;
  11321. + }
  11322. +
  11323. + flags = operand->flags;
  11324. + errmsg = NULL;
  11325. +
  11326. + while (*str == ' ' || *str == ',' || *str == ']')
  11327. + ++ str;
  11328. +
  11329. + /* Gather the operand. */
  11330. + hold = input_line_pointer;
  11331. + input_line_pointer = str;
  11332. +
  11333. + errmsg = NULL;
  11334. +
  11335. + /* tazaki 2002.01.11 >>>>>> */
  11336. + i_ext_off = 0;
  11337. + opcode2 = (struct c33_opcode *)c33_ext_opcodes;
  11338. + if( opcode->opcode == opcode2->opcode ){
  11339. + /* ext xoff_hi(sym),ext xoff_lo(sym),ext dpoff_h,m(sym) : analisys symbol offset */
  11340. + reloc = c33_reloc_prefix_offset ();
  11341. + if( reloc != BFD_RELOC_UNUSED ){
  11342. + i_ext_off = 1;
  11343. + }
  11344. + }
  11345. + if( i_ext_off == 1 )
  11346. + {
  11347. + /* ext 命令 and xoff_hi(sym),ext xoff_lo(sym),dpoff_h,m(sym) ? */
  11348. +
  11349. + /* read symbol , disp */
  11350. +
  11351. + expression (& ex);
  11352. +
  11353. + if (fc >= MAX_INSN_FIXUPS)
  11354. + as_fatal (_("too many fixups"));
  11355. +
  11356. + fixups[ fc ].exp = ex;
  11357. + fixups[ fc ].opindex = * opcode->operands;
  11358. + fixups[ fc ].reloc = reloc;
  11359. + ++fc;
  11360. +
  11361. + }
  11362. + else
  11363. + {
  11364. + /* >>>> add tazaki 2002.02.29 class1 : ext cond*/
  11365. + if ((operand->flags & C33_OPERAND_COND) == C33_OPERAND_COND)
  11366. + {
  11367. + int iCond = c33_condition(); /* get operand code */
  11368. + if( iCond != 0 ){
  11369. +
  11370. + ex.X_op = O_cond;
  11371. + ex.X_add_number = iCond;
  11372. +
  11373. + }else{
  11374. + errmsg = _("invalid operand");
  11375. + }
  11376. + }
  11377. + /* >>>> add tazaki 2002.02.29 class1 : ext OP,imm2 | ext %rb,OP,imm2 */
  11378. + else if ((operand->flags & C33_OPERAND_OP_SHIFT) == C33_OPERAND_OP_SHIFT)
  11379. + {
  11380. + int iShiftCode = c33_op_shift(); /* get operand code */
  11381. + if( iShiftCode != 0 ){
  11382. +
  11383. + ex.X_op = O_op_shift;
  11384. + ex.X_add_number = iShiftCode;
  11385. +
  11386. + }else{
  11387. + errmsg = _("invalid operand");
  11388. + }
  11389. + }
  11390. + /* >>>> add tazaki 2001.09.18 class7 : [%dp+imm6]*/
  11391. + else if ((operand->flags & C33_OPERAND_DPMEM) == C33_OPERAND_DPMEM)
  11392. + {
  11393. + if (*str == '['){
  11394. + str++;
  11395. + while (isspace (*str))
  11396. + ++str;
  11397. +
  11398. + input_line_pointer = str;
  11399. +
  11400. + /* %dp ? */
  11401. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  11402. + {
  11403. + /* YES */
  11404. + errmsg = _("invalid system register name");
  11405. + }
  11406. + else {
  11407. + str+=3;
  11408. + while (isspace (*str))
  11409. + ++str;
  11410. +
  11411. + /* IF ']' */
  11412. + if (*str == ']'){
  11413. + /* YES only register */
  11414. + /* Support only"[%dp]" */
  11415. + ex.X_op = O_constant;
  11416. + ex.X_add_symbol = NULL;
  11417. + ex.X_op_symbol = NULL;
  11418. + ex.X_add_number = 0;
  11419. + str++;
  11420. + input_line_pointer = str;
  11421. + }
  11422. + else if (*str == '+'){
  11423. + str++;
  11424. + input_line_pointer = str;
  11425. +
  11426. + reloc = c33_reloc_prefix_offset();
  11427. + if( reloc != BFD_RELOC_UNUSED ){ /* dpoff_l() ? */
  11428. + errmsg = _("invalid operand");
  11429. + }
  11430. + else
  11431. + {
  11432. + /* An operand is developed at a formula. */
  11433. + expression (& ex);
  11434. +
  11435. + iNumber = ex.X_add_number;
  11436. +
  11437. + if (operand->range <= 6){
  11438. + /* EMPTY */
  11439. + }
  11440. + else if (operand->range == 32) {
  11441. + /* update tazaki 2002.03.08 >>> */
  11442. + if (opcode->specialFlag == 1){
  11443. + /* ld.b */
  11444. + if ((unsigned int)iNumber <= 0x3f){
  11445. + ex.X_add_number /= 1;
  11446. +
  11447. + }else if ((unsigned int)iNumber <= 0x7ffff){
  11448. + /* 1 ext */
  11449. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11450. + extra_data_befor_insn = true;
  11451. + extra_data_len = 1;
  11452. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11453. + ex.X_add_number = iNumber & 0x3f;
  11454. + }
  11455. + else {
  11456. + /* 2 ext */
  11457. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11458. + extra_data_befor_insn = true;
  11459. + extra_data_len = 2;
  11460. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  11461. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  11462. + ex.X_add_number = iNumber & 0x3f;
  11463. + }
  11464. + }
  11465. + else if (opcode->specialFlag == 2){
  11466. + /* ld.h */
  11467. + if ((unsigned int)iNumber <= 0x7f){
  11468. + ex.X_add_number /= 2;
  11469. +
  11470. + }else if ((unsigned int)iNumber <= 0x7ffff){
  11471. + /* 1 ext */
  11472. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11473. + extra_data_befor_insn = true;
  11474. + extra_data_len = 1;
  11475. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11476. + ex.X_add_number = iNumber & 0x3f;
  11477. + }
  11478. + else {
  11479. + /* 2 ext */
  11480. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11481. + extra_data_befor_insn = true;
  11482. + extra_data_len = 2;
  11483. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  11484. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  11485. + ex.X_add_number = iNumber & 0x3f;
  11486. + }
  11487. + }
  11488. + else if (opcode->specialFlag == 4){
  11489. + /* ld.w */
  11490. + if ((unsigned int)iNumber <= 0xff){
  11491. + ex.X_add_number /= 4;
  11492. +
  11493. + }else if ((unsigned int)iNumber <= 0x7ffff){
  11494. + /* 1 ext */
  11495. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11496. + extra_data_befor_insn = true;
  11497. + extra_data_len = 1;
  11498. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11499. + ex.X_add_number = iNumber & 0x3f;
  11500. + }
  11501. + else {
  11502. + /* 2 ext */
  11503. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11504. + extra_data_befor_insn = true;
  11505. + extra_data_len = 2;
  11506. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  11507. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  11508. + ex.X_add_number = iNumber & 0x3f;
  11509. + }
  11510. + }
  11511. + /* update tazaki 2002.03.08 <<< */
  11512. + }
  11513. + else {
  11514. + errmsg = _("constant too big to fit into instruction");
  11515. + }
  11516. + }
  11517. + }
  11518. + else{
  11519. + /* YES */
  11520. + errmsg = _("invalid operand");
  11521. + }
  11522. + }
  11523. + }
  11524. + else
  11525. + errmsg = _("invalid operand");
  11526. + }
  11527. +
  11528. + /* >>>> add tazaki 2002.01.15 class7 : [%dp+dpoff_l(symbol)]*/
  11529. + else if ((operand->flags & C33_OPERAND_DPSYMBOL6) == C33_OPERAND_DPSYMBOL6)
  11530. + {
  11531. + if (*str == '['){
  11532. + str++;
  11533. + while (isspace (*str))
  11534. + ++str;
  11535. +
  11536. + input_line_pointer = str;
  11537. +
  11538. + /* %dp ? */
  11539. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  11540. + {
  11541. + /* YES */
  11542. + errmsg = _("invalid system register name");
  11543. + }
  11544. + else {
  11545. + str+=3;
  11546. + while (isspace (*str))
  11547. + ++str;
  11548. +
  11549. + /* IF ']' */
  11550. + if (*str == ']'){
  11551. + /* YES only register */
  11552. + /* Support only"[%dp] */
  11553. + ex.X_op = O_constant;
  11554. + ex.X_add_symbol = NULL;
  11555. + ex.X_op_symbol = NULL;
  11556. + ex.X_add_number = 0;
  11557. + str++;
  11558. + input_line_pointer = str;
  11559. + }
  11560. + else
  11561. + {
  11562. + if (*str == '+'){
  11563. + /* [%dp+dpoff_l(symbol)] */
  11564. + str++;
  11565. + input_line_pointer = str;
  11566. +
  11567. + reloc = c33_reloc_prefix_offset();
  11568. + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
  11569. +
  11570. + expression (& ex);
  11571. +
  11572. + if (ex.X_op != O_symbol){ /* not symbol ? */
  11573. + errmsg = _("invalid operand");
  11574. + }
  11575. + }else{
  11576. + errmsg = _("invalid operand");
  11577. + }
  11578. + }else{
  11579. + errmsg = _("invalid operand");
  11580. + }
  11581. + }
  11582. + }
  11583. + }
  11584. + else
  11585. + errmsg = _("invalid operand");
  11586. + }
  11587. +
  11588. + /* >>>> add tazaki 2002.01.15 class7 : dpoff_l(symbol) */
  11589. + else if ((operand->flags & C33_OPERAND_DPSYMBOL6_2) == C33_OPERAND_DPSYMBOL6_2)
  11590. + {
  11591. + reloc = c33_reloc_prefix_offset();
  11592. + if( reloc == BFD_RELOC_C33_DPL ){ /* dpoff_l() ? */
  11593. +
  11594. + expression (& ex);
  11595. +
  11596. + if (ex.X_op != O_symbol){ /* not symbol ? */
  11597. + errmsg = _("invalid operand");
  11598. + }
  11599. + }else{
  11600. + errmsg = _("invalid operand");
  11601. + }
  11602. + }
  11603. + /* >>>> add tazaki 2001.12.21 class0 : %dp */
  11604. +
  11605. + else if ((operand->flags & C33_OPERAND_DP) == C33_OPERAND_DP)
  11606. + {
  11607. + /* check %dp ? */
  11608. + if ( ( strncmp(str,"%dp",3) != 0 ) && ( strncmp(str,"%DP",3) != 0 ))
  11609. + {
  11610. + /* NO */
  11611. + errmsg = _("invalid system register name");
  11612. + }else{
  11613. + str+=3;
  11614. + while (isspace (*str))
  11615. + ++str;
  11616. + input_line_pointer = str;
  11617. +
  11618. + ex.X_op = O_dpregister;
  11619. + /* In %dp, an operand is not inserted in a command code. */
  11620. + }
  11621. + /* <<<< add tazaki 2001.12.21 class0 : %dp */
  11622. + }
  11623. + else if ((operand->flags & C33_OPERAND_REG) != 0)
  11624. + {
  11625. + if (!register_name (& ex))
  11626. + {
  11627. + /* YES */
  11628. + errmsg = _("invalid register name");
  11629. + }
  11630. + }
  11631. + else if ((operand->flags & C33_OPERAND_LD_SREG) != 0) /* add 2002.06.19 error : ld.w %pc,%rs */
  11632. + {
  11633. + if (!load_system_register_name (& ex, true, false))
  11634. + {
  11635. + errmsg = _("invalid system register name");
  11636. + }
  11637. + }
  11638. + else if ((operand->flags & C33_OPERAND_PUSHS_SREG) != 0) /* add 2002.06.19 : pushs %ss ,pops %sd */
  11639. + {
  11640. + if (!pushs_system_register_name (& ex, true, false))
  11641. + {
  11642. + errmsg = _("invalid system register name");
  11643. + }
  11644. + }
  11645. + else if (((operand->flags & C33_OPERAND_SREG) != 0) ||
  11646. + ((operand->flags & C33_OPERAND_SP) != 0))
  11647. + {
  11648. + if (!system_register_name (& ex, true, false))
  11649. + {
  11650. + errmsg = _("invalid system register name");
  11651. + }
  11652. + else {
  11653. + /* NO register OK */
  11654. + if ((operand->flags & C33_OPERAND_SP) != 0)
  11655. + {
  11656. + ex.X_op = O_spregister;
  11657. + /* In %sp, an operand is not inserted in a command code. */
  11658. + }
  11659. + }
  11660. + }
  11661. + /* ELSE IF Operand is immidiate ? */
  11662. + else if ((operand->flags & C33_OPERAND_IMM) ||
  11663. + (operand->flags & C33_OPERAND_SIGNED))
  11664. + {
  11665. +
  11666. + expression (& ex);
  11667. +
  11668. + /* IF Operand is constant ?*/
  11669. + if (ex.X_op == O_constant)
  11670. + {
  11671. + if (opcode->specialFlag == 5){
  11672. +
  11673. + /* shift/lotate */
  11674. +
  11675. + iNumber = ex.X_add_number;
  11676. + if( iNumber > 8 ){
  11677. +
  11678. + errmsg = _("operand out of range (not between 0 and 8)");
  11679. + }else{
  11680. + extra_data_len = 0;
  11681. + ex.X_add_number = iNumber;
  11682. + }
  11683. + }else if (opcode->specialFlag == 6){
  11684. +
  11685. + /* 拡張命令のshift/lotate */
  11686. +
  11687. + iNumber = ex.X_add_number;
  11688. + if( iNumber > 31 ){
  11689. + errmsg = _("operand out of range (not between 0 and 31)");
  11690. + }else{
  11691. + extra_data_len = 0;
  11692. + while(iNumber > 8){
  11693. + extra_data_befor_insn = true;
  11694. + copy_insn = c33_insert_operand (insn, operand,8,
  11695. + (char *) NULL, 0,
  11696. + copy_of_instruction,flags);
  11697. + extraInsnBuf[extra_data_len] = copy_insn;
  11698. + extra_data_len++;
  11699. + ex.X_add_number = 8;
  11700. + iNumber -= 8;
  11701. + }
  11702. + ex.X_add_number = iNumber;
  11703. + }
  11704. + }else if (opcode->specialFlag == 7){
  11705. +
  11706. + /* Advanced mode "X" Extended of shift/lotate */
  11707. + iNumber = ex.X_add_number;
  11708. + if( iNumber > 31 ){
  11709. + errmsg = _("operand out of range (not between 0 and 31)");
  11710. + }else{
  11711. + if( iNumber <= 15 ){
  11712. +
  11713. + }else{
  11714. + ex.X_add_number -= 16;
  11715. +
  11716. + /* Convert Opecode */
  11717. + insn_wk = insn & 0xff00;
  11718. +
  11719. + switch( insn_wk ){
  11720. + case 0x8800: insn_wk = 0x2300; break; /* srl -->class 1 : srl */
  11721. + case 0x8c00: insn_wk = 0x2700; break; /* sll -->class 1 : sll */
  11722. + case 0x9000: insn_wk = 0x2b00; break; /* sra -->class 1 : sra */
  11723. + case 0x9400: insn_wk = 0x2f00; break; /* sla -->class 1 : sla */
  11724. + case 0x9800: insn_wk = 0x3300; break; /* rr -->class 1 : rr */
  11725. + case 0x9c00: insn_wk = 0x3700; break; /* rl -->class 1 : rl */
  11726. + default : errmsg = _("invalid operand"); break;
  11727. +
  11728. + }
  11729. + insn = insn_wk | ( insn & 0x00ff );
  11730. + }
  11731. + }
  11732. + }
  11733. + else {
  11734. + /* shift/lotate命令以外 */
  11735. +
  11736. + /* Possible to sign32 */
  11737. + iNumber = ex.X_add_number;
  11738. +
  11739. + if (operand->flags & C33_OPERAND_SIGNED){
  11740. + /* YES signed */
  11741. +
  11742. + if ((operand->range == 19) && ((-262144 <= iNumber && iNumber < -32) ||
  11743. + (31 < iNumber && iNumber <= 262143))){
  11744. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11745. + extra_data_befor_insn = true;
  11746. + extra_data_len = 1;
  11747. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11748. + ex.X_add_number = iNumber & 0x3f;
  11749. + flags = C33_OPERAND_IMM; /* sign(5:0) is not signed */
  11750. + }
  11751. + else if (operand->range == 22) {
  11752. + if (operand->flags & C33_OPERAND_PC){
  11753. + if (-256 <= iNumber && iNumber <= 254){
  11754. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
  11755. + }
  11756. + else if ((-2097152 <= iNumber && iNumber < -256) ||
  11757. + (254 < iNumber && iNumber <= 2097150)){
  11758. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11759. + extra_data_befor_insn = true;
  11760. + extra_data_len = 1;
  11761. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff); /* sign22(21:9) */
  11762. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign22(8:1) */
  11763. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  11764. + }else{
  11765. + errmsg = _("operand out of range (not between -2097152 and 2097150)");
  11766. + }
  11767. + }
  11768. + }
  11769. + else if (operand->range == 32){
  11770. + /* jp,call */
  11771. + if (operand->flags & C33_OPERAND_PC){
  11772. + if (-256 <= iNumber && iNumber <= 254){
  11773. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  11774. + }
  11775. + else if ((-2097152 <= iNumber && iNumber < -256) ||
  11776. + (254 < iNumber && iNumber <= 2097150)){
  11777. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11778. + extra_data_befor_insn = true;
  11779. + extra_data_len = 1;
  11780. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 9) & 0x1fff);
  11781. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  11782. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  11783. + }
  11784. + else {
  11785. + /* 2 ext */
  11786. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11787. + extra_data_befor_insn = true;
  11788. + extra_data_len = 2;
  11789. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1ff8);
  11790. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 9) & 0x1fff);
  11791. + ex.X_add_number = (iNumber >> 1) & 0xff; /* sign32(8:1) */
  11792. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  11793. + }
  11794. + }
  11795. + else {
  11796. + if (-32 <= iNumber && iNumber <= 31){
  11797. + /* EMPTY */
  11798. + }
  11799. + else if ((-262144 <= iNumber && iNumber < -32) ||
  11800. + (31 < iNumber && iNumber <= 262143)){
  11801. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11802. + extra_data_befor_insn = true;
  11803. + extra_data_len = 1;
  11804. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11805. + ex.X_add_number = iNumber & 0x3f;
  11806. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  11807. + }
  11808. + else {
  11809. + /* ext命令 2つ */
  11810. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11811. + extra_data_befor_insn = true;
  11812. + extra_data_len = 2;
  11813. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  11814. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  11815. + ex.X_add_number = iNumber & 0x3f;
  11816. + flags = C33_OPERAND_IMM; /* sign(5:0)is not signed */
  11817. + }
  11818. + }
  11819. + }
  11820. + }
  11821. + else {
  11822. + /* IMM */
  11823. + switch( operand->range ){
  11824. + case 19:
  11825. + if ((unsigned int)iNumber <= 0x7ffff){
  11826. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11827. + extra_data_befor_insn = true;
  11828. + extra_data_len = 1;
  11829. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11830. + ex.X_add_number = iNumber & 0x3f;
  11831. + }
  11832. + break;
  11833. + case 32:
  11834. + if ((unsigned int)iNumber <= 0x3f){
  11835. + /* EMPTY */
  11836. + }
  11837. + else if ((unsigned int)iNumber <= 0x7ffff){
  11838. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11839. + extra_data_befor_insn = true;
  11840. + extra_data_len = 1;
  11841. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  11842. + ex.X_add_number = iNumber & 0x3f;
  11843. + }
  11844. + else {
  11845. + /* 2 ext */
  11846. +
  11847. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11848. + extra_data_befor_insn = true;
  11849. + extra_data_len = 2;
  11850. +
  11851. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  11852. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  11853. + ex.X_add_number = iNumber & 0x3f;
  11854. + }
  11855. + break;
  11856. + }
  11857. + }
  11858. + }
  11859. + }
  11860. +
  11861. + /* ELSE IF Operand is LABEL & SYMBOL */
  11862. +
  11863. + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_LABEL)){
  11864. + /* YES jp/call only */
  11865. +
  11866. + if (operand->range == 13){ /* 2001.4.27 ide */
  11867. + /* YES ext */
  11868. +
  11869. + /* Get Symbol mask relocation */
  11870. + reloc = c33_reloc_prefix ();
  11871. + /* Not symbol mask ? : ERROR = ext label, OK = ext label@xx */
  11872. + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2002.03.04 */
  11873. + errmsg = _("invalid operand");
  11874. + }
  11875. + }
  11876. + else if (operand->range == 5){ /* add tazaki 2002.03.04 */
  11877. + /* YES loop */
  11878. + reloc = BFD_RELOC_C33_LOOP; /* Adv : loop operand */
  11879. + }
  11880. + else if (operand->range == 8){
  11881. + /* YES jp,call */
  11882. +
  11883. + reloc = c33_reloc_prefix (); /* add tazaki 2001.08.23 */
  11884. + /* Not symbol mask ? */
  11885. + if( reloc == BFD_RELOC_UNUSED ){ /* add tazaki 2001.08.23 */
  11886. + /* Set Symbol Mask Relocation */
  11887. + reloc = BFD_RELOC_C33_JP; /* Modify BFD_RELOC_C33_RL -->BFD_RELOC_C33_JP 2002.04.22 */
  11888. + }
  11889. + }
  11890. + /* add 2001.08.06 tazaki >>>>> */
  11891. + else if (operand->range == 22){
  11892. + /* YES scall,sjp,sjrxx */
  11893. +
  11894. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  11895. +#ifdef EXT_REMOVE
  11896. + // optimizing ext inst
  11897. + if (g_c33_ext == 1) {
  11898. + i_ext_cnt = evaluate_ext_count_for_jumps(ex, 1, count_ext_for_jumps);
  11899. + }
  11900. +
  11901. + if (i_ext_cnt == 0) {
  11902. + // no ext
  11903. + reloc = BFD_RELOC_C33_S_RL;
  11904. +
  11905. + } else {
  11906. +
  11907. + /* 1 ext */
  11908. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11909. + extra_data_befor_insn = true;
  11910. + extra_data_len = 1;
  11911. + extraInsnBuf[0] = opcode->opcode;
  11912. + if (fc >= MAX_INSN_FIXUPS)
  11913. + as_fatal (_("too many fixups"));
  11914. +
  11915. + fixups[ fc ].exp = ex;
  11916. + fixups[ fc ].opindex = * opcode->operands;
  11917. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  11918. + ++fc;
  11919. +
  11920. + reloc = BFD_RELOC_C33_S_RL;
  11921. + }
  11922. +#else
  11923. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  11924. +
  11925. + /* 1 ext */
  11926. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11927. + extra_data_befor_insn = true;
  11928. + extra_data_len = 1;
  11929. + extraInsnBuf[0] = opcode->opcode;
  11930. + if (fc >= MAX_INSN_FIXUPS)
  11931. + as_fatal (_("too many fixups"));
  11932. +
  11933. + fixups[ fc ].exp = ex;
  11934. + fixups[ fc ].opindex = * opcode->operands;
  11935. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  11936. + ++fc;
  11937. +
  11938. + reloc = BFD_RELOC_C33_S_RL;
  11939. +#endif /* EXT_REMOVE */
  11940. +
  11941. +
  11942. + }
  11943. + /* add 2001.08.06 tazaki <<<<< */
  11944. + else {
  11945. + /* xjp,xcall */
  11946. +
  11947. + /* ext label+imm32@rh */
  11948. + /* ext label+imm32@rm */
  11949. + /* call label+imm32@rl */
  11950. +
  11951. + /* strにシンボル名が入っている。2パス アセンブラのとき、これを比較する。 */
  11952. +
  11953. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  11954. +#ifdef EXT_REMOVE
  11955. + // optimizing ext inst
  11956. + if (g_c33_ext == 1) {
  11957. + i_ext_cnt = evaluate_ext_count_for_jumps(ex, 2, count_ext_for_jumps);
  11958. + }
  11959. +
  11960. + if (i_ext_cnt == 0) {
  11961. + // no ext
  11962. + reloc = BFD_RELOC_C33_S_RL;
  11963. +
  11964. + } else if (i_ext_cnt == 1) {
  11965. + // 1 ext
  11966. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11967. + extra_data_befor_insn = true;
  11968. + extra_data_len = 1;
  11969. + extraInsnBuf[0] = opcode->opcode;
  11970. +
  11971. + if (fc >= MAX_INSN_FIXUPS)
  11972. + as_fatal (_("too many fixups"));
  11973. +
  11974. + fixups[ fc ].exp = ex;
  11975. + fixups[ fc ].opindex = * opcode->operands;
  11976. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  11977. + ++fc;
  11978. +
  11979. + reloc = BFD_RELOC_C33_S_RL;
  11980. +
  11981. + } else {
  11982. +
  11983. + /* 2 ext */
  11984. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  11985. + extra_data_befor_insn = true;
  11986. + extra_data_len = 2;
  11987. + extraInsnBuf[0] = opcode->opcode;
  11988. + extraInsnBuf[1] = opcode->opcode;
  11989. +
  11990. + if (fc >= MAX_INSN_FIXUPS)
  11991. + as_fatal (_("too many fixups"));
  11992. +
  11993. + fixups[ fc ].exp = ex;
  11994. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  11995. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
  11996. + ++fc;
  11997. +
  11998. + fixups[ fc ].exp = ex;
  11999. + fixups[ fc ].opindex = * opcode->operands;
  12000. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  12001. + ++fc;
  12002. +
  12003. + reloc = BFD_RELOC_C33_S_RL;
  12004. + }
  12005. +#else
  12006. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  12007. +
  12008. + /* 2 ext */
  12009. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12010. + extra_data_befor_insn = true;
  12011. + extra_data_len = 2;
  12012. + extraInsnBuf[0] = opcode->opcode;
  12013. + extraInsnBuf[1] = opcode->opcode;
  12014. +
  12015. + if (fc >= MAX_INSN_FIXUPS)
  12016. + as_fatal (_("too many fixups"));
  12017. +
  12018. + fixups[ fc ].exp = ex;
  12019. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12020. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RH;
  12021. + ++fc;
  12022. +
  12023. + fixups[ fc ].exp = ex;
  12024. + fixups[ fc ].opindex = * opcode->operands;
  12025. + fixups[ fc ].reloc = BFD_RELOC_C33_S_RM;
  12026. + ++fc;
  12027. +
  12028. + reloc = BFD_RELOC_C33_S_RL;
  12029. +
  12030. +#endif /* EXT_REMOVE */
  12031. + }
  12032. + }
  12033. + else if ((ex.X_op == O_symbol) && (operand->flags & C33_OPERAND_SYMBOL)){
  12034. + /* YES ld.w only */
  12035. + if( *str == '[' ){
  12036. + errmsg = _("invalid operand");
  12037. + }
  12038. + else if (operand->range == 6){
  12039. + /* ld.w %rd,LABEL@l */
  12040. +
  12041. + /* Get Symbol mask relocation */
  12042. + reloc = c33_reloc_prefix ();
  12043. + }
  12044. + else if (operand->range == 19){
  12045. + /* xld.w rd,symbol+imm19 */
  12046. +
  12047. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12048. + extra_data_befor_insn = true;
  12049. + extra_data_len = 1;
  12050. + extraInsnBuf[0] = opcode->opcode;
  12051. +
  12052. + if (fc >= MAX_INSN_FIXUPS)
  12053. + as_fatal (_("too many fixups"));
  12054. +
  12055. + fixups[ fc ].exp = ex;
  12056. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12057. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12058. + ++fc;
  12059. +
  12060. + reloc = BFD_RELOC_C33_L;
  12061. +
  12062. + }
  12063. + else{
  12064. + if (operand->range == 32){
  12065. + /* ext label+imm32@h */
  12066. + /* ext label+imm32@m */
  12067. + /* xld.w label+imm32@l */
  12068. +
  12069. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  12070. +#ifdef EXT_REMOVE
  12071. + // optimizing ext inst
  12072. + // pattern xld.w %rd, LABEL
  12073. + if (g_c33_ext == 1) {
  12074. + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_xld_rd_symbol);
  12075. + }
  12076. +
  12077. + if (i_ext_cnt == 0) {
  12078. + // no ext
  12079. + reloc = BFD_RELOC_C33_L;
  12080. +
  12081. + } else if (i_ext_cnt == 1) {
  12082. + // 1 ext
  12083. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12084. + extra_data_befor_insn = true;
  12085. + extra_data_len = 1;
  12086. + extraInsnBuf[0] = opcode->opcode;
  12087. +
  12088. + if (fc >= MAX_INSN_FIXUPS)
  12089. + as_fatal (_("too many fixups"));
  12090. +
  12091. + fixups[ fc ].exp = ex;
  12092. + fixups[ fc ].opindex = * opcode->operands;
  12093. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12094. + ++fc;
  12095. +
  12096. + reloc = BFD_RELOC_C33_L;
  12097. +
  12098. +
  12099. + } else {
  12100. +
  12101. + /* 2 ext */
  12102. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12103. + extra_data_befor_insn = true;
  12104. + extra_data_len = 2;
  12105. + extraInsnBuf[0] = opcode->opcode;
  12106. + extraInsnBuf[1] = opcode->opcode;
  12107. +
  12108. + if (fc >= MAX_INSN_FIXUPS)
  12109. + as_fatal (_("too many fixups"));
  12110. +
  12111. + fixups[ fc ].exp = ex;
  12112. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12113. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  12114. + ++fc;
  12115. +
  12116. + fixups[ fc ].exp = ex;
  12117. + fixups[ fc ].opindex = * opcode->operands;
  12118. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12119. + ++fc;
  12120. +
  12121. + reloc = BFD_RELOC_C33_L;
  12122. +
  12123. + }
  12124. +#else
  12125. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  12126. +
  12127. + /* 2 ext */
  12128. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12129. + extra_data_befor_insn = true;
  12130. + extra_data_len = 2;
  12131. + extraInsnBuf[0] = opcode->opcode;
  12132. + extraInsnBuf[1] = opcode->opcode;
  12133. +
  12134. + if (fc >= MAX_INSN_FIXUPS)
  12135. + as_fatal (_("too many fixups"));
  12136. +
  12137. + fixups[ fc ].exp = ex;
  12138. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12139. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  12140. + ++fc;
  12141. +
  12142. + fixups[ fc ].exp = ex;
  12143. + fixups[ fc ].opindex = * opcode->operands;
  12144. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12145. + ++fc;
  12146. +
  12147. + reloc = BFD_RELOC_C33_L;
  12148. +#endif /* EXT_REMOVE */
  12149. + }
  12150. + }
  12151. + }
  12152. + else {
  12153. + errmsg = _("invalid operand");
  12154. + }
  12155. + }
  12156. + /* Operand is register indirectness (memory). */
  12157. +// else if ((operand->flags & C33_OPERAND_RB) != 0) /* del T.Tazaki 2004/07/30 */
  12158. + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) == 0 && g_iMedda32 == 1 ) /* add T.Tazaki 2004/07/30 */
  12159. + {
  12160. + /* Pattern */
  12161. + /* [rb] */
  12162. +
  12163. + if (*str == '['){
  12164. + str++;
  12165. + input_line_pointer = str;
  12166. +
  12167. + if (register_name (& ex))
  12168. + {
  12169. + /* YES register */
  12170. +
  12171. + /* Skip space */
  12172. + while (isspace (*input_line_pointer))
  12173. + ++input_line_pointer;
  12174. +
  12175. + /* IF ']' */
  12176. + if (*input_line_pointer == ']'){
  12177. + /* YES pattern match */
  12178. + input_line_pointer++;
  12179. + }
  12180. + else {
  12181. + /* NO not match */
  12182. + errmsg = _("invalid operand");
  12183. + }
  12184. + }
  12185. + else {
  12186. + /* NO not register */
  12187. + errmsg = _("invalid operand");
  12188. + }
  12189. +
  12190. + }
  12191. + else
  12192. + errmsg = _("invalid operand");
  12193. + }
  12194. + /* add T.Tazaki 2004/07/30 >>> */
  12195. + /* Operand is register indirectness (memory). */
  12196. + else if ((operand->flags & C33_OPERAND_RB) != 0 && g_iMedda32 == 0 ) /* Use data area */
  12197. + {
  12198. + /* Pattern */
  12199. + /* [rb] */
  12200. +
  12201. + if (*str == '['){
  12202. + str++;
  12203. + input_line_pointer = str;
  12204. +
  12205. + if (register_name (& ex))
  12206. + {
  12207. + /* YES register */
  12208. +
  12209. + /* Skip space */
  12210. + while (isspace (*input_line_pointer))
  12211. + ++input_line_pointer;
  12212. +
  12213. + /* IF ']' */
  12214. + if (*input_line_pointer == ']'){
  12215. + /* YES pattern match */
  12216. + input_line_pointer++;
  12217. + }
  12218. + else {
  12219. + /* NO not match */
  12220. + errmsg = _("invalid operand");
  12221. + }
  12222. + }
  12223. + else {
  12224. + /* NO not register */
  12225. + errmsg = _("invalid operand");
  12226. + }
  12227. +
  12228. + }
  12229. + else
  12230. + errmsg = _("invalid operand");
  12231. + }
  12232. + else if ((operand->flags & C33_OPERAND_RB) != 0 && (operand->flags & C33_OPERAND_26) != 0 && g_iMedda32 == 1 )
  12233. + {
  12234. + /* Are there any symbol and IMM which follow a register? */
  12235. + /* Pattern */
  12236. + /* [rb+imm26] */
  12237. +
  12238. + if (*str == '['){
  12239. + str++;
  12240. + input_line_pointer = str;
  12241. +
  12242. + if (register_name (& ex))
  12243. + {
  12244. + /* Skip Space */
  12245. + while (isspace (*input_line_pointer))
  12246. + ++input_line_pointer;
  12247. +
  12248. + /* IF ']' */
  12249. + if (*input_line_pointer == ']'){
  12250. + /* YES Register Only */
  12251. + input_line_pointer++;
  12252. + }
  12253. + /* ELSE IF plus */
  12254. + else if (*input_line_pointer == '+'){
  12255. + /* YES plus */
  12256. +
  12257. + input_line_pointer++;
  12258. + /* symbol,imm */
  12259. + expression (& ext_ex);
  12260. +
  12261. + if (ext_ex.X_op == O_constant){
  12262. + /* [%rd+imm26] */
  12263. +
  12264. + uiNumber = ext_ex.X_add_number;
  12265. +
  12266. + if (uiNumber == 0){
  12267. + /* EMPTY */
  12268. + }
  12269. + else if (uiNumber <= 0x1fff){
  12270. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12271. + extra_data_befor_insn = true;
  12272. + extra_data_len = 1;
  12273. + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
  12274. + }
  12275. + else if (uiNumber <= 0x3ffffff){
  12276. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12277. + extra_data_befor_insn = true;
  12278. + extra_data_len = 2;
  12279. + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
  12280. + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
  12281. + }
  12282. + else {
  12283. + /* NO more than 27bit ? */
  12284. +
  12285. + /* tnot support */
  12286. + errmsg = _("invalid operand");
  12287. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  12288. + }
  12289. + }
  12290. + else {
  12291. + /* NO not immidiate */
  12292. + errmsg = _("invalid operand");
  12293. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  12294. + }
  12295. + }
  12296. + else {
  12297. + /* NO any other character */
  12298. + /* error */
  12299. + errmsg = _("invalid operand");
  12300. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  12301. + }
  12302. + }
  12303. + else
  12304. + errmsg = _("invalid operand");
  12305. + }
  12306. + else
  12307. + errmsg = _("invalid operand");
  12308. + }
  12309. +
  12310. + /* add T.Tazaki 2004/07/30 <<< */
  12311. +
  12312. +/* >>> add tazaki 2001.11.20 */
  12313. +
  12314. + else if( ( (operand->flags & C33_OPERAND_MEM) != 0 ) &&
  12315. + ( (operand->flags & C33_OPERAND_DP_SYMBOL) == C33_OPERAND_DP_SYMBOL ) )
  12316. + {
  12317. + if (*str == '['){
  12318. + str++;
  12319. + input_line_pointer = str;
  12320. +
  12321. + if (!register_name (& ex))
  12322. + {
  12323. + /* YES not register */
  12324. +
  12325. + if (system_register_name (& ex, true, false)){
  12326. + /* system register */
  12327. + errmsg = _("invalid operand");
  12328. + }
  12329. + else {
  12330. + check_input_line_pointer = input_line_pointer;
  12331. +
  12332. + expression (& ex);
  12333. +
  12334. + /* if Minus "-", No Support! */
  12335. + while(check_input_line_pointer < input_line_pointer){
  12336. + if (*check_input_line_pointer == '-'){
  12337. + errmsg = _("invalid operand");
  12338. + break;
  12339. + }
  12340. + check_input_line_pointer++;
  12341. + }
  12342. + }
  12343. + if (errmsg != NULL){
  12344. + }
  12345. + /* ELSE IF Operand is SYMBOL */
  12346. + else if (ex.X_op == O_symbol){
  12347. + /* Pattern */
  12348. + /* [symbol+imm32] */
  12349. +
  12350. + if( operand->range == 19 )
  12351. + {
  12352. + if( g_iMedda32 == 0 ) /* add T.Tazaki 2004/07/30 */
  12353. + {
  12354. + /* ext (symbol+imm32-dp)@6-18 : ext imm13 */
  12355. + /* ld.w (symbol+imm32-dp)@0-5 : ld.w r0,[%dp+imm6] */
  12356. +
  12357. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  12358. +#ifdef EXT_REMOVE
  12359. + // optimizing ext inst
  12360. + // for following patterns
  12361. + //
  12362. + // ald.* %rd, [LABEL] (mem read) (without medda32)
  12363. + // ald.* [LABEL], %rd (mem write) (without medda32)
  12364. + if (g_c33_ext == 1) {
  12365. + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_ald_mem_rw);
  12366. + }
  12367. +
  12368. + if (i_ext_cnt == 0) {
  12369. + // no ext
  12370. + reloc = BFD_RELOC_C33_DPL;
  12371. +
  12372. + } else {
  12373. + /* 1 ext */
  12374. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12375. + extra_data_befor_insn = true;
  12376. + extra_data_len = 1;
  12377. + extraInsnBuf[0] = opcode->opcode;
  12378. +
  12379. + if (fc >= MAX_INSN_FIXUPS)
  12380. + as_fatal (_("too many fixups"));
  12381. +
  12382. + fixups[ fc ].exp = ex;
  12383. + fixups[ fc ].opindex = * opcode->operands;
  12384. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  12385. + ++fc;
  12386. + reloc = BFD_RELOC_C33_DPL;
  12387. +
  12388. + }
  12389. +#else
  12390. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  12391. +
  12392. + /* 1 ext */
  12393. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12394. + extra_data_befor_insn = true;
  12395. + extra_data_len = 1;
  12396. + extraInsnBuf[0] = opcode->opcode;
  12397. +
  12398. + if (fc >= MAX_INSN_FIXUPS)
  12399. + as_fatal (_("too many fixups"));
  12400. +
  12401. + fixups[ fc ].exp = ex;
  12402. + fixups[ fc ].opindex = * opcode->operands;
  12403. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  12404. + ++fc;
  12405. + reloc = BFD_RELOC_C33_DPL;
  12406. +#endif /* EXT_REMOVE */
  12407. + }
  12408. +#if 0
  12409. + else
  12410. + {
  12411. + /* add T.Tazaki 2004/08/19 >>> */
  12412. + /* 0:pushn %r0 */
  12413. + /* 1:ext label+imm32@m */
  12414. + /* 2:ld.x %r0,label+imm32@l */
  12415. + /* 3:ld.x %rd,[%r0] */
  12416. + /* 4:popn %r0 */
  12417. +
  12418. + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
  12419. + /* 1ext */
  12420. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12421. + extra_data_befor_insn = true;
  12422. + extraInsnBuf[1] = opcode->opcode;
  12423. +
  12424. + if (fc >= MAX_INSN_FIXUPS)
  12425. + as_fatal (_("too many fixups"));
  12426. +
  12427. + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_M に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
  12428. + を追加して、リンカで "pushn %r0" を設定させるためにある。 */
  12429. + fixups[ fc ].exp = ex;
  12430. + fixups[ fc ].opindex = * opcode->operands;
  12431. + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0; /* デフォルトの"pushn %r0" を設定 */
  12432. + ++fc;
  12433. +
  12434. + fixups[ fc ].exp = ex;
  12435. + fixups[ fc ].opindex = * opcode->operands;
  12436. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12437. + ++fc;
  12438. +
  12439. + reloc = BFD_RELOC_C33_L;
  12440. +
  12441. + extra_data_befor_insn = true;
  12442. + ulrd = insn & 0x000f;
  12443. + insn &= 0xfff0;
  12444. + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
  12445. +
  12446. + if ((operand->flags & C33_XLDB_RD) != 0)
  12447. + {
  12448. + insn = 0x2000 + ulrd; /* ld.b %rd,[%r0] */
  12449. + }
  12450. + else if((operand->flags & C33_XLDB_WR) != 0)
  12451. + {
  12452. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12453. + g_iXload_range = operand->range;
  12454. + insn = 0x3400; /* ld.b [%r0],%rs */
  12455. + }
  12456. + if ((operand->flags & C33_XLDH_RD) != 0)
  12457. + {
  12458. + insn = 0x2800 + ulrd; /* ld.h %rd,[%r0] */
  12459. + }
  12460. + else if((operand->flags & C33_XLDH_WR) != 0)
  12461. + {
  12462. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12463. + g_iXload_range = operand->range;
  12464. + insn = 0x3800; /* ld.h [%r0],%rs */
  12465. + }
  12466. + if ((operand->flags & C33_XLDW_RD) != 0)
  12467. + {
  12468. + insn = 0x3000 + ulrd; /* ld.w %rd,[%r0] */
  12469. + }
  12470. + else if((operand->flags & C33_XLDW_WR) != 0)
  12471. + {
  12472. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12473. + g_iXload_range = operand->range;
  12474. + insn = 0x3c00; /* ld.w [%r0],%rs */
  12475. + }
  12476. + if ((operand->flags & C33_XLDUB_RD) != 0)
  12477. + {
  12478. + insn = 0x2400 + ulrd; /* ld.ub %rd,[%r0] */
  12479. + }
  12480. + else if((operand->flags & C33_XLDUH_RD) != 0)
  12481. + {
  12482. + insn = 0x2c00 + ulrd; /* ld.uh %rd,[%r0] */
  12483. + }
  12484. + extraInsnBuf[3] = insn;
  12485. + insn = 0x0240; /* popn %r0 */
  12486. + extraInsnBuf[4] = insn;
  12487. + extra_data_len = 4;
  12488. +
  12489. + }
  12490. + /* add T.Tazaki 2004/08/19 <<< */
  12491. +#endif
  12492. + }else if ( operand->range == 32 ){
  12493. + /* ext (symbol+imm32-%dp)@19-31 : ext imm13 */
  12494. + /* ext (symbol+imm32-%dp)@6-18 : ext imm13 */
  12495. + /* ld.w (symbol+imm32-%dp)@0-5 : ld.w r0,[%dp+imm6] */
  12496. +
  12497. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  12498. +#ifdef EXT_REMOVE
  12499. + // optimizing ext inst
  12500. + // for following patterns
  12501. + //
  12502. + // xld.* %rd, [LABEL] (mem read) (without medda32 and is ADV)
  12503. + // xld.* [LABEL], %rd (mem write) (without medda32 and is ADV)
  12504. + if (g_c33_ext == 1) {
  12505. + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_xld_mem_rw_adv);
  12506. + }
  12507. +
  12508. + if (i_ext_cnt == 0) {
  12509. + // no ext
  12510. + reloc = BFD_RELOC_C33_DPL;
  12511. +
  12512. + } else if (i_ext_cnt == 1) {
  12513. + // 1 ext
  12514. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12515. + extra_data_befor_insn = true;
  12516. + extra_data_len = 1;
  12517. + extraInsnBuf[0] = opcode->opcode;
  12518. +
  12519. + if (fc >= MAX_INSN_FIXUPS)
  12520. + as_fatal (_("too many fixups"));
  12521. +
  12522. + fixups[ fc ].exp = ex;
  12523. + fixups[ fc ].opindex = * opcode->operands;
  12524. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  12525. + ++fc;
  12526. + reloc = BFD_RELOC_C33_DPL;
  12527. +
  12528. + } else {
  12529. + /* 2 ext */
  12530. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12531. + extra_data_befor_insn = true;
  12532. + extra_data_len = 2;
  12533. + extraInsnBuf[0] = opcode->opcode;
  12534. + extraInsnBuf[1] = opcode->opcode;
  12535. +
  12536. + if (fc >= MAX_INSN_FIXUPS)
  12537. + as_fatal (_("too many fixups"));
  12538. +
  12539. + fixups[ fc ].exp = ex;
  12540. + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
  12541. + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
  12542. + ++fc;
  12543. +
  12544. + fixups[ fc ].exp = ex;
  12545. + fixups[ fc ].opindex = * opcode->operands;
  12546. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  12547. + ++fc;
  12548. + reloc = BFD_RELOC_C33_DPL;
  12549. +
  12550. + }
  12551. +#else
  12552. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  12553. +
  12554. + /* 2 ext */
  12555. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12556. + extra_data_befor_insn = true;
  12557. + extra_data_len = 2;
  12558. + extraInsnBuf[0] = opcode->opcode;
  12559. + extraInsnBuf[1] = opcode->opcode;
  12560. +
  12561. + if (fc >= MAX_INSN_FIXUPS)
  12562. + as_fatal (_("too many fixups"));
  12563. +
  12564. + fixups[ fc ].exp = ex;
  12565. + fixups[ fc ].opindex = * opcode->operands; /* extのオペランド */
  12566. + fixups[ fc ].reloc = BFD_RELOC_C33_DPH;
  12567. + ++fc;
  12568. +
  12569. + fixups[ fc ].exp = ex;
  12570. + fixups[ fc ].opindex = * opcode->operands;
  12571. + fixups[ fc ].reloc = BFD_RELOC_C33_DPM;
  12572. + ++fc;
  12573. + reloc = BFD_RELOC_C33_DPL;
  12574. +#endif /* EXT_REMOVE */
  12575. +
  12576. + }
  12577. + }
  12578. + }
  12579. + else {
  12580. + errmsg = _("invalid operand");
  12581. + }
  12582. + }
  12583. + else {
  12584. + errmsg = _("invalid operand");
  12585. + }
  12586. + }
  12587. +/* <<< add tazaki 2001.11.20 */
  12588. +
  12589. + /* An operand is register indirectness (memory). */
  12590. + else if ((operand->flags & C33_OPERAND_MEM) != 0)
  12591. + {
  12592. + if (*str == '['){
  12593. + str++;
  12594. + input_line_pointer = str;
  12595. +
  12596. + if (!register_name (& ex))
  12597. + {
  12598. + /* YES not register */
  12599. +
  12600. + if (system_register_name (& ex, true, false)){
  12601. + /* system register */
  12602. + errmsg = _("invalid operand");
  12603. + }
  12604. + else {
  12605. + check_input_line_pointer = input_line_pointer;
  12606. +
  12607. + expression (& ex);
  12608. +
  12609. + /* if Minus "-", No Support! */
  12610. + while(check_input_line_pointer < input_line_pointer){
  12611. + if (*check_input_line_pointer == '-'){
  12612. + errmsg = _("invalid operand");
  12613. + break;
  12614. + }
  12615. + check_input_line_pointer++;
  12616. + }
  12617. + }
  12618. +
  12619. + if (errmsg != NULL){
  12620. + }
  12621. + /* ELSE IF Operand is Immidiate ? */
  12622. + else if (ex.X_op == O_constant){
  12623. + errmsg = _("invalid operand"); /* [imm26] patter : Error! 2001.11.28 */
  12624. + }
  12625. + /* ELSE IF Operand is SYMBOL ? */
  12626. + else if (ex.X_op == O_symbol){
  12627. +
  12628. + /* Pattern */
  12629. + /* [symbol+imm32] */
  12630. +
  12631. +
  12632. + /* ext goff_hi(symbol+imm32) */
  12633. + /* ext goff_lo(symbol+imm32) */
  12634. + /* [r15] */
  12635. +
  12636. + if (operand->range == 13){
  12637. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12638. + extra_data_befor_insn = true;
  12639. + extra_data_len = 1;
  12640. + extraInsnBuf[0] = opcode->opcode;
  12641. +
  12642. + if (fc >= MAX_INSN_FIXUPS)
  12643. + as_fatal (_("too many fixups"));
  12644. +
  12645. + fixups[ fc ].exp = ex;
  12646. + fixups[ fc ].opindex = * opcode->operands;
  12647. + fixups[ fc ].reloc = BFD_RELOC_C33_GL;
  12648. + ++fc;
  12649. +
  12650. +
  12651. + /* Save Register Number. */
  12652. + ex.X_op = O_register;
  12653. + ex.X_add_number = GP_REG;
  12654. + ex.X_add_symbol = NULL;
  12655. + ex.X_op_symbol = NULL;
  12656. +
  12657. + }
  12658. + else if (operand->range == 26 && g_iMedda32 == 0 ){ /* use data area */
  12659. +
  12660. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  12661. +#ifdef EXT_REMOVE
  12662. + // optimizing ext inst
  12663. + // for following patterns
  12664. + //
  12665. + // xld.* %rd, [LABEL] (mem read) (without medda32 and not ADV)
  12666. + // xld.* [LABEL], %rd (mem write) (without medda32 and not ADV)
  12667. + // xb* [LABEL], imm3 (without medda32)
  12668. + if (g_c33_ext == 1) {
  12669. + i_ext_cnt = evaluate_ext_count(ex, g_dpAddress, count_ext_for_xld_mem_rw);
  12670. + }
  12671. +
  12672. + if (i_ext_cnt == 1) {
  12673. + // 1 ext
  12674. + // at least 1 ext will be appended
  12675. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12676. + extra_data_befor_insn = true;
  12677. + extra_data_len = 1;
  12678. + extraInsnBuf[0] = opcode->opcode;
  12679. +
  12680. + if (fc >= MAX_INSN_FIXUPS)
  12681. + as_fatal (_("too many fixups"));
  12682. +
  12683. + fixups[ fc ].exp = ex;
  12684. + fixups[ fc ].opindex = * opcode->operands;
  12685. + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
  12686. + ++fc;
  12687. +
  12688. + /* Save Register Number. */
  12689. + ex.X_op = O_register;
  12690. + ex.X_add_number = GP_REG;
  12691. + ex.X_add_symbol = NULL;
  12692. + ex.X_op_symbol = NULL;
  12693. +
  12694. +
  12695. + } else {
  12696. +
  12697. + /* 2 ext */
  12698. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12699. + extra_data_befor_insn = true;
  12700. + extra_data_len = 2;
  12701. + extraInsnBuf[0] = opcode->opcode;
  12702. + extraInsnBuf[1] = opcode->opcode;
  12703. +
  12704. + if (fc >= MAX_INSN_FIXUPS)
  12705. + as_fatal (_("too many fixups"));
  12706. +
  12707. + fixups[ fc ].exp = ex;
  12708. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12709. + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
  12710. + ++fc;
  12711. +
  12712. + fixups[ fc ].exp = ex;
  12713. + fixups[ fc ].opindex = * opcode->operands;
  12714. + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
  12715. + ++fc;
  12716. +
  12717. +
  12718. + /* Save Register Number. */
  12719. + ex.X_op = O_register;
  12720. + ex.X_add_number = GP_REG;
  12721. + ex.X_add_symbol = NULL;
  12722. + ex.X_op_symbol = NULL;
  12723. +
  12724. + }
  12725. +#else
  12726. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  12727. +
  12728. + /* 2 ext */
  12729. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12730. + extra_data_befor_insn = true;
  12731. + extra_data_len = 2;
  12732. + extraInsnBuf[0] = opcode->opcode;
  12733. + extraInsnBuf[1] = opcode->opcode;
  12734. +
  12735. + if (fc >= MAX_INSN_FIXUPS)
  12736. + as_fatal (_("too many fixups"));
  12737. +
  12738. + fixups[ fc ].exp = ex;
  12739. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12740. + fixups[ fc ].reloc = BFD_RELOC_C33_DH;
  12741. + ++fc;
  12742. +
  12743. + fixups[ fc ].exp = ex;
  12744. + fixups[ fc ].opindex = * opcode->operands;
  12745. + fixups[ fc ].reloc = BFD_RELOC_C33_DL;
  12746. + ++fc;
  12747. +
  12748. +
  12749. + /* Save Register Number. */
  12750. + ex.X_op = O_register;
  12751. + ex.X_add_number = GP_REG;
  12752. + ex.X_add_symbol = NULL;
  12753. + ex.X_op_symbol = NULL;
  12754. +
  12755. +#endif /* EXT_REMOVE */
  12756. + }
  12757. + /* add T.Tazaki 2004/08/19 >>> */
  12758. + else if ((operand->range == 19 || operand->range == 26) && g_iMedda32 == 1 ){ /* xld と ald 兼用 : no use data area */
  12759. +
  12760. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  12761. +#ifdef EXT_REMOVE
  12762. + // optimizing ext inst
  12763. + // for following patterns
  12764. + //
  12765. + // xld.* %rd, [LABEL] (mem read) (with medda32)
  12766. + // xld.* [LABEL], %rd (mem write) (with medda32)
  12767. + // ald.* %rd, [LABEL] (mem read) (with medda32)
  12768. + // ald.* [LABEL], %rd (mem write) (with medda32)
  12769. + // xb* [LABEL], imm3 (with medda32)
  12770. +
  12771. + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
  12772. + /* 0:pushn %r0 */
  12773. + /* 1:ext label+imm32@m */
  12774. + /* 2:ext label+imm32@m */
  12775. + /* 3:ld.x %r0,label+imm32@l */
  12776. + /* 4:ld.x [%r0],%rs */
  12777. + /* 5:popn %r0 */
  12778. +
  12779. +// macro which means that we are now dealing with a memory read (*ld.* %rd, [LABEL]) operation
  12780. +// and not memory write or bit operation
  12781. +#define IS_MEM_READ ( (operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  12782. +
  12783. +
  12784. + if (g_c33_ext == 1) {
  12785. + // for ald
  12786. + if (operand->range == 19) {
  12787. + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_ald_mem_rw32);
  12788. + } else {
  12789. + i_ext_cnt = evaluate_ext_count(ex, 0, count_ext_for_xld_mem_rw32);
  12790. + }
  12791. + }
  12792. +
  12793. + // determine extraInsnBuf indices from ext counts
  12794. + if (i_ext_cnt == 0) {
  12795. + // no ext
  12796. + if (IS_MEM_READ) {
  12797. + insn_idx_low = 0;
  12798. + } else {
  12799. + insn_idx_low = 1;
  12800. + }
  12801. + } else if (i_ext_cnt == 1) {
  12802. + // 1 ext
  12803. + if (IS_MEM_READ) {
  12804. + insn_idx_low = 1;
  12805. + } else {
  12806. + insn_idx_low = 2;
  12807. + }
  12808. + } else {
  12809. + // 2 ext
  12810. + if (IS_MEM_READ) {
  12811. + if (operand->range == 26) {
  12812. + insn_idx_low = 2;
  12813. + } else {
  12814. + insn_idx_low = 1; // ald
  12815. + }
  12816. + } else {
  12817. + if (operand->range == 26) {
  12818. + insn_idx_low = 3;
  12819. + } else {
  12820. + insn_idx_low = 2; // ald
  12821. + }
  12822. + }
  12823. + }
  12824. +
  12825. + // set all indices
  12826. + insn_idx_high = (insn_idx_low < 2) ? 0 : insn_idx_low - 2; // negative -> 0
  12827. + insn_idx_mid = (insn_idx_low < 1) ? 0 : insn_idx_low - 1; // negative -> 0
  12828. + insn_idx_low = insn_idx_low;
  12829. + insn_idx_load = insn_idx_low + 1;
  12830. + insn_idx_pop = insn_idx_low + 2; // only for mem write
  12831. +
  12832. +
  12833. + // push insn
  12834. + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
  12835. +
  12836. + // ext insn
  12837. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  12838. + extra_data_befor_insn = true;
  12839. +
  12840. + if (i_ext_cnt == 0) {
  12841. + ; // do nothing
  12842. + } else if (i_ext_cnt == 1) {
  12843. + extraInsnBuf[insn_idx_mid] = opcode->opcode;
  12844. + } else {
  12845. + // ald.* does not have ext @h
  12846. + if (operand->range == 26) {
  12847. + extraInsnBuf[insn_idx_high] = opcode->opcode;
  12848. + }
  12849. + extraInsnBuf[insn_idx_mid] = opcode->opcode;
  12850. + }
  12851. +
  12852. +
  12853. + // fill fixup array
  12854. + if (fc >= MAX_INSN_FIXUPS)
  12855. + as_fatal (_("too many fixups"));
  12856. +
  12857. + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
  12858. + を追加して、リンカで "pushn %r0" を設定させるためにある。
  12859. + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
  12860. + if (!IS_MEM_READ)
  12861. + {
  12862. + fixups[ fc ].exp = ex;
  12863. + fixups[ fc ].opindex = * opcode->operands;
  12864. + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
  12865. + ++fc;
  12866. + }
  12867. +
  12868. + if (i_ext_cnt == 0) {
  12869. + //
  12870. + reloc = BFD_RELOC_C33_L;
  12871. + } else if (i_ext_cnt == 1) {
  12872. +
  12873. + fixups[ fc ].exp = ex;
  12874. + fixups[ fc ].opindex = * opcode->operands;
  12875. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12876. + ++fc;
  12877. +
  12878. + reloc = BFD_RELOC_C33_L;
  12879. +
  12880. + } else {
  12881. +
  12882. + // ald.* has only 1 ext
  12883. + if ( operand->range == 26 ) {
  12884. + fixups[ fc ].exp = ex;
  12885. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  12886. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  12887. + ++fc;
  12888. + }
  12889. + fixups[ fc ].exp = ex;
  12890. + fixups[ fc ].opindex = * opcode->operands;
  12891. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  12892. + ++fc;
  12893. +
  12894. + reloc = BFD_RELOC_C33_L;
  12895. +
  12896. + }
  12897. +
  12898. +
  12899. + // low insn (ld.w %rd, @l)
  12900. + ulrd = insn & 0x000f;
  12901. + if( operand->range == 26 )
  12902. + {
  12903. + if (IS_MEM_READ)
  12904. + {
  12905. + extraInsnBuf[insn_idx_low] = insn; /* ld.w %rd,sign6 */
  12906. + }
  12907. + else
  12908. + {
  12909. + insn &= 0xfff0;
  12910. + extraInsnBuf[insn_idx_low] = insn; /* ld.w %r0,sign6 */
  12911. + }
  12912. + }
  12913. + else
  12914. + {
  12915. + if (IS_MEM_READ)
  12916. + {
  12917. + /* ald.x %rd,[symbol+imm] */
  12918. + extraInsnBuf[insn_idx_low] = insn; /* ld.w %rd,sign6 */
  12919. + }
  12920. + else
  12921. + {
  12922. + /* ald.x [symbol+imm],%rs */
  12923. + insn &= 0xfff0;
  12924. + extraInsnBuf[insn_idx_low] = insn; /* ld.w %r0,sign6 */
  12925. + }
  12926. + }
  12927. +
  12928. + // load insn
  12929. + if ((operand->flags & C33_XLDB_RD) != 0)
  12930. + {
  12931. + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
  12932. + }
  12933. + else if((operand->flags & C33_XLDB_WR) != 0)
  12934. + {
  12935. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12936. + g_iXload_range = operand->range;
  12937. + insn = 0x3400; /* ld.b [%r0],%rs */
  12938. + }
  12939. + if ((operand->flags & C33_XLDH_RD) != 0)
  12940. + {
  12941. + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
  12942. + }
  12943. + else if((operand->flags & C33_XLDH_WR) != 0)
  12944. + {
  12945. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12946. + g_iXload_range = operand->range;
  12947. + insn = 0x3800; /* ld.h [%r0],%rs */
  12948. + }
  12949. + if ((operand->flags & C33_XLDW_RD) != 0)
  12950. + {
  12951. + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
  12952. + }
  12953. + else if((operand->flags & C33_XLDW_WR) != 0)
  12954. + {
  12955. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  12956. + g_iXload_range = operand->range;
  12957. + insn = 0x3c00; /* ld.w [%r0],%rs */
  12958. + }
  12959. + if ((operand->flags & C33_XLDUB_RD) != 0)
  12960. + {
  12961. + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
  12962. + }
  12963. + else if((operand->flags & C33_XLDUH_RD) != 0)
  12964. + {
  12965. + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
  12966. + }
  12967. + else if((operand->flags & C33_XBTST) != 0)
  12968. + {
  12969. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  12970. + g_iBitTest_range = operand->range;
  12971. + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  12972. + }
  12973. + else if((operand->flags & C33_XBCLR) != 0)
  12974. + {
  12975. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  12976. + g_iBitTest_range = operand->range;
  12977. + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  12978. + }
  12979. + else if((operand->flags & C33_XBSET) != 0)
  12980. + {
  12981. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  12982. + g_iBitTest_range = operand->range;
  12983. + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  12984. + }
  12985. + else if((operand->flags & C33_XBNOT) != 0)
  12986. + {
  12987. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  12988. + g_iBitTest_range = operand->range;
  12989. + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  12990. + }
  12991. + if( operand->range == 26 )
  12992. + {
  12993. + if (IS_MEM_READ)
  12994. + {
  12995. + extraInsnBuf[insn_idx_load] = insn;
  12996. + extra_data_len = insn_idx_load;
  12997. + }
  12998. + else
  12999. + {
  13000. + extraInsnBuf[insn_idx_load] = insn;
  13001. + insn = 0x0240; /* popn %r0 */
  13002. + extraInsnBuf[insn_idx_pop] = insn;
  13003. + extra_data_len = insn_idx_pop;
  13004. + }
  13005. + }
  13006. + else
  13007. + {
  13008. + if (IS_MEM_READ)
  13009. + {
  13010. + extraInsnBuf[insn_idx_load] = insn;
  13011. + extra_data_len = insn_idx_load;
  13012. + }
  13013. + else
  13014. + {
  13015. + extraInsnBuf[insn_idx_load] = insn;
  13016. + insn = 0x0240; /* popn %r0 */
  13017. + extraInsnBuf[insn_idx_pop] = insn;
  13018. + extra_data_len = insn_idx_pop;
  13019. + }
  13020. + }
  13021. +#else
  13022. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  13023. +
  13024. + /* スクラッチは%r0だが、%rs = %r0のときは後で、スクラッチを%r1に変更される。 */
  13025. + /* 0:pushn %r0 */
  13026. + /* 1:ext label+imm32@m */
  13027. + /* 2:ext label+imm32@m */
  13028. + /* 3:ld.x %r0,label+imm32@l */
  13029. + /* 4:ld.x [%r0],%rs */
  13030. + /* 5:popn %r0 */
  13031. +
  13032. + extraInsnBuf[0] = 0x0200; /* pushn %r0 */
  13033. +
  13034. + /* 1 or 2 ext */
  13035. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13036. + extra_data_befor_insn = true;
  13037. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13038. + {
  13039. + extraInsnBuf[0] = opcode->opcode;
  13040. + }
  13041. + else
  13042. + {
  13043. + extraInsnBuf[1] = opcode->opcode;
  13044. + }
  13045. + if( operand->range == 26 )
  13046. + {
  13047. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13048. + {
  13049. + extraInsnBuf[1] = opcode->opcode;
  13050. + }
  13051. + else
  13052. + {
  13053. + extraInsnBuf[2] = opcode->opcode;
  13054. + }
  13055. + }
  13056. + if (fc >= MAX_INSN_FIXUPS)
  13057. + as_fatal (_("too many fixups"));
  13058. +
  13059. + /* これは、リンク後、pushn %rs の %rs が、BFD_RELOC_C33_H に設定されてしまうので新規にBFD_RELOC_C33_PUSHN_R0
  13060. + を追加して、リンカで "pushn %r0" を設定させるためにある。
  13061. + xld.x %rd,[symbol+imm] は、push/pop を行わない。 */
  13062. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) == 0 )
  13063. + {
  13064. + fixups[ fc ].exp = ex;
  13065. + fixups[ fc ].opindex = * opcode->operands;
  13066. + fixups[ fc ].reloc = BFD_RELOC_C33_PUSHN_R0;
  13067. + ++fc;
  13068. + }
  13069. +
  13070. + if( operand->range == 26 )
  13071. + {
  13072. + fixups[ fc ].exp = ex;
  13073. + fixups[ fc ].opindex = * opcode->operands; /* operand of ext */
  13074. + fixups[ fc ].reloc = BFD_RELOC_C33_H;
  13075. + ++fc;
  13076. + }
  13077. + fixups[ fc ].exp = ex;
  13078. + fixups[ fc ].opindex = * opcode->operands;
  13079. + fixups[ fc ].reloc = BFD_RELOC_C33_M;
  13080. + ++fc;
  13081. +
  13082. + reloc = BFD_RELOC_C33_L;
  13083. +
  13084. + extra_data_befor_insn = true;
  13085. + ulrd = insn & 0x000f;
  13086. + if( operand->range == 26 )
  13087. + {
  13088. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13089. + {
  13090. + extraInsnBuf[2] = insn; /* ld.w %rd,sign6 */
  13091. + }
  13092. + else
  13093. + {
  13094. + insn &= 0xfff0;
  13095. + extraInsnBuf[3] = insn; /* ld.w %r0,sign6 */
  13096. + }
  13097. + }
  13098. + else
  13099. + {
  13100. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13101. + {
  13102. + /* xld.x %rd,[symbol+imm] */
  13103. + extraInsnBuf[1] = insn; /* ld.w %rd,sign6 */
  13104. + }
  13105. + else
  13106. + {
  13107. + /* xld.x [symbol+imm],%rs */
  13108. + insn &= 0xfff0;
  13109. + extraInsnBuf[2] = insn; /* ld.w %r0,sign6 */
  13110. + }
  13111. + }
  13112. + if ((operand->flags & C33_XLDB_RD) != 0)
  13113. + {
  13114. + insn = 0x2000 + ulrd + ulrd * 16; /* ld.b %rd,[%rd] */
  13115. + }
  13116. + else if((operand->flags & C33_XLDB_WR) != 0)
  13117. + {
  13118. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  13119. + g_iXload_range = operand->range;
  13120. + insn = 0x3400; /* ld.b [%r0],%rs */
  13121. + }
  13122. + if ((operand->flags & C33_XLDH_RD) != 0)
  13123. + {
  13124. + insn = 0x2800 + ulrd + ulrd * 16; /* ld.h %rd,[%rd] */
  13125. + }
  13126. + else if((operand->flags & C33_XLDH_WR) != 0)
  13127. + {
  13128. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  13129. + g_iXload_range = operand->range;
  13130. + insn = 0x3800; /* ld.h [%r0],%rs */
  13131. + }
  13132. + if ((operand->flags & C33_XLDW_RD) != 0)
  13133. + {
  13134. + insn = 0x3000 + ulrd + ulrd * 16; /* ld.w %rd,[%rd] */
  13135. + }
  13136. + else if((operand->flags & C33_XLDW_WR) != 0)
  13137. + {
  13138. + g_iXload = 1; /* オペランド値取得用にフラグを1にする。 */
  13139. + g_iXload_range = operand->range;
  13140. + insn = 0x3c00; /* ld.w [%r0],%rs */
  13141. + }
  13142. + if ((operand->flags & C33_XLDUB_RD) != 0)
  13143. + {
  13144. + insn = 0x2400 + ulrd + ulrd * 16; /* ld.ub %rd,[%rd] */
  13145. + }
  13146. + else if((operand->flags & C33_XLDUH_RD) != 0)
  13147. + {
  13148. + insn = 0x2c00 + ulrd + ulrd * 16; /* ld.uh %rd,[%r0] */
  13149. + }
  13150. + else if((operand->flags & C33_XBTST) != 0)
  13151. + {
  13152. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  13153. + g_iBitTest_range = operand->range;
  13154. + insn = 0xa800; /* btst [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  13155. + }
  13156. + else if((operand->flags & C33_XBCLR) != 0)
  13157. + {
  13158. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  13159. + g_iBitTest_range = operand->range;
  13160. + insn = 0xac00; /* bclr [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  13161. + }
  13162. + else if((operand->flags & C33_XBSET) != 0)
  13163. + {
  13164. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  13165. + g_iBitTest_range = operand->range;
  13166. + insn = 0xb000; /* bset [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  13167. + }
  13168. + else if((operand->flags & C33_XBNOT) != 0)
  13169. + {
  13170. + g_iBitTest = 1; /* オペランド値取得用にフラグを1にする。 */
  13171. + g_iBitTest_range = operand->range;
  13172. + insn = 0xb400; /* bnot [%r0],imm3 */ /* ここではオペランド値 imm3 は設定しない。 */
  13173. + }
  13174. + if( operand->range == 26 )
  13175. + {
  13176. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13177. + {
  13178. + extraInsnBuf[3] = insn;
  13179. + extra_data_len = 3;
  13180. + }
  13181. + else
  13182. + {
  13183. + extraInsnBuf[4] = insn;
  13184. + insn = 0x0240; /* popn %r0 */
  13185. + extraInsnBuf[5] = insn;
  13186. + extra_data_len = 5;
  13187. + }
  13188. + }
  13189. + else
  13190. + {
  13191. + if ((operand->flags & (C33_XLDB_RD + C33_XLDH_RD + C33_XLDW_RD + C33_XLDUB_RD + C33_XLDUH_RD)) != 0 )
  13192. + {
  13193. + extraInsnBuf[2] = insn;
  13194. + extra_data_len = 2;
  13195. + }
  13196. + else
  13197. + {
  13198. + extraInsnBuf[3] = insn;
  13199. + insn = 0x0240; /* popn %r0 */
  13200. + extraInsnBuf[4] = insn;
  13201. + extra_data_len = 4;
  13202. + }
  13203. + }
  13204. +
  13205. +
  13206. + /* add T.Tazaki 2004/08/19 <<< */
  13207. +#endif /* EXT_REMOVE */
  13208. + }
  13209. + else {
  13210. + errmsg = _("invalid operand");
  13211. + }
  13212. + }
  13213. + else {
  13214. + errmsg = _("invalid operand");
  13215. + }
  13216. + }
  13217. + else {
  13218. + /* NO Register */
  13219. + /* Are there any symbol and IMM which follow a register? */
  13220. +
  13221. + /* Pattern */
  13222. + /* [rb+imm32] */
  13223. +
  13224. + /* Skip Space */
  13225. + while (isspace (*input_line_pointer))
  13226. + ++input_line_pointer;
  13227. +
  13228. + /* IF ']' */
  13229. + if (*input_line_pointer == ']'){
  13230. + /* YES Register Only */
  13231. + #if 0
  13232. + errmsg = _("invalid operand");
  13233. + #else
  13234. + input_line_pointer++;
  13235. + #endif
  13236. + }
  13237. + /* ELSE IF plus */
  13238. + else if (*input_line_pointer == '+'){
  13239. + /* YES plus */
  13240. +
  13241. + input_line_pointer++;
  13242. + /* symbol,imm */
  13243. + expression (& ext_ex);
  13244. +
  13245. + if (ext_ex.X_op == O_constant){
  13246. + /* [%rd+imm26] */
  13247. +
  13248. + uiNumber = ext_ex.X_add_number;
  13249. +
  13250. + if (uiNumber == 0){
  13251. + /* EMPTY */
  13252. + }
  13253. + else if (uiNumber <= 0x1fff){
  13254. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13255. + extra_data_befor_insn = true;
  13256. + extra_data_len = 1;
  13257. + extraInsnBuf[0] = opcode->opcode| (uiNumber & 0x1fff);
  13258. + }
  13259. + else if (uiNumber <= 0x3ffffff){
  13260. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13261. + extra_data_befor_insn = true;
  13262. + extra_data_len = 2;
  13263. + extraInsnBuf[0] = opcode->opcode| ((uiNumber >> 13) & 0x1fff);
  13264. + extraInsnBuf[1] = opcode->opcode| (uiNumber & 0x1fff);
  13265. + }
  13266. + else {
  13267. + /* NO more than 27bit ? */
  13268. +
  13269. + /* tnot support */
  13270. + errmsg = _("invalid operand");
  13271. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  13272. + }
  13273. + }
  13274. + else {
  13275. + /* NO not immidiate */
  13276. + errmsg = _("invalid operand");
  13277. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  13278. + }
  13279. + }
  13280. + else {
  13281. + /* NO any other character */
  13282. + /* error */
  13283. + errmsg = _("invalid operand");
  13284. + iMEM_IMM26_flag = 1; /* add tazaki 2001.10.11 */
  13285. + }
  13286. + }
  13287. + }
  13288. + else
  13289. + errmsg = _("invalid operand");
  13290. + }
  13291. + /* an operand -- the register with a post increment -- or [ being indirect ] */
  13292. + else if ((operand->flags & C33_OPERAND_REGINC) != 0)
  13293. + {
  13294. + if (*str == '['){
  13295. + str++;
  13296. + input_line_pointer = str;
  13297. +
  13298. + if (!register_name (& ex))
  13299. + {
  13300. + errmsg = _("invalid register name");
  13301. + }
  13302. + else {
  13303. + str = input_line_pointer;
  13304. +
  13305. + /* Skip space */
  13306. + while (isspace (*str))
  13307. + ++str;
  13308. +
  13309. + if (*str == ']'){
  13310. + ++str;
  13311. +
  13312. + while (isspace (*str))
  13313. + ++str;
  13314. +
  13315. + if (*str == '+'){
  13316. + /* normal end */
  13317. + str++;
  13318. + input_line_pointer = str;
  13319. +
  13320. + }
  13321. + else {
  13322. + errmsg = _("invalid operand");
  13323. + }
  13324. + }
  13325. + else {
  13326. + errmsg = _("invalid operand");
  13327. + }
  13328. + }
  13329. + }
  13330. + else
  13331. + errmsg = _("invalid operand");
  13332. + }
  13333. +
  13334. +
  13335. + /* Register indirectness with the De Dis placement */
  13336. + else if ((operand->flags & C33_OPERAND_SPMEM) != 0)
  13337. + {
  13338. + if (*str == '['){
  13339. + str++;
  13340. + /* Skip space */
  13341. + while (isspace (*str))
  13342. + ++str;
  13343. +
  13344. + input_line_pointer = str;
  13345. +
  13346. + /* check %sp */
  13347. + if ( ( strncmp(str,"%sp",3) != 0 ) && ( strncmp(str,"%SP",3) != 0 ))
  13348. + {
  13349. + /* YES */
  13350. + errmsg = _("invalid system register name");
  13351. + }
  13352. + else {
  13353. + str+=3;
  13354. + while (isspace (*str))
  13355. + ++str;
  13356. +
  13357. + /* IF ']' */
  13358. + if (*str == ']'){
  13359. + /* YES only register */
  13360. + /* Support "[%sp]" 2001.3.29 ide */
  13361. + ex.X_op = O_constant;
  13362. + ex.X_add_symbol = NULL;
  13363. + ex.X_op_symbol = NULL;
  13364. + ex.X_add_number = 0;
  13365. + str++;
  13366. + input_line_pointer = str;
  13367. + }
  13368. + else if (*str == '+'){
  13369. + /* [sp+imm] */
  13370. + str++;
  13371. + input_line_pointer = str;
  13372. +
  13373. + expression (& ex);
  13374. +
  13375. + iNumber = ex.X_add_number;
  13376. +
  13377. + if (operand->range <= 6){
  13378. + /* EMPTY */
  13379. + }
  13380. + else if (operand->range == 32) {
  13381. + /* update tazaki 2002.03.08 >>> */
  13382. + if (opcode->specialFlag == 1){
  13383. + /* ld.b */
  13384. + if ((unsigned int)iNumber <= 0x3f){
  13385. + ex.X_add_number /= 1;
  13386. +
  13387. + }else if ((unsigned int)iNumber <= 0x7ffff){
  13388. + /* 1 ext */
  13389. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13390. + extra_data_befor_insn = true;
  13391. + extra_data_len = 1;
  13392. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  13393. + ex.X_add_number = iNumber & 0x3f;
  13394. + }
  13395. + else {
  13396. + /* 2 ext */
  13397. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13398. + extra_data_befor_insn = true;
  13399. + extra_data_len = 2;
  13400. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  13401. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  13402. + ex.X_add_number = iNumber & 0x3f;
  13403. + }
  13404. + }
  13405. + else if (opcode->specialFlag == 2){
  13406. + /* ld.h */
  13407. + if ((unsigned int)iNumber <= 0x7f){
  13408. + ex.X_add_number /= 2;
  13409. +
  13410. + }else if ((unsigned int)iNumber <= 0x7ffff){
  13411. + /* 1 ext */
  13412. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13413. + extra_data_befor_insn = true;
  13414. + extra_data_len = 1;
  13415. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  13416. + ex.X_add_number = iNumber & 0x3f;
  13417. + }
  13418. + else {
  13419. + /* 2 ext */
  13420. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13421. + extra_data_befor_insn = true;
  13422. + extra_data_len = 2;
  13423. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  13424. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  13425. + ex.X_add_number = iNumber & 0x3f;
  13426. + }
  13427. + }
  13428. + else if (opcode->specialFlag == 4){
  13429. + /* ld.w */
  13430. + if ((unsigned int)iNumber <= 0xff){
  13431. + ex.X_add_number /= 4;
  13432. +
  13433. + }else if ((unsigned int)iNumber <= 0x7ffff){
  13434. + /* 1 ext */
  13435. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13436. + extra_data_befor_insn = true;
  13437. + extra_data_len = 1;
  13438. + extraInsnBuf[0] = opcode->opcode| ((iNumber >> 6) & 0x1fff);
  13439. + ex.X_add_number = iNumber & 0x3f;
  13440. + }
  13441. + else {
  13442. + /* 2 ext */
  13443. + opcode = (struct c33_opcode *)c33_ext_opcodes;
  13444. + extra_data_befor_insn = true;
  13445. + extra_data_len = 2;
  13446. + extraInsnBuf[0] = opcode->opcode | ((iNumber >> 19) & 0x1fff);
  13447. + extraInsnBuf[1] = opcode->opcode | ((iNumber >> 6) & 0x1fff);
  13448. + ex.X_add_number = iNumber & 0x3f;
  13449. + }
  13450. + }
  13451. + /* update tazaki 2002.03.08 <<< */
  13452. + }
  13453. + else {
  13454. + errmsg = _("constant too big to fit into instruction");
  13455. + }
  13456. + }
  13457. + else{
  13458. + errmsg = _("invalid operand");
  13459. + }
  13460. + }
  13461. + }
  13462. + else
  13463. + errmsg = _("invalid operand");
  13464. + }
  13465. +
  13466. + if (errmsg)
  13467. + goto error;
  13468. +
  13469. + switch (ex.X_op)
  13470. + {
  13471. + case O_cond:
  13472. + /* An operand and an operation code are made into a command code. */
  13473. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  13474. + (char *) NULL, 0,
  13475. + copy_of_instruction,flags);
  13476. + break;
  13477. + case O_op_shift:
  13478. + /* An operand and an operation code are made into a command code. */
  13479. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  13480. + (char *) NULL, 0,
  13481. + copy_of_instruction,flags);
  13482. + break;
  13483. + case O_spregister :
  13484. + /* Don't add %sp to a formula as an operand. */
  13485. + break;
  13486. + case O_dpregister :
  13487. + /* Don't add %sp to a formula as an operand. */
  13488. + break;
  13489. + case O_illegal:
  13490. + errmsg = _("illegal operand");
  13491. + goto error;
  13492. + case O_absent:
  13493. + errmsg = _("missing operand");
  13494. + goto error;
  13495. + case O_register:
  13496. + /* An operand and an operation code are made into a command code. */
  13497. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  13498. +#ifdef EXT_REMOVE
  13499. + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
  13500. + {
  13501. + if( g_iXload_range == 26 ) /* xld.x */
  13502. + {
  13503. + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
  13504. + {
  13505. +
  13506. + /* change %r0 --> %r1 */
  13507. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13508. + {
  13509. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  13510. + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  13511. + }
  13512. + else
  13513. + {
  13514. + /* ADV or PE */
  13515. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  13516. + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  13517. + }
  13518. + extraInsnBuf[insn_idx_low] = 0x6c01; /* ld.w %r1,symbol+imm */
  13519. + extraInsnBuf[insn_idx_load] = (extraInsnBuf[insn_idx_load] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  13520. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13521. + {
  13522. + extraInsnBuf[insn_idx_pop] = 0x0241; /* popn %r1 */
  13523. + insn = 0x0241;
  13524. + }
  13525. + else
  13526. + {
  13527. + /* ADV or PE */
  13528. + extraInsnBuf[insn_idx_pop] = 0x0051; /* pop %r1 */
  13529. + insn = 0x0051;
  13530. + }
  13531. + }
  13532. + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
  13533. + (char *) NULL, 0,
  13534. + copy_of_instruction,flags);
  13535. + }
  13536. + else
  13537. + {
  13538. + /* g_iXload_range = 19 : ald.x */
  13539. + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
  13540. + {
  13541. +
  13542. + /* change %r0 --> %r1 */
  13543. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13544. + {
  13545. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  13546. + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  13547. + }
  13548. + else
  13549. + {
  13550. + /* ADV or PE */
  13551. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  13552. + fixups[ 0 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  13553. + }
  13554. + extraInsnBuf[insn_idx_low] = 0x6c01; /* ld.w %r1,symbol+imm */
  13555. + extraInsnBuf[insn_idx_load] = (extraInsnBuf[insn_idx_load] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  13556. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13557. + {
  13558. + extraInsnBuf[insn_idx_pop] = 0x0241; /* popn %r1 */
  13559. + insn = 0x0241;
  13560. + }
  13561. + else
  13562. + {
  13563. + /* ADV or PE */
  13564. + extraInsnBuf[insn_idx_pop] = 0x0051; /* pop %r1 */
  13565. + insn = 0x0051;
  13566. + }
  13567. + }
  13568. + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
  13569. + (char *) NULL, 0,
  13570. + copy_of_instruction,flags);
  13571. + }
  13572. + g_iXload = 0;
  13573. + g_iXload_range = 0;
  13574. + }
  13575. +#else
  13576. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  13577. + /* add T.Tazaki 2004/08/19 >>> */
  13578. + if (g_iXload == 1) /* xld.x [symbol+imm],%rs ? */
  13579. + {
  13580. + if( g_iXload_range == 26 ) /* xld.x */
  13581. + {
  13582. + if( ex.X_add_number == 0 ) /* xld.x [symbol+imm],%rs : %rs = %r0 ? */
  13583. + {
  13584. + /* change %r0 --> %r1 */
  13585. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13586. + {
  13587. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  13588. + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  13589. + }
  13590. + else
  13591. + {
  13592. + /* ADV or PE */
  13593. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  13594. + fixups[ fc-4 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  13595. + }
  13596. + extraInsnBuf[3] = 0x6c01; /* ld.w %r1,symbol+imm */
  13597. + extraInsnBuf[4] = (extraInsnBuf[4] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  13598. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13599. + {
  13600. + extraInsnBuf[5] = 0x0241; /* popn %r1 */
  13601. + insn = 0x0241;
  13602. + }
  13603. + else
  13604. + {
  13605. + /* ADV or PE */
  13606. + extraInsnBuf[5] = 0x0051; /* pop %r1 */
  13607. + insn = 0x0051;
  13608. + }
  13609. + }
  13610. + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
  13611. + (char *) NULL, 0,
  13612. + copy_of_instruction,flags);
  13613. + }
  13614. + else
  13615. + {
  13616. + /* g_iXload_range = 19 : ald.x */
  13617. + if( ex.X_add_number == 0 ) /* ald.x [symbol+imm],%rs : %rs = %r0 ? */
  13618. + {
  13619. +
  13620. + /* change %r0 --> %r1 */
  13621. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13622. + {
  13623. + extraInsnBuf[0] = 0x0201; /* pushn %r1 */
  13624. + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSHN_R1; /* pushn %r1 */
  13625. + }
  13626. + else
  13627. + {
  13628. + /* ADV or PE */
  13629. + extraInsnBuf[0] = 0x0011; /* push %r1 */
  13630. + fixups[ fc-3 ].reloc = BFD_RELOC_C33_PUSH_R1; /* push %r1 */
  13631. + }
  13632. + extraInsnBuf[2] = 0x6c01; /* ld.w %r1,symbol+imm */
  13633. + extraInsnBuf[3] = (extraInsnBuf[3] & 0xff0f) | 0x0010; /* ld.x [%r1],%rs */
  13634. + if( g_iAdvance == 0 && g_iPE == 0 ) /* STD ? */
  13635. + {
  13636. + extraInsnBuf[4] = 0x0241; /* popn %r1 */
  13637. + insn = 0x0241;
  13638. + }
  13639. + else
  13640. + {
  13641. + /* ADV or PE */
  13642. + extraInsnBuf[4] = 0x0051; /* pop %r1 */
  13643. + insn = 0x0051;
  13644. + }
  13645. + }
  13646. + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
  13647. + (char *) NULL, 0,
  13648. + copy_of_instruction,flags);
  13649. + }
  13650. + g_iXload = 0;
  13651. + g_iXload_range = 0;
  13652. + }
  13653. + /* add T.Tazaki 2004/08/19 <<< */
  13654. +#endif /* EXT_REMOVE */
  13655. + else
  13656. + {
  13657. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  13658. + (char *) NULL, 0,
  13659. + copy_of_instruction,flags);
  13660. + }
  13661. + break;
  13662. +
  13663. + case O_constant:
  13664. + /* An operand and an operation code are made into a command code. */
  13665. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  13666. +#ifdef EXT_REMOVE
  13667. + if (g_iBitTest == 1) /* bit test inst ? */
  13668. + {
  13669. + if( g_iBitTest_range == 26 )
  13670. + {
  13671. + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
  13672. + (char *) NULL, 0,
  13673. + copy_of_instruction,flags);
  13674. + }
  13675. + else
  13676. + {
  13677. + extraInsnBuf[insn_idx_load] = c33_insert_operand (extraInsnBuf[insn_idx_load], operand, ex.X_add_number,
  13678. + (char *) NULL, 0,
  13679. + copy_of_instruction,flags);
  13680. + }
  13681. + g_iBitTest = 0;
  13682. + g_iBitTest_range = 0;
  13683. + }
  13684. +#else
  13685. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  13686. + /* add T.Tazaki 2004/07/30 >>> */
  13687. + if (g_iBitTest == 1) /* bit test inst ? */
  13688. + {
  13689. + if( g_iBitTest_range == 26 )
  13690. + {
  13691. +
  13692. + extraInsnBuf[4] = c33_insert_operand (extraInsnBuf[4], operand, ex.X_add_number,
  13693. + (char *) NULL, 0,
  13694. + copy_of_instruction,flags);
  13695. + }
  13696. + else
  13697. + {
  13698. + extraInsnBuf[3] = c33_insert_operand (extraInsnBuf[3], operand, ex.X_add_number,
  13699. + (char *) NULL, 0,
  13700. + copy_of_instruction,flags);
  13701. + }
  13702. + g_iBitTest = 0;
  13703. + g_iBitTest_range = 0;
  13704. + }
  13705. + /* add T.Tazaki 2004/07/30 <<< */
  13706. +#endif /* EXT_REMOVE */
  13707. + else
  13708. + {
  13709. + insn = c33_insert_operand (insn, operand, ex.X_add_number,
  13710. + (char *) NULL, 0,
  13711. + copy_of_instruction,flags);
  13712. + }
  13713. + break;
  13714. +
  13715. + case O_symbol:
  13716. + /* We need to generate a fixup for this expression. */
  13717. + if (fc >= MAX_INSN_FIXUPS)
  13718. + as_fatal (_("too many fixups"));
  13719. +
  13720. + fixups[ fc ].exp = ex;
  13721. + fixups[ fc ].opindex = * opindex_ptr;
  13722. + fixups[ fc ].reloc = reloc;
  13723. + ++fc;
  13724. + break;
  13725. +
  13726. + default:
  13727. + /* We need to generate a fixup for this expression. */
  13728. + if (fc >= MAX_INSN_FIXUPS)
  13729. + as_fatal (_("too many fixups"));
  13730. +
  13731. + fixups[ fc ].exp = ex;
  13732. + fixups[ fc ].opindex = * opindex_ptr;
  13733. + fixups[ fc ].reloc = BFD_RELOC_UNUSED;
  13734. + ++fc;
  13735. + break;
  13736. + }
  13737. + }
  13738. + str = input_line_pointer;
  13739. + input_line_pointer = hold;
  13740. +
  13741. + while (*str == ' ' || *str == ',' || *str == ']' )
  13742. + ++str;
  13743. + }
  13744. + match = 1;
  13745. +
  13746. + error:
  13747. + if (match == 0)
  13748. + {
  13749. +
  13750. + /* xld.w rd,[rs+imm26] : imm26 > 0x3ffffff ? add tazaki 2001.10.11 */
  13751. + if( iMEM_IMM26_flag == 0 ){ /* The following operand form is not seen at the time of range over.。*/
  13752. + next_opcode = opcode + 1;
  13753. + if (next_opcode->name != NULL
  13754. + && strcmp (next_opcode->name, opcode->name) == 0)
  13755. + {
  13756. + opcode = next_opcode;
  13757. + continue;
  13758. + }
  13759. + }
  13760. + as_bad (_("%s: %s"), copy_of_instruction, errmsg);
  13761. +/* as_bad ("%s: %s", copy_of_instruction, errmsg); Modify tazaki 2001.10.11 */
  13762. +
  13763. + if (* input_line_pointer == ']')
  13764. + ++ input_line_pointer;
  13765. +
  13766. + ignore_rest_of_line ();
  13767. + input_line_pointer = saved_input_line_pointer;
  13768. + return;
  13769. + }
  13770. + break;
  13771. + }
  13772. +
  13773. + while (isspace (*str))
  13774. + ++str;
  13775. +
  13776. + if (*str != '\0')
  13777. + /* xgettext:c-format */
  13778. + as_bad (_("junk at end of line: `%s'"), str);
  13779. +
  13780. + input_line_pointer = str;
  13781. +
  13782. + /* Write out the instruction. */
  13783. +
  13784. + if (relaxable && fc > 0)
  13785. + {
  13786. +
  13787. + fc = 0;
  13788. +
  13789. + if (!strcmp (opcode->name, "br"))
  13790. + {
  13791. + f = frag_var (rs_machine_dependent, 4, 2, 2,
  13792. + fixups[0].exp.X_add_symbol,
  13793. + fixups[0].exp.X_add_number,
  13794. + (char *)fixups[0].opindex);
  13795. + md_number_to_chars (f, insn, 2);
  13796. + md_number_to_chars (f + 2, 0, 2);
  13797. + }
  13798. + else
  13799. + {
  13800. + f = frag_var (rs_machine_dependent, 6, 4, 0,
  13801. + fixups[0].exp.X_add_symbol,
  13802. + fixups[0].exp.X_add_number,
  13803. + (char *)fixups[0].opindex);
  13804. + md_number_to_chars (f, insn, 2);
  13805. + md_number_to_chars (f + 2, 0, 4);
  13806. + }
  13807. + }
  13808. + else
  13809. + {
  13810. + /* ext command is set before a command code formula. . */
  13811. + if (extra_data_befor_insn)
  13812. + {
  13813. + /* Domain reservation */
  13814. + f = where = frag_more (extra_data_len*2+2); /* 2byte length instruction */
  13815. +
  13816. + /* The command code for extension (ext command) is acquired. */
  13817. + fromP = &extraInsnBuf[0];
  13818. +
  13819. + /* Only a part for the command code for FOR extensio */
  13820. + for (i = extra_data_len; i; --i)
  13821. + {
  13822. + /* The command code is stored in the buffer in order. */
  13823. + md_number_to_chars (where, (long) (*fromP), 2);
  13824. + where += 2;
  13825. + fromP++;
  13826. + }
  13827. +
  13828. +// ADD D.Fujimoto 2007/06/25 calculating inst offset for ext remove >>>>>>>
  13829. +#ifdef EXT_REMOVE
  13830. + ul_All_Offset += extra_data_len;
  13831. +#endif /* EXT_REMOVE */
  13832. +// ADD D.Fujimoto 2007/06/25 calculating inst offset for ext remove <<<<<<<
  13833. +
  13834. +
  13835. + extra_data_befor_insn = false;
  13836. + }
  13837. + else {
  13838. + /* Domain reservation */
  13839. + f = where = frag_more (2); /* 2byte length instruction */
  13840. + }
  13841. +
  13842. + /* >>> add tazaki 2001.09.13 */
  13843. + /* macclr,ld.cf ? */
  13844. + if (opcode->specialFlag == 10){
  13845. + insn |= 0x0010; /* bit 5,4 = 0,1 set */
  13846. + }
  13847. + /* <<< add tazaki 2001.09.13 */
  13848. +
  13849. + /* The command code of 2 byte length is stored in a buffer. */
  13850. + md_number_to_chars (where, insn, 2);
  13851. + }
  13852. +
  13853. + /* Create any fixups. At this point we do not use a
  13854. + bfd_reloc_code_real_type, but instead just use the
  13855. + BFD_RELOC_UNUSED plus the operand index. This lets us easily
  13856. + handle fixups for any operand type, although that is admittedly
  13857. + not a very exciting feature. We pick a BFD reloc type in
  13858. + md_apply_fix. */
  13859. + for (i = 0; i < fc; i++)
  13860. + {
  13861. + const struct c33_operand * operand;
  13862. + bfd_reloc_code_real_type reloc;
  13863. +
  13864. + operand = & c33_operands[ fixups[i].opindex ];
  13865. +
  13866. + reloc = fixups[i].reloc;
  13867. +
  13868. + if (reloc != BFD_RELOC_UNUSED)
  13869. + {
  13870. + reloc_howto_type * reloc_howto = bfd_reloc_type_lookup (stdoutput,
  13871. + reloc);
  13872. + int size;
  13873. + int address;
  13874. + fixS * fixP;
  13875. +
  13876. + if (!reloc_howto){
  13877. + ;
  13878. + /* abort(); */ /* del tazaki 2001.10.11 */
  13879. + }else{
  13880. +
  13881. + size = bfd_get_reloc_size (reloc_howto);
  13882. +
  13883. + if (size != 2) {
  13884. + ;
  13885. + /* abort (); */ /* del tazaki 2001.10.11 */
  13886. + }else{
  13887. +
  13888. + address = (f - frag_now->fr_literal) + 2 - size;
  13889. +
  13890. + f += 2;
  13891. +
  13892. + fixP = fix_new_exp (frag_now, address, size,
  13893. + & fixups[i].exp,
  13894. + reloc_howto->pc_relative,
  13895. + reloc);
  13896. +
  13897. + switch (reloc)
  13898. + {
  13899. + case BFD_RELOC_C33_RH:
  13900. + case BFD_RELOC_C33_RM:
  13901. + case BFD_RELOC_C33_RL:
  13902. + case BFD_RELOC_C33_S_RH: /* add T.Tazaki 2002.05.02 */
  13903. + case BFD_RELOC_C33_S_RM: /* add T.Tazaki 2002.05.02 */
  13904. + case BFD_RELOC_C33_S_RL: /* add T.Tazaki 2002.05.02 */
  13905. + case BFD_RELOC_C33_JP: /* add T.Tazaki 2002.04.22 */
  13906. + case BFD_RELOC_C33_AH:
  13907. + case BFD_RELOC_C33_AL:
  13908. + case BFD_RELOC_C33_H:
  13909. + case BFD_RELOC_C33_M:
  13910. + case BFD_RELOC_C33_L:
  13911. + /* >>>> add 2002.03.05 tazaki */
  13912. + case BFD_RELOC_C33_DH:
  13913. + case BFD_RELOC_C33_DL:
  13914. + case BFD_RELOC_C33_GL:
  13915. + case BFD_RELOC_C33_SH:
  13916. + case BFD_RELOC_C33_SL:
  13917. + case BFD_RELOC_C33_TH:
  13918. + case BFD_RELOC_C33_TL:
  13919. + case BFD_RELOC_C33_ZH:
  13920. + case BFD_RELOC_C33_ZL:
  13921. + case BFD_RELOC_C33_DPH:
  13922. + case BFD_RELOC_C33_DPM:
  13923. + case BFD_RELOC_C33_DPL:
  13924. + case BFD_RELOC_C33_LOOP:
  13925. + /* <<<< add 2002.03.05 tazaki */
  13926. + case BFD_RELOC_C33_PUSHN_R0: /* add T.Tazaki 2004/08/19 */
  13927. + case BFD_RELOC_C33_PUSHN_R1: /* add T.Tazaki 2004/08/19 */
  13928. + case BFD_RELOC_C33_PUSH_R1: /* add T.Tazaki 2004/08/19 */
  13929. + fixP->fx_no_overflow = 1;
  13930. + break;
  13931. + default:
  13932. + break;
  13933. + }
  13934. + }
  13935. + }
  13936. + }
  13937. + else
  13938. + {
  13939. + fix_new_exp (
  13940. + frag_now,
  13941. + f - frag_now->fr_literal, 4,
  13942. + & fixups[i].exp,
  13943. + 1 /* FIXME: C33_OPERAND_RELATIVE ??? */,
  13944. + (bfd_reloc_code_real_type) (fixups[i].opindex
  13945. + + (int) BFD_RELOC_UNUSED)
  13946. + );
  13947. + }
  13948. + }
  13949. +
  13950. + input_line_pointer = saved_input_line_pointer;
  13951. +}
  13952. +
  13953. +
  13954. +/* If while processing a fixup, a reloc really needs to be created */
  13955. +/* then it is done here. */
  13956. +
  13957. +arelent *
  13958. +tc_gen_reloc (seg, fixp)
  13959. + asection * seg;
  13960. + fixS * fixp;
  13961. +{
  13962. + arelent * reloc;
  13963. +
  13964. + reloc = (arelent *) xmalloc (sizeof (arelent));
  13965. + reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
  13966. + *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
  13967. + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
  13968. + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
  13969. +
  13970. + if (reloc->howto == (reloc_howto_type *) NULL)
  13971. + {
  13972. + as_bad_where (fixp->fx_file, fixp->fx_line,
  13973. + /* xgettext:c-format */
  13974. + _("reloc %d not supported by object file format"),
  13975. + (int) fixp->fx_r_type);
  13976. +
  13977. + xfree (reloc);
  13978. +
  13979. + return NULL;
  13980. + }
  13981. +
  13982. + reloc->addend = fixp->fx_addnumber;
  13983. +
  13984. + return reloc;
  13985. +}
  13986. +
  13987. +/* Assume everything will fit in two bytes, then expand as necessary. */
  13988. +int
  13989. +md_estimate_size_before_relax (fragp, seg)
  13990. + fragS * fragp;
  13991. + asection * seg;
  13992. +{
  13993. + if (fragp->fr_subtype == 0)
  13994. + fragp->fr_var = 4;
  13995. + else if (fragp->fr_subtype == 2)
  13996. + fragp->fr_var = 2;
  13997. + else
  13998. + abort ();
  13999. + return 2;
  14000. +}
  14001. +
  14002. +long
  14003. +c33_pcrel_from_section (fixp, section)
  14004. + fixS * fixp;
  14005. + segT section;
  14006. +{
  14007. + /* If the symbol is undefined, or in a section other than our own,
  14008. + or it is weak (in which case it may well be in another section,
  14009. + then let the linker figure it out. */
  14010. + if (fixp->fx_addsy != (symbolS *) NULL
  14011. + && (! S_IS_DEFINED (fixp->fx_addsy)
  14012. + || S_IS_WEAK (fixp->fx_addsy)
  14013. + || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
  14014. + return 0;
  14015. +
  14016. + return fixp->fx_frag->fr_address + fixp->fx_where;
  14017. +}
  14018. +
  14019. +/*
  14020. +The symbol which can be decided inside a file is decided here.
  14021. +
  14022. +The tc_gen_reloc function which is in bfd library further is passed,
  14023. + and, finally the symbol changed by referring to the exterior, the link,
  14024. + and relocation is on HOWTO broad view of bfd.
  14025. + It is processed by the defined method.
  14026. +*/
  14027. +
  14028. +/* add T.Tazaki 2002.04.25 >>> */
  14029. +long g_where_rh = 0xffffffff;
  14030. +long g_where_rm = 0xffffffff;
  14031. +
  14032. +char *g_pwhere_rh = 0;
  14033. +char *g_pwhere_rm = 0;
  14034. +
  14035. +/* add T.Tazaki 2002.04.25 <<< */
  14036. +
  14037. +int
  14038. +md_apply_fix3 (fixp, valuep, seg)
  14039. + fixS * fixp;
  14040. + valueT * valuep;
  14041. + segT seg;
  14042. +{
  14043. + valueT value;
  14044. + char * where;
  14045. + long insn;
  14046. + int iNumber; /* add T.Tazaki 2002.04.25 */
  14047. + long lNumber; /* add T.Tazaki 2002.04.25 */
  14048. +
  14049. + if (fixp->fx_addsy == (symbolS *) NULL)
  14050. + {
  14051. + value = * valuep;
  14052. + fixp->fx_done = 1;
  14053. + }
  14054. + else if (fixp->fx_pcrel)
  14055. + value = * valuep;
  14056. + else
  14057. + {
  14058. + value = fixp->fx_offset;
  14059. + if (fixp->fx_subsy != (symbolS *) NULL)
  14060. + {
  14061. + if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
  14062. + value -= S_GET_VALUE (fixp->fx_subsy);
  14063. + else
  14064. + {
  14065. + /* We don't actually support subtracting a symbol. */
  14066. + as_bad_where (fixp->fx_file, fixp->fx_line,
  14067. + _("expression too complex"));
  14068. + }
  14069. + }
  14070. + }
  14071. +
  14072. + if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
  14073. + {
  14074. + int opindex;
  14075. + const struct c33_operand * operand;
  14076. + unsigned long insn;
  14077. +
  14078. + opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
  14079. + operand = & c33_operands[ opindex ];
  14080. +
  14081. + /* Fetch the instruction, insert the fully resolved operand
  14082. + value, and stuff the instruction back again.
  14083. +
  14084. + Note the instruction has been stored in little endian
  14085. + format! */
  14086. + where = fixp->fx_frag->fr_literal + fixp->fx_where;
  14087. +
  14088. + insn = bfd_getl16 ((unsigned char *) where);
  14089. + insn = c33_insert_operand (insn, operand, (offsetT) value,
  14090. + fixp->fx_file, fixp->fx_line, NULL);
  14091. + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
  14092. +
  14093. + if (fixp->fx_done)
  14094. + {
  14095. + /* Nothing else to do here. */
  14096. + return 1;
  14097. + }
  14098. + }
  14099. + else if (fixp->fx_done)
  14100. + {
  14101. + /* We still have to insert the value into memory! */
  14102. + where = fixp->fx_frag->fr_literal + fixp->fx_where;
  14103. +
  14104. + if (fixp->fx_size == 1)
  14105. + * where = value & 0xff;
  14106. + else if (fixp->fx_size == 2){
  14107. +
  14108. + /* An address when a symbol is decided is buried here
  14109. + and crowded with the inside of a file. */
  14110. +
  14111. + /* A command code is acquired. */
  14112. + insn = bfd_getl16 ((unsigned char *) where);
  14113. +
  14114. + switch (fixp->fx_r_type)
  14115. + {
  14116. + case BFD_RELOC_C33_AH: /* @ah (25:13) */ /* NO USE : Absolute symbol */
  14117. +
  14118. + insn += ((value >> 13) & 0x1fff);
  14119. + break;
  14120. +
  14121. + case BFD_RELOC_C33_AL: /* @ah (12:0) */ /* NO USE : Absolute symbol */
  14122. + insn += (value & 0x1fff);
  14123. + break;
  14124. +
  14125. + case BFD_RELOC_C33_RH: /* LABEL-PC(31:22) */
  14126. +// if( g_listing == 0 ){ /* No -a option ? */
  14127. +// g_where_rh = fixp->fx_where;
  14128. +// }
  14129. +// else{
  14130. +// g_pwhere_rh = where;
  14131. +// }
  14132. +//
  14133. + insn += (((value - 4) >> 19) & 0x1ff8);
  14134. + break;
  14135. +
  14136. + case BFD_RELOC_C33_RM: /* LABEL-PC(21:9) */
  14137. +
  14138. +// if( g_listing == 0 ){ /* No -a option ? */
  14139. +//
  14140. +// g_where_rm = fixp->fx_where;
  14141. +// if( g_where_rh != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
  14142. +//
  14143. +// lNumber = value;
  14144. +// /* over signed 22bit ? */
  14145. +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  14146. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14147. +// /* as_bad_where = ERROR */
  14148. +// }
  14149. +// g_where_rh = 0xffffffff;
  14150. +// }
  14151. +// else
  14152. +// {
  14153. +// g_pwhere_rm = where;
  14154. +// if( g_pwhere_rh != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
  14155. +//
  14156. +// lNumber = value;
  14157. +// /* over signed 22bit ? */
  14158. +// if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  14159. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14160. +// /* as_bad_where = ERROR */
  14161. +// }
  14162. +// g_pwhere_rh = 0;
  14163. +// }
  14164. + insn += (((value - 2) >> 9) & 0x1fff);
  14165. + break;
  14166. +
  14167. + case BFD_RELOC_C33_RL: /* LABEL-PC(8:0) */
  14168. +
  14169. +// -al オプション付きのとき、where値が必ずしも@rm のPC+100とは限らないため、不採用。
  14170. +// -al無し( fixp->fx_where )ではOKだが、-alの有無でワーニング表示が異なるのは変なので両方削除した。
  14171. +
  14172. +// if( g_listing == 0 ){ /* No -a option ? */
  14173. +//
  14174. +// if( g_where_rm != ( fixp->fx_where - 2 ) ){ /* add T.Tazaki 2002.04.25 */
  14175. +//
  14176. +// lNumber = value;
  14177. +// /* over signed 8bit ? */
  14178. +// if (lNumber > 254 || lNumber < -256)
  14179. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14180. +// /* as_bad_where = ERROR */
  14181. +// }
  14182. +// g_where_rh = 0xffffffff;
  14183. +// g_where_rm = 0xffffffff;
  14184. +// }
  14185. +// else
  14186. +// {
  14187. +//
  14188. +// if( g_pwhere_rm != ( where - 100 ) ){ /* add T.Tazaki 2002.05.02 */
  14189. +//
  14190. +// lNumber = value;
  14191. +// /* over signed 8bit ? */
  14192. +// if (lNumber > 254 || lNumber < -256)
  14193. +// as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14194. +// /* as_bad_where = ERROR */
  14195. +// }
  14196. +// g_pwhere_rh = 0;
  14197. +// g_pwhere_rm = 0;
  14198. +// }
  14199. +
  14200. + insn += ((value >> 1) & 0xff);
  14201. + break;
  14202. +
  14203. +/* add T.Tazaki 2002.05.02 >>> */
  14204. +
  14205. + case BFD_RELOC_C33_S_RH: /* LABEL-PC(31:22) */ /* sjp,scall, xjp,xcall */
  14206. + g_where_rh = fixp->fx_where;
  14207. +
  14208. + insn += (((value - 4) >> 19) & 0x1ff8);
  14209. + break;
  14210. +
  14211. + case BFD_RELOC_C33_S_RM: /* LABEL-PC(21:9) */ /* sjp,scall, xjp,xcall */
  14212. +
  14213. + g_where_rm = fixp->fx_where;
  14214. + if( g_where_rh != ( fixp->fx_where - 2 ) ){
  14215. +
  14216. + lNumber = value;
  14217. + /* over signed 22bit ? */
  14218. + if ((lNumber - 2) > 0x1ffffe || (lNumber - 2 ) < -0x200000 )
  14219. + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14220. + /* as_bad_where = ERROR */
  14221. + }
  14222. + g_where_rh = 0xffffffff;
  14223. + insn += (((value - 2) >> 9) & 0x1fff);
  14224. + break;
  14225. +
  14226. + case BFD_RELOC_C33_S_RL: /* LABEL-PC(8:0) */ /* sjp,scall, xjp,xcall */
  14227. +
  14228. + if( g_where_rm != ( fixp->fx_where - 2 ) ){
  14229. +
  14230. + lNumber = value;
  14231. + /* over signed 8bit ? */
  14232. + if (lNumber > 254 || lNumber < -256)
  14233. + as_warn_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14234. + /* as_bad_where = ERROR */
  14235. + }
  14236. + g_where_rh = 0xffffffff;
  14237. + g_where_rm = 0xffffffff;
  14238. +
  14239. + insn += ((value >> 1) & 0xff);
  14240. + break;
  14241. +
  14242. +/* add T.Tazaki 2002.05.02 <<< */
  14243. +
  14244. + case BFD_RELOC_C33_JP: /* LABEL-PC(8:0) */ /* add T.Tazaki 2002.04.22 */
  14245. + /* jp label */
  14246. +
  14247. + /* over signed 8bit ? */
  14248. + iNumber = value;
  14249. +
  14250. + if (iNumber > 254 || iNumber < -256)
  14251. + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14252. +
  14253. + insn += ((value >> 1) & 0xff);
  14254. + break;
  14255. +
  14256. + case BFD_RELOC_C33_H: /* LABEL(31:19) */ /* NO USE : Absolute symbol */
  14257. + insn += ((value >> 19) & 0x1fff);
  14258. + break;
  14259. +
  14260. + case BFD_RELOC_C33_M: /* LABEL(18:6) */ /* NO USE : Absolute symbol */
  14261. + insn += ((value >> 6) & 0x1fff);
  14262. + break;
  14263. +
  14264. + case BFD_RELOC_C33_L: /* LABEL(5:0) */ /* NO USE : Absolute symbol */
  14265. + /* ld.w rd,LABEL@l */
  14266. + insn += (value & 0x3f) << 4;
  14267. + break;
  14268. +
  14269. + case BFD_RELOC_C33_LOOP: /* LABEL-PC(4:0) */
  14270. +
  14271. + /* over imm 5bit ? */
  14272. + iNumber = value;
  14273. +
  14274. + if (iNumber > 30 || iNumber < 0)
  14275. + as_bad_where (fixp->fx_file, fixp->fx_line, _("operand out of range"));
  14276. +
  14277. + /* " loop %rc,Label-2 " 表現は使用し辛いので、 "loop %rc,Label" を可能とするため-1する。 add T.Tazaki 2004/09/22 >>> */
  14278. + /* " nop " */
  14279. + /* " nop " */
  14280. + /* "Label: " */
  14281. +
  14282. + --value;
  14283. +
  14284. + /* add T.Tazaki 2004/09/22 <<< */
  14285. +
  14286. + /* imm5=imm(4:1) imm5(0)=0 */
  14287. + insn += (value & 0x1e) << 3;
  14288. + break;
  14289. +
  14290. + default:
  14291. + break;
  14292. + }
  14293. +
  14294. + bfd_putl16 ((bfd_vma) insn, (unsigned char *) where);
  14295. + }
  14296. + else if (fixp->fx_size == 4)
  14297. + bfd_putl32 (value, (unsigned char *) where);
  14298. + }
  14299. +
  14300. + fixp->fx_addnumber = value;
  14301. +
  14302. + return 1;
  14303. +}
  14304. +
  14305. +
  14306. +/* Parse a cons expression. */
  14307. +void
  14308. +parse_cons_expression_c33 (exp)
  14309. + expressionS * exp;
  14310. +{
  14311. + /* See if there's a reloc prefix like hi() we have to handle. */
  14312. + hold_cons_reloc = c33_reloc_prefix ();
  14313. +
  14314. + /* Do normal expression parsing. */
  14315. + expression (exp);
  14316. +}
  14317. +
  14318. +/* Create a fixup for a cons expression. If parse_cons_expression_c33
  14319. + found a reloc prefix, then we use that reloc, else we choose an
  14320. + appropriate one based on the size of the expression. */
  14321. +void
  14322. +cons_fix_new_c33 (frag, where, size, exp)
  14323. + fragS * frag;
  14324. + int where;
  14325. + int size;
  14326. + expressionS *exp;
  14327. +{
  14328. + if (hold_cons_reloc == BFD_RELOC_UNUSED)
  14329. + {
  14330. + if (size == 4)
  14331. + hold_cons_reloc = BFD_RELOC_32;
  14332. + if (size == 2)
  14333. + hold_cons_reloc = BFD_RELOC_16;
  14334. + if (size == 1)
  14335. + hold_cons_reloc = BFD_RELOC_8;
  14336. + }
  14337. +
  14338. + if (exp != NULL)
  14339. + fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc);
  14340. + else
  14341. + fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
  14342. +}
  14343. +
  14344. +boolean
  14345. +c33_fix_adjustable (fixP)
  14346. + fixS * fixP;
  14347. +{
  14348. + if (fixP->fx_addsy == NULL)
  14349. + return 1;
  14350. +
  14351. + /* Prevent all adjustments to global symbols. */
  14352. + if (S_IS_EXTERN (fixP->fx_addsy))
  14353. + return 0;
  14354. +
  14355. + if (S_IS_WEAK (fixP->fx_addsy))
  14356. + return 0;
  14357. +
  14358. + /* Don't adjust function names */
  14359. + if (S_IS_FUNCTION (fixP->fx_addsy))
  14360. + return 0;
  14361. +
  14362. + return 1;
  14363. +}
  14364. +
  14365. +int
  14366. +c33_force_relocation (fixP)
  14367. + struct fix * fixP;
  14368. +{
  14369. + if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
  14370. + return 1;
  14371. +
  14372. + return 0;
  14373. +}
  14374. diff --git a/gas/config/tc-c33.h b/gas/config/tc-c33.h
  14375. new file mode 100644
  14376. index 0000000..98e62d2
  14377. --- /dev/null
  14378. +++ b/gas/config/tc-c33.h
  14379. @@ -0,0 +1,78 @@
  14380. +/* tc-c33.h -- Header file for tc-c33.c.
  14381. + Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  14382. +
  14383. + This file is part of GAS, the GNU Assembler.
  14384. +
  14385. + GAS is free software; you can redistribute it and/or modify
  14386. + it under the terms of the GNU General Public License as published by
  14387. + the Free Software Foundation; either version 2, or (at your option)
  14388. + any later version.
  14389. +
  14390. + GAS is distributed in the hope that it will be useful,
  14391. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  14392. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14393. + GNU General Public License for more details.
  14394. +
  14395. + You should have received a copy of the GNU General Public License
  14396. + along with GAS; see the file COPYING. If not, write to the Free
  14397. + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  14398. + 02111-1307, USA. */
  14399. +
  14400. +#define TC_C33
  14401. +
  14402. +#include <elf/c33.h>
  14403. +
  14404. +#define TARGET_BYTES_BIG_ENDIAN 0
  14405. +
  14406. +#ifndef BFD_ASSEMBLER
  14407. + #error C33 support requires BFD_ASSEMBLER
  14408. +#endif
  14409. +
  14410. +/* The target BFD architecture. */
  14411. +#define TARGET_ARCH bfd_arch_c33
  14412. +
  14413. +/* The target BFD format. */
  14414. +#define TARGET_FORMAT "elf32-c33"
  14415. +
  14416. +#define MD_APPLY_FIX3
  14417. +
  14418. +#define md_operand(x)
  14419. +
  14420. +#define obj_fix_adjustable(fixP) c33_fix_adjustable(fixP)
  14421. +#define TC_FORCE_RELOCATION(fixp) c33_force_relocation(fixp)
  14422. +extern int c33_force_relocation PARAMS ((struct fix *));
  14423. +
  14424. +/* Permit temporary numeric labels. */
  14425. +#define LOCAL_LABELS_FB 1
  14426. +
  14427. +#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
  14428. +
  14429. +/* We don't need to handle .word strangely. */
  14430. +#define WORKING_DOT_WORD
  14431. +
  14432. +#define md_number_to_chars number_to_chars_littleendian
  14433. +
  14434. +/* We need to handle lo(), hi(), etc etc in .hword, .word, etc
  14435. + directives, so we have to parse "cons" expressions ourselves. */
  14436. +#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_cons_expression_c33 (EXP)
  14437. +#define TC_CONS_FIX_NEW cons_fix_new_c33
  14438. +extern const struct relax_type md_relax_table[];
  14439. +#define TC_GENERIC_RELAX_TABLE md_relax_table
  14440. +
  14441. +/* This section must be in the small data area (pointed to by GP). */
  14442. +#define SHF_C33_GPREL 0x10000000
  14443. +
  14444. +/* tazaki 2001.12.03 */
  14445. +#define ELF_TC_SPECIAL_SECTIONS \
  14446. + { ".comm", SHT_C33_COMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
  14447. + { ".gcomm", SHT_C33_GCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
  14448. + { ".scomm", SHT_C33_SCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
  14449. + { ".tcomm", SHT_C33_TCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
  14450. + { ".zcomm", SHT_C33_ZCOMM, SHF_ALLOC + SHF_WRITE + SHF_C33_GPREL }, \
  14451. +
  14452. +
  14453. +#define MD_PCREL_FROM_SECTION(fixP,section) c33_pcrel_from_section (fixP, section)
  14454. +extern long c33_pcrel_from_section ();
  14455. +
  14456. +#define LEX_PCT LEX_BEGIN_NAME /* %を有効にする */
  14457. +
  14458. diff --git a/gas/configure b/gas/configure
  14459. index 28f69be..d01eb3c 100755
  14460. --- a/gas/configure
  14461. +++ b/gas/configure
  14462. @@ -1641,6 +1641,7 @@ for this_target in $target $canon_targets ; do
  14463. sparc86x*) cpu_type=sparc arch=sparc86x ;;
  14464. sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
  14465. v850*) cpu_type=v850 ;;
  14466. + c33*) cpu_type=c33 ;;
  14467. *) cpu_type=${cpu} ;;
  14468. esac
  14469. @@ -1895,6 +1896,8 @@ EOF
  14470. tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
  14471. tic80-*-*) fmt=coff ;;
  14472. + c33-*-*) fmt=elf bfd_gas=yes ;;
  14473. +
  14474. v850-*-*) fmt=elf bfd_gas=yes ;;
  14475. v850e-*-*) fmt=elf bfd_gas=yes ;;
  14476. v850ea-*-*) fmt=elf bfd_gas=yes ;;
  14477. diff --git a/gas/configure.in b/gas/configure.in
  14478. index 1707acd..416e10e 100644
  14479. --- a/gas/configure.in
  14480. +++ b/gas/configure.in
  14481. @@ -119,6 +119,7 @@ changequote([,])dnl
  14482. sparc86x*) cpu_type=sparc arch=sparc86x ;;
  14483. sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
  14484. v850*) cpu_type=v850 ;;
  14485. + c33*) cpu_type=c33 ;;
  14486. *) cpu_type=${cpu} ;;
  14487. esac
  14488. diff --git a/gas/doc/Makefile.am b/gas/doc/Makefile.am
  14489. index c6eaf77..151e58f 100644
  14490. --- a/gas/doc/Makefile.am
  14491. +++ b/gas/doc/Makefile.am
  14492. @@ -34,6 +34,7 @@ CPU_DOCS = \
  14493. c-sparc.texi \
  14494. c-vax.texi \
  14495. c-v850.texi \
  14496. + c-c33.texi \
  14497. c-z8k.texi
  14498. gasver.texi: Makefile
  14499. diff --git a/gas/ext_remove.c b/gas/ext_remove.c
  14500. new file mode 100644
  14501. index 0000000..70f0d87
  14502. --- /dev/null
  14503. +++ b/gas/ext_remove.c
  14504. @@ -0,0 +1,2014 @@
  14505. +/* ext_remove.c - implementation for 2pass assemble.
  14506. + This program will remove redundant ext 0x0 instructions
  14507. + which emerge from memory load from LABEL/SYMBOLS or
  14508. + from function calls to LABEL/SYMBOLS
  14509. + Copyright (C) 2007 SEIKO EPSON CORP.
  14510. +
  14511. + Written by D.Fujimoto@Irumasoft
  14512. + DATE:2007/02/28
  14513. +
  14514. + This file is part of GAS, the GNU Assembler.
  14515. +
  14516. + GAS is free software; you can redistribute it and/or modify
  14517. + it under the terms of the GNU General Public License as published by
  14518. + the Free Software Foundation; either version 2, or (at your option)
  14519. + any later version.
  14520. +
  14521. + GAS is distributed in the hope that it will be useful,
  14522. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  14523. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14524. + GNU General Public License for more details.
  14525. +
  14526. + You should have received a copy of the GNU General Public License
  14527. + along with GAS; see the file COPYING. If not, write to the Free
  14528. + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  14529. + 02111-1307, USA.
  14530. +*/
  14531. +#include "as.h"
  14532. +#include "ext_remove.h"
  14533. +
  14534. +int g_c33_ext = 0; // flag indicating that -mc33ext option is specified
  14535. +
  14536. +int i_File_Inf_Flg = 0; // flag indicating that .file pseudo op exists in source file
  14537. + // 0 -- initial vaule
  14538. + // 1 -- ".file" exists.
  14539. +
  14540. +unsigned long g_dpAddress; // address of data pointer(used when no-medda32)
  14541. +
  14542. +// symbols information of current file
  14543. +unsigned long ul_Cur_File_Symbol_Cnt;
  14544. +struct cur_inf** stpp_Cur_Inf = 0;
  14545. +char *cp_Current_File_Name = 0; // pointer for current file name( include path )
  14546. +
  14547. +// symbols information of dump file
  14548. +unsigned long ul_Dump_Symbol_Cnt;
  14549. +struct dump_inf** stpp_Dump_Inf = 0;
  14550. +char *cp_Dump_File_Name = 0; // pointer for dump file name( include path )
  14551. +
  14552. +volatile unsigned long ul_All_Offset = 0; // offset(instruction counts) from all symbol
  14553. +unsigned char uc_Current_All_Symbol[INPUT_CUR_LINE_MAX] = { 0 }; // current symbol( local & global )
  14554. +unsigned char uc_Pre_All_Symbol[INPUT_CUR_LINE_MAX] = { 0 }; // pre symbol( local & global )
  14555. +
  14556. +
  14557. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  14558. +// symbols information of all object dump file
  14559. +unsigned long ul_All_Dump_Symbol_Cnt;
  14560. +struct dump_inf** stpp_All_Dump_Inf;
  14561. +char *cp_All_Dump_File_Name; // pointer for all objects' dump file name( include path )
  14562. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
  14563. +
  14564. +
  14565. +
  14566. +/*******************************************************************************************
  14567. +Format : unsigned long chg_str_to_val( unsigned char* ucp_chg_ptr );
  14568. +Input : unsigned char* ucp_chg_ptr -- pointer for string( hex code )
  14569. +Return : value converted from string
  14570. +Expnalantion: convert string to value
  14571. +*******************************************************************************************/
  14572. +unsigned long chg_str_to_val( unsigned char* ucp_chg_ptr )
  14573. +{
  14574. + unsigned long ul_ret;
  14575. +
  14576. + ul_ret = 0;
  14577. +
  14578. + while( 1 ){
  14579. + if( ( '0' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= '9' ) ){
  14580. + ul_ret <<= 4;
  14581. + ul_ret |= ( (*ucp_chg_ptr) - 0x30 );
  14582. + } else if( ( 'a' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= 'f' ) ){
  14583. + ul_ret <<= 4;
  14584. + ul_ret |= ( (*ucp_chg_ptr) - 0x57 );
  14585. + } else if( ( 'A' <= (*ucp_chg_ptr) ) && ( (*ucp_chg_ptr) <= 'F' ) ){
  14586. + ul_ret <<= 4;
  14587. + ul_ret |= ( (*ucp_chg_ptr) - 0x37 );
  14588. + } else {
  14589. + break;
  14590. + }
  14591. + ucp_chg_ptr++;
  14592. + }
  14593. +
  14594. + return ul_ret;
  14595. +}
  14596. +
  14597. +/*******************************************************************************************
  14598. +Format : void read_cur_file_info( char *cp_prm_file );
  14599. +Input : char *cp_prm_file -- pointer for current file
  14600. +Return : None
  14601. +Expnalantion: Read source file and get the symbol information of this file.
  14602. +*******************************************************************************************/
  14603. +void read_cur_file_info( char *cp_prm_file )
  14604. +{
  14605. + FILE *f_file;
  14606. + unsigned char uc_wk_buf[INPUT_CUR_LINE_MAX];
  14607. + unsigned char uc_buf[INPUT_CUR_LINE_MAX];
  14608. + unsigned char *ucp_wk;
  14609. + unsigned long ul_cnt;
  14610. + int i_ret,i_len,i_len_2;
  14611. + int i_stab_flg; // 0 -- normal
  14612. + // 1 -- during ".stabs" / ".stabn" line
  14613. +
  14614. + // First, empty reading is carried out and get the total of symbols.
  14615. + f_file = fopen (cp_prm_file, "r");
  14616. + if (f_file == NULL)
  14617. + {
  14618. + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
  14619. + xexit (EXIT_FAILURE);
  14620. + }
  14621. +
  14622. + ul_Cur_File_Symbol_Cnt = 0;
  14623. + i_stab_flg = 0;
  14624. + while( 1 ){
  14625. + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
  14626. + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
  14627. + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
  14628. + if( ucp_wk == 0 ){
  14629. + break;
  14630. + }
  14631. +
  14632. + i_len = strlen( uc_wk_buf );
  14633. + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
  14634. +
  14635. + if( i_stab_flg == 1 ){
  14636. + if( ucp_wk != 0 ){
  14637. + i_stab_flg = 0;
  14638. + }
  14639. + } else {
  14640. + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
  14641. + i_ret = chk_is_stab( uc_wk_buf );
  14642. + if( i_ret == 0 ){
  14643. + fprintf (stderr, _("Error : There are too many characters of one line in assembler source file.\n"));
  14644. + xexit (EXIT_FAILURE);
  14645. + }
  14646. + i_stab_flg = 1;
  14647. + } else {
  14648. + get_valid_string( uc_wk_buf,uc_buf );
  14649. + i_ret = get_label_info_from_src( uc_buf,uc_wk_buf );
  14650. + if( i_ret != 0 ){
  14651. + ul_Cur_File_Symbol_Cnt++;
  14652. + }
  14653. + }
  14654. + }
  14655. + }
  14656. +
  14657. + if( fclose (f_file) == EOF ){
  14658. + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
  14659. + xexit (EXIT_FAILURE);
  14660. + }
  14661. +
  14662. + // Create the heap area for unsigned char*.
  14663. + if( 0 < ul_Cur_File_Symbol_Cnt ){
  14664. + stpp_Cur_Inf = xmalloc( sizeof(struct cur_inf*) * ul_Cur_File_Symbol_Cnt );
  14665. + if( stpp_Cur_Inf == 0 ){
  14666. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  14667. + xexit (EXIT_FAILURE);
  14668. + }
  14669. + memset( stpp_Cur_Inf,0,( sizeof(struct cur_inf*) * ul_Cur_File_Symbol_Cnt ) );
  14670. +
  14671. + // heap for the pointer of each struct cur_inf
  14672. + for( ul_cnt = 0; ul_cnt < ul_Cur_File_Symbol_Cnt; ul_cnt++ ){
  14673. + *(stpp_Cur_Inf+ul_cnt) = xmalloc( sizeof(struct cur_inf) );
  14674. + if( *(stpp_Cur_Inf+ul_cnt) == 0 ){
  14675. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  14676. + xexit (EXIT_FAILURE);
  14677. + }
  14678. + memset( *(stpp_Cur_Inf+ul_cnt),0,( sizeof(struct cur_inf) ) );
  14679. + }
  14680. +
  14681. + // Second, file reopens and get symbol information.
  14682. + f_file = fopen (cp_prm_file, "r");
  14683. + if (f_file == NULL)
  14684. + {
  14685. + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
  14686. + xexit (EXIT_FAILURE);
  14687. + }
  14688. +
  14689. + ul_cnt = 0;
  14690. + i_stab_flg = 0;
  14691. + while( 1 ){
  14692. + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
  14693. + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
  14694. + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
  14695. + if( ucp_wk == 0 ){
  14696. + break;
  14697. + }
  14698. +
  14699. + i_len = strlen( uc_wk_buf );
  14700. + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
  14701. +
  14702. + if( i_stab_flg == 1 ){
  14703. + if( ucp_wk != 0 ){
  14704. + i_stab_flg = 0;
  14705. + }
  14706. + } else {
  14707. + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
  14708. + i_ret = chk_is_stab( uc_wk_buf );
  14709. + if( i_ret != 0 ){
  14710. + i_stab_flg = 1;
  14711. + }
  14712. + } else {
  14713. + get_valid_string( uc_wk_buf,uc_buf );
  14714. + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
  14715. + i_ret = get_label_info_from_src( uc_buf,uc_wk_buf );
  14716. + if( i_ret != 0 ){
  14717. + if( i_ret == 2 ){ // ".comm"
  14718. + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 1; // attribute is global
  14719. + }
  14720. +
  14721. + i_len = strlen( uc_wk_buf );
  14722. + (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name = xmalloc( i_len + 1 );
  14723. + if( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name == 0 ){
  14724. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  14725. + xexit (EXIT_FAILURE);
  14726. + }
  14727. + memset( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,0,( i_len + 1 ) );
  14728. + memcpy( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,uc_wk_buf,i_len );
  14729. +
  14730. + ul_cnt++;
  14731. + }
  14732. + }
  14733. + }
  14734. + }
  14735. +
  14736. + if( fclose (f_file) == EOF ){
  14737. + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
  14738. + xexit (EXIT_FAILURE);
  14739. + }
  14740. +
  14741. + // Third, file reopens and get attribute information.
  14742. + f_file = fopen (cp_prm_file, "r");
  14743. + if (f_file == NULL)
  14744. + {
  14745. + fprintf (stderr, _("Error : Can't open %s for reading.\n"),cp_prm_file);
  14746. + xexit (EXIT_FAILURE);
  14747. + }
  14748. +
  14749. + ul_cnt = 0;
  14750. + i_stab_flg = 0;
  14751. + while( 1 ){
  14752. + memset( uc_wk_buf,0,INPUT_CUR_LINE_MAX );
  14753. + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
  14754. + ucp_wk = fgets( uc_wk_buf, INPUT_CUR_LINE_MAX, f_file );
  14755. + if( ucp_wk == 0 ){
  14756. + break;
  14757. + }
  14758. +
  14759. + i_len = strlen( uc_wk_buf );
  14760. + ucp_wk = strpbrk( uc_wk_buf,"\r\n" );
  14761. +
  14762. + if( i_stab_flg == 1 ){
  14763. + if( ucp_wk != 0 ){
  14764. + i_stab_flg = 0;
  14765. + }
  14766. + } else {
  14767. + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
  14768. + i_ret = chk_is_stab( uc_wk_buf );
  14769. + if( i_ret != 0 ){
  14770. + i_stab_flg = 1;
  14771. + }
  14772. + } else {
  14773. + i_ret = get_attribute_info( uc_wk_buf,uc_buf );
  14774. + if( i_ret != 0 ){
  14775. + i_len_2 = strlen( uc_buf );
  14776. + for( ul_cnt = 0; ul_cnt < ul_Cur_File_Symbol_Cnt; ul_cnt++ ){
  14777. + i_len = strlen( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name );
  14778. + if( i_len == i_len_2 ){
  14779. + if( 0 == memcmp( (*(stpp_Cur_Inf + ul_cnt))->ucp_Symbol_Name,uc_buf,i_len ) ){
  14780. + if( i_ret == 1 ){
  14781. + // ".global"
  14782. + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 1;
  14783. + } else {
  14784. + // ".local"
  14785. + (*(stpp_Cur_Inf + ul_cnt))->i_Attribute = 0;
  14786. + }
  14787. + break;
  14788. + }
  14789. + }
  14790. + }
  14791. + }
  14792. + }
  14793. + }
  14794. + }
  14795. +
  14796. + if( fclose (f_file) == EOF ){
  14797. + fprintf (stderr, _("Error : Can't close %s\n"),cp_prm_file);
  14798. + xexit (EXIT_FAILURE);
  14799. + }
  14800. + }
  14801. +}
  14802. +
  14803. +
  14804. +/*******************************************************************************************
  14805. +Format : void get_valid_string( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt );
  14806. +Input : unsigned char *ucp_rd -- read pointer
  14807. + unsigned char *ucp_wt_pt -- write pointer
  14808. +Return : None
  14809. +Expnalantion: Read buffer and get the valid stirng.
  14810. + Comment / tab / space / cr・lf is excepted.
  14811. + The back of a label name is not gotten even if it is effective.
  14812. +*******************************************************************************************/
  14813. +void get_valid_string( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt )
  14814. +{
  14815. + while( 1 ){
  14816. + if( ( (*ucp_rd_pt) == '\t' ) || ( (*ucp_rd_pt) == ' ' ) ){
  14817. + // skip
  14818. + ;
  14819. + } else if ( ( (*ucp_rd_pt) == ';' ) || ( (*ucp_rd_pt) == '#' ) ) {
  14820. + // this is comment
  14821. + break;
  14822. + } else if ( ( (*ucp_rd_pt) == '\r' ) || ( (*ucp_rd_pt) == '\n' ) ) {
  14823. + // this is cr/lf
  14824. + break;
  14825. + } else {
  14826. + *ucp_wt_pt = *ucp_rd_pt;
  14827. + ucp_wt_pt++;
  14828. + if( (*ucp_rd_pt) == ':' ){
  14829. + // this is the end of label
  14830. + break;
  14831. + }
  14832. + }
  14833. + ucp_rd_pt++;
  14834. + }
  14835. +}
  14836. +
  14837. +
  14838. +/*******************************************************************************************
  14839. +Format : int get_label_info_from_src( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt );
  14840. +Input : unsigned char *uc_rd_pt -- pointer for read data
  14841. + unsigned char *uc_wt_pt -- pointer for write data
  14842. +Return : 0 -- normal
  14843. + 1 -- the contents of this buffer is label( "xxxx:" )
  14844. + 1 -- the contents of this buffer is label( ".comm" )
  14845. +Expnalantion: Read the buffer and check whether it is label.
  14846. + The key word is "xxxx:" or ".comm".
  14847. + If it is "xxxx:", ':' is replaced to '\0'.
  14848. + If it is ".commxxxxxx,n,n", it is replaced to "xxxxxx".
  14849. +*******************************************************************************************/
  14850. +int get_label_info_from_src( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt )
  14851. +{
  14852. + int i_ret,i_len,i_len_2;
  14853. +
  14854. + i_ret = 0;
  14855. +
  14856. + if( 0 == strchr( uc_rd_pt,'"' ) ){ // exclude if it contains '"'
  14857. +
  14858. + i_len = strlen( uc_rd_pt );
  14859. +
  14860. + if( 2 <= i_len ){ // the smalles pattern is "x:"
  14861. + if( uc_rd_pt[i_len-1] == ':' ){
  14862. + // "xxxx:"
  14863. + memcpy( uc_wt_pt,uc_rd_pt,i_len-1 );
  14864. + uc_wt_pt[i_len-1] = '\0';
  14865. + i_ret = 1;
  14866. + }
  14867. + }
  14868. +
  14869. + if( i_ret == 0 ){
  14870. + if( 5 <= i_len ){
  14871. + if( 0 == memcmp( ".comm",uc_rd_pt,5 ) ){
  14872. + // ".commxxxxxx,n,n"
  14873. + i_len_2 = strcspn( uc_rd_pt,"," );
  14874. + if( 0 < i_len_2 ){
  14875. + memcpy( uc_wt_pt,(uc_rd_pt+5),(i_len_2-5 ) );
  14876. + i_ret = 2;
  14877. + }
  14878. + }
  14879. + }
  14880. + }
  14881. + }
  14882. +
  14883. + return i_ret;
  14884. +}
  14885. +
  14886. +
  14887. +/*******************************************************************************************
  14888. +Format : int get_attribute_info( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt );
  14889. +Input : unsigned char *ucp_rd_pt -- pointer for read buffer
  14890. + unsigned char *ucp_wt_pt -- pointer for write buffer
  14891. +Return : 0 -- normal
  14892. + 1 -- the contents of read buffer is global label
  14893. + 2 -- the contents of read buffer is local label
  14894. +Expnalantion: Read the buffer and check whether it is global label.
  14895. + The key word is ".global" or ".local".
  14896. +*******************************************************************************************/
  14897. +int get_attribute_info( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt )
  14898. +{
  14899. + int i_ret;
  14900. + int i_chk_flg;
  14901. +
  14902. + i_ret = 0;
  14903. + i_chk_flg = 0;
  14904. + while( 1 ){
  14905. + if( ( (*ucp_rd_pt) == '\t' ) || ( (*ucp_rd_pt) == ' ' ) ){
  14906. + // skip
  14907. + ;
  14908. + } else if ( 0 == memcmp( ".global",ucp_rd_pt,7 ) ) {
  14909. + i_chk_flg = 1; // we find the key word
  14910. + ucp_rd_pt += 7;
  14911. +
  14912. + } else if ( 0 == memcmp( ".local",ucp_rd_pt,6 ) ) {
  14913. + i_chk_flg = 2; // we find the key word
  14914. + ucp_rd_pt += 6;
  14915. +
  14916. + } else if ( ( (*ucp_rd_pt) == '\r' ) || ( (*ucp_rd_pt) == '\n' ) ) {
  14917. + // this is cr/lf
  14918. + break;
  14919. + } else if ( ( (*ucp_rd_pt) == ';' ) || ( (*ucp_rd_pt) == '#' ) ) {
  14920. + // this is comment
  14921. + break;
  14922. + } else {
  14923. + if( i_chk_flg == 0 ){
  14924. + break;
  14925. + } else {
  14926. + *ucp_wt_pt = *ucp_rd_pt;
  14927. + ucp_wt_pt++;
  14928. + i_ret = i_chk_flg;
  14929. + }
  14930. + }
  14931. + ucp_rd_pt++;
  14932. + }
  14933. +
  14934. + return i_ret;
  14935. +}
  14936. +
  14937. +
  14938. +/*******************************************************************************************
  14939. +Format : void free_cur_info();
  14940. +Input : None
  14941. +Return : None
  14942. +Expnalantion: Free the heap area for the current file information.
  14943. +*******************************************************************************************/
  14944. +void free_cur_info()
  14945. +{
  14946. + unsigned long ul;
  14947. +
  14948. + if( stpp_Cur_Inf != 0 ){
  14949. +
  14950. + for( ul = 0; ul < ul_Cur_File_Symbol_Cnt; ul++ ){
  14951. +
  14952. + if( *(stpp_Cur_Inf+ul) != 0 ){
  14953. +
  14954. + if( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name != 0 ){
  14955. +
  14956. + // free member pointer
  14957. + free( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name );
  14958. + }
  14959. +
  14960. + // free the pointer of each struct cur_inf
  14961. + free( *(stpp_Cur_Inf+ul) );
  14962. + }
  14963. + }
  14964. +
  14965. + // free the pointer of the pointer of struct cur_inf
  14966. + free( stpp_Cur_Inf );
  14967. + stpp_Cur_Inf = 0;
  14968. + }
  14969. +}
  14970. +
  14971. +
  14972. +/*******************************************************************************************
  14973. +Format : void free_ext_heap_area();
  14974. +Input : None
  14975. +Return : None
  14976. +Expnalantion: Free the heap area for ext process.
  14977. +*******************************************************************************************/
  14978. +void free_ext_heap_area()
  14979. +{
  14980. + free_cur_info();
  14981. + free_dump_info();
  14982. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  14983. + free_all_dump_info();
  14984. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
  14985. +
  14986. +
  14987. +}
  14988. +
  14989. +
  14990. +/*******************************************************************************************
  14991. +Format : void read_dump_info( char* cp_dump_file_name,char* cp_out_file_name );
  14992. +Input : char* cp_dump_file_name -- dump file name( include path )
  14993. + char* cp_out_file_name -- output file name( include path )
  14994. +Return : None
  14995. +Expnalantion: Read the dump file, and get the symbol information which belongs current file
  14996. + and is local symbol only.
  14997. +*******************************************************************************************/
  14998. +void read_dump_info( char* cp_dump_file_name, char* cp_out_file_name )
  14999. +{
  15000. + #define INPUT_DUMP_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a dump file
  15001. +
  15002. + FILE *f_file;
  15003. + unsigned char uc_buf[INPUT_DUMP_LINE_MAX];
  15004. + int i_chk_sts; // 0 -- default
  15005. + // 1 -- check the file name
  15006. + // 2 -- get the area information and the symbol information
  15007. + unsigned char *ucp_wk;
  15008. + char* cp_out_file_pt;
  15009. + int i_cur_file_len;
  15010. + unsigned long ul_cnt;
  15011. + unsigned char uc_format_chk_buf[] = { "SYMBOL TABLE:" };
  15012. + int i_len,i_chk_cnt;
  15013. +
  15014. + cp_out_file_pt = strrchr( cp_out_file_name,'/' );
  15015. +
  15016. + if( cp_out_file_pt != 0 ){
  15017. + cp_out_file_pt++;
  15018. + } else {
  15019. + cp_out_file_pt = cp_out_file_name;
  15020. + }
  15021. + i_cur_file_len = strcspn( cp_out_file_pt,"." );
  15022. +
  15023. + // First, empty reading is carried out and get the total of symbols.
  15024. + // A format check is also performed.
  15025. + f_file = fopen (cp_dump_file_name, "r");
  15026. + if (f_file == NULL)
  15027. + {
  15028. + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
  15029. + xexit (EXIT_FAILURE);
  15030. + }
  15031. +
  15032. + ul_Dump_Symbol_Cnt = 0;
  15033. + i_chk_sts = 0;
  15034. + while( 1 ){
  15035. + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
  15036. + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
  15037. + if( ucp_wk == 0 ){
  15038. + break;
  15039. + }
  15040. +
  15041. + i_len = strlen( uc_buf );
  15042. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15043. + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
  15044. + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
  15045. + xexit (EXIT_FAILURE);
  15046. + }
  15047. +
  15048. + switch( i_chk_sts ){
  15049. + case 0:
  15050. + // *** check the dump file format ***
  15051. + i_len = strcspn( uc_buf,"\r\n" );
  15052. + if( i_len == 13 ){
  15053. + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
  15054. + i_chk_sts++;
  15055. + }
  15056. + }
  15057. + break;
  15058. + case 1:
  15059. + // *** check the file name ***
  15060. + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
  15061. + ucp_wk = strrchr( uc_buf,' ' );
  15062. + ucp_wk++;
  15063. + i_len = strcspn( ucp_wk,".\r\n" );
  15064. + if( i_cur_file_len == i_len ){
  15065. + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
  15066. + i_chk_sts++;
  15067. + }
  15068. + }
  15069. + }
  15070. + break;
  15071. + case 2:
  15072. + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
  15073. + if( uc_buf[9] == 'g' ){
  15074. + // *** global symbol only ***
  15075. + ul_Dump_Symbol_Cnt++;
  15076. + }
  15077. + i_chk_sts++;
  15078. + } else {
  15079. + // *** get the area information and the symbol information ***
  15080. + // *** cuurent local syombol & global symbol ***
  15081. + if( ( uc_buf[9] == 'l' ) || ( uc_buf[9] == 'g' ) ){
  15082. + ul_Dump_Symbol_Cnt++;
  15083. + }
  15084. + }
  15085. + break;
  15086. + case 3:
  15087. + if( uc_buf[9] == 'g' ){
  15088. + // *** global symbol only ***
  15089. + ul_Dump_Symbol_Cnt++;
  15090. + }
  15091. + break;
  15092. + default:
  15093. + ;
  15094. + break;
  15095. + }
  15096. + }
  15097. +
  15098. + if( i_chk_sts == 0 ){
  15099. + fprintf (stderr, _("Error : The format of the dump file is invalid.\n"));
  15100. + xexit (EXIT_FAILURE);
  15101. + }
  15102. +
  15103. + if( fclose (f_file) == EOF ){
  15104. + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
  15105. + xexit (EXIT_FAILURE);
  15106. + }
  15107. +
  15108. + if( 0 < ul_Dump_Symbol_Cnt ){
  15109. + // Second, file reopens and check whether there is any file of a same name.
  15110. + f_file = fopen (cp_dump_file_name, "r");
  15111. + if (f_file == NULL)
  15112. + {
  15113. + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
  15114. + xexit (EXIT_FAILURE);
  15115. + }
  15116. +
  15117. + i_chk_cnt = 0;
  15118. + while( 1 ){
  15119. + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
  15120. + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
  15121. + if( ucp_wk == 0 ){
  15122. + break;
  15123. + }
  15124. +
  15125. + i_len = strlen( uc_buf );
  15126. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15127. + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
  15128. + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
  15129. + xexit (EXIT_FAILURE);
  15130. + }
  15131. +
  15132. + // *** check the file name ***
  15133. + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
  15134. + ucp_wk = strrchr( uc_buf,' ' );
  15135. + ucp_wk++;
  15136. + i_len = strcspn( ucp_wk,".\r\n" );
  15137. + if( i_cur_file_len == i_len ){
  15138. + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
  15139. + i_chk_cnt++;
  15140. + }
  15141. + }
  15142. + }
  15143. + }
  15144. +
  15145. + if( fclose (f_file) == EOF ){
  15146. + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
  15147. + xexit (EXIT_FAILURE);
  15148. + }
  15149. +
  15150. + if( 1 < i_chk_cnt ){
  15151. + ul_Dump_Symbol_Cnt = 0;
  15152. + }
  15153. + }
  15154. +
  15155. + // Create the heap area for struct dump_inf.
  15156. + // heap for the pointer of the pointer of struct dump_inf
  15157. + if( 0 < ul_Dump_Symbol_Cnt ){
  15158. + stpp_Dump_Inf = xmalloc( sizeof(struct dump_inf*) * ul_Dump_Symbol_Cnt );
  15159. + if( stpp_Dump_Inf == 0 ){
  15160. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15161. + xexit (EXIT_FAILURE);
  15162. + }
  15163. + memset( stpp_Dump_Inf,0,( sizeof(struct dump_inf*) * ul_Dump_Symbol_Cnt ) );
  15164. +
  15165. + // heap for the pointer of each struct dump_inf
  15166. + for( ul_cnt = 0; ul_cnt < ul_Dump_Symbol_Cnt; ul_cnt++ ){
  15167. + *(stpp_Dump_Inf+ul_cnt) = xmalloc( sizeof(struct dump_inf) );
  15168. + if( *(stpp_Dump_Inf+ul_cnt) == 0 ){
  15169. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15170. + xexit (EXIT_FAILURE);
  15171. + }
  15172. + memset( *(stpp_Dump_Inf+ul_cnt),0,( sizeof(struct dump_inf) ) );
  15173. + }
  15174. +
  15175. +
  15176. + // Third, file reopens and get symbol information.
  15177. + f_file = fopen (cp_dump_file_name, "r");
  15178. + if (f_file == NULL)
  15179. + {
  15180. + fprintf (stderr, _("Error : Cannot find the dump file.\n"));
  15181. + xexit (EXIT_FAILURE);
  15182. + }
  15183. +
  15184. + i_chk_sts = 0;
  15185. + ul_cnt = 0;
  15186. + while( 1 ){
  15187. + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
  15188. + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
  15189. + if( ucp_wk == 0 ){
  15190. + break;
  15191. + }
  15192. +
  15193. + i_len = strlen( uc_buf );
  15194. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15195. + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
  15196. + fprintf (stderr, _("Error : There are too many characters of one line in dump file.\n"));
  15197. + xexit (EXIT_FAILURE);
  15198. + }
  15199. +
  15200. + switch( i_chk_sts ){
  15201. + case 0:
  15202. + // *** check the dump file format ***
  15203. + i_len = strcspn( uc_buf,"\r\n" );
  15204. + if( i_len == 13 ){
  15205. + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
  15206. + i_chk_sts++;
  15207. + }
  15208. + }
  15209. + break;
  15210. + case 1:
  15211. + // *** check the file name ***
  15212. + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
  15213. + ucp_wk = strrchr( uc_buf,' ' );
  15214. + ucp_wk++;
  15215. + i_len = strcspn( ucp_wk,".\r\n" );
  15216. + if( i_cur_file_len == i_len ){
  15217. + if( 0 == memcmp( cp_out_file_pt,ucp_wk,i_len ) ){
  15218. + i_chk_sts++;
  15219. + }
  15220. + }
  15221. + }
  15222. + break;
  15223. + case 2:
  15224. + if( 0 == memcmp( &(uc_buf[14]),"df",2 ) ){
  15225. + if( uc_buf[9] == 'g' ){
  15226. + // *** global symbol only ***
  15227. + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
  15228. + ul_cnt++;
  15229. + }
  15230. + i_chk_sts++;
  15231. + } else {
  15232. + // *** get the area information and the symbol information ***
  15233. + // *** cuurent local syombol & global symbol ***
  15234. + if( ( uc_buf[9] == 'l' ) || ( uc_buf[9] == 'g' ) ){
  15235. + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
  15236. + ul_cnt++;
  15237. + }
  15238. + }
  15239. + break;
  15240. + case 3:
  15241. + if( uc_buf[9] == 'g' ){
  15242. + // *** global symbol only ***
  15243. + get_label_info_from_dump( uc_buf,(stpp_Dump_Inf+ul_cnt) );
  15244. + ul_cnt++;
  15245. + }
  15246. + break;
  15247. + default:
  15248. + ;
  15249. + break;
  15250. + }
  15251. + }
  15252. +
  15253. + if( fclose (f_file) == EOF ){
  15254. + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
  15255. + xexit (EXIT_FAILURE);
  15256. + }
  15257. + }
  15258. +}
  15259. +
  15260. +
  15261. +/*******************************************************************************************
  15262. +Format : void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf );
  15263. +Input : unsigned char *ucp_rd_pt -- pointer for read data
  15264. + struct dump_inf **stpp_prm_dump_inf -- pointer of pointer for struct dump_inf
  15265. +Return : None
  15266. +Expnalantion: Read data and get the symbol information from dump file.
  15267. +*******************************************************************************************/
  15268. +void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf )
  15269. +{
  15270. + unsigned long ul_len;
  15271. + char* cp_pt;
  15272. +
  15273. + // address
  15274. + (*stpp_prm_dump_inf)->ul_Symbol_Addr = chg_str_to_val( &(ucp_rd_pt[0]) );
  15275. + // no address masking
  15276. +
  15277. + // attribute
  15278. + if( ucp_rd_pt[9] == 'g' ){
  15279. + (*stpp_prm_dump_inf)->i_Attribute = 1; // global
  15280. + } else {
  15281. + (*stpp_prm_dump_inf)->i_Attribute = 0; // local
  15282. + }
  15283. +
  15284. + // area
  15285. + ul_len = strcspn( &(ucp_rd_pt[17])," \t" );
  15286. + (*stpp_prm_dump_inf)->ucp_Area_Name = xmalloc( ul_len + 1 );
  15287. + if( (*stpp_prm_dump_inf)->ucp_Area_Name == 0 ){
  15288. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15289. + xexit (EXIT_FAILURE);
  15290. + }
  15291. + memset( (*stpp_prm_dump_inf)->ucp_Area_Name,0,( ul_len + 1 ) );
  15292. + memcpy( (*stpp_prm_dump_inf)->ucp_Area_Name, &(ucp_rd_pt[17]), ul_len );
  15293. +
  15294. + // symbol name
  15295. + cp_pt = strrchr( ucp_rd_pt,' ' );
  15296. + if( cp_pt != 0 ){
  15297. + cp_pt++;
  15298. + ul_len = strcspn( cp_pt,"\r\n" );
  15299. + (*stpp_prm_dump_inf)->ucp_Symbol_Name = xmalloc( ul_len + 1 );
  15300. + if( (*stpp_prm_dump_inf)->ucp_Symbol_Name == 0 ){
  15301. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15302. + xexit (EXIT_FAILURE);
  15303. + }
  15304. + memset( (*stpp_prm_dump_inf)->ucp_Symbol_Name,0,( ul_len + 1 ) );
  15305. + memcpy( (*stpp_prm_dump_inf)->ucp_Symbol_Name, cp_pt, ul_len );
  15306. + }
  15307. +
  15308. +/* >>>>> ADDED D.Fujimoto 2007/12/06 get address for .comm */
  15309. + // Special case:
  15310. + // for .comm areas, get the address from the 24rd column of dump file
  15311. + if (strcmp((*stpp_prm_dump_inf)->ucp_Area_Name, ".comm") == 0) {
  15312. + (*stpp_prm_dump_inf)->ul_Symbol_Addr = chg_str_to_val( &(ucp_rd_pt[24]) );
  15313. + }
  15314. +/* <<<<< ADDED D.Fujimoto 2007/12/06 get address for .comm */
  15315. +
  15316. +}
  15317. +
  15318. +
  15319. +/*******************************************************************************************
  15320. +Format : void free_dump_info();
  15321. +Input : None
  15322. +Return : None
  15323. +Expnalantion: Free the heap area for the dump file information.
  15324. +*******************************************************************************************/
  15325. +void free_dump_info()
  15326. +{
  15327. + unsigned long ul;
  15328. +
  15329. + if( stpp_Dump_Inf != 0 ){
  15330. +
  15331. + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
  15332. +
  15333. + if( *(stpp_Dump_Inf+ul) != 0 ){
  15334. +
  15335. + // free member pointer
  15336. + if( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name != 0 ){
  15337. + free( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
  15338. + }
  15339. + if( (*(stpp_Dump_Inf+ul))->ucp_Area_Name != 0 ){
  15340. + free( (*(stpp_Dump_Inf+ul))->ucp_Area_Name );
  15341. + }
  15342. +
  15343. + // free the pointer of each struct dump_inf
  15344. + free( *(stpp_Dump_Inf+ul) );
  15345. + }
  15346. + }
  15347. +
  15348. + // free the pointer of the pointer of struct dump_inf
  15349. + free( stpp_Dump_Inf );
  15350. + stpp_Dump_Inf = 0;
  15351. + }
  15352. +}
  15353. +
  15354. +
  15355. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  15356. +/*******************************************************************************************
  15357. +Format : void read_all_dump_info( char* cp_dump_file_name,char* cp_out_file_name );
  15358. +Input : char* cp_dump_file_name -- dump file name( include path )
  15359. + char* cp_out_file_name -- output file name( include path )
  15360. +Return : None
  15361. +Expnalantion: Read the dump file (for all object files), and get the symbol information into
  15362. + the stpp_All_Dump_Inf.
  15363. + This function is derived from read_dump_info().
  15364. + This function uses global symbols and ul_All_Dump_Symbol_Cnt
  15365. +*******************************************************************************************/
  15366. +void read_all_dump_info( char* cp_dump_file_name, char* cp_out_file_name )
  15367. +{
  15368. + #define INPUT_DUMP_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a dump file
  15369. +
  15370. + FILE *f_file;
  15371. + unsigned char uc_buf[INPUT_DUMP_LINE_MAX];
  15372. + int i_chk_sts; // 0 -- default
  15373. + // 1 -- check the file name
  15374. + // 2 -- get the area information and the symbol information
  15375. + unsigned char *ucp_wk;
  15376. + char* cp_out_file_pt;
  15377. + int i_cur_file_len;
  15378. + unsigned long ul_cnt;
  15379. + unsigned char uc_format_chk_buf[] = { "SYMBOL TABLE:" };
  15380. + int i_len,i_chk_cnt;
  15381. + enum CheckStatus status;
  15382. +
  15383. + cp_out_file_pt = strrchr( cp_out_file_name,'/' );
  15384. +
  15385. + if( cp_out_file_pt != 0 ){
  15386. + cp_out_file_pt++;
  15387. + } else {
  15388. + cp_out_file_pt = cp_out_file_name;
  15389. + }
  15390. + i_cur_file_len = strcspn( cp_out_file_pt,"." );
  15391. +
  15392. + // First, empty reading is carried out and get the total of symbols.
  15393. + // A format check is also performed.
  15394. + f_file = fopen (cp_dump_file_name, "r");
  15395. + if (f_file == NULL)
  15396. + {
  15397. + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n"));
  15398. + xexit (EXIT_FAILURE);
  15399. + }
  15400. +
  15401. + ul_All_Dump_Symbol_Cnt = 0;
  15402. + status = format;
  15403. + i_chk_sts = 0;
  15404. + while( 1 ){
  15405. + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
  15406. + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
  15407. + if( ucp_wk == 0 ){
  15408. + break;
  15409. + }
  15410. +
  15411. + i_len = strlen( uc_buf );
  15412. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15413. + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
  15414. + fprintf (stderr, _("Error : There are too many characters of one line in all objects\' dump file.\n"));
  15415. + xexit (EXIT_FAILURE);
  15416. + }
  15417. +
  15418. + switch( status ){
  15419. + case format:
  15420. + // *** check the dump file format ***
  15421. + i_len = strcspn( uc_buf,"\r\n" );
  15422. + if( i_len == 13 ){
  15423. + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
  15424. + i_chk_sts++; // format OK
  15425. + status = global;
  15426. + }
  15427. + }
  15428. + break;
  15429. + case global:
  15430. + if( uc_buf[9] == 'g' ){
  15431. + // *** global symbol only ***
  15432. + ul_All_Dump_Symbol_Cnt++;
  15433. + }
  15434. + break;
  15435. + default:
  15436. + // ignore the current line
  15437. + ;
  15438. + break;
  15439. + }
  15440. + }
  15441. +
  15442. + if( i_chk_sts == 0 ){
  15443. + fprintf (stderr, _("Error : The format of the all objects\' dump file is invalid.\n"));
  15444. + xexit (EXIT_FAILURE);
  15445. + }
  15446. +
  15447. + if( fclose (f_file) == EOF ){
  15448. + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
  15449. + xexit (EXIT_FAILURE);
  15450. + }
  15451. +
  15452. +
  15453. + // Create the heap area for struct dump_inf.
  15454. + // heap for the pointer of the pointer of struct dump_inf
  15455. + if( 0 < ul_All_Dump_Symbol_Cnt ){
  15456. + stpp_All_Dump_Inf = xmalloc( sizeof(struct dump_inf*) * ul_All_Dump_Symbol_Cnt );
  15457. + if( stpp_All_Dump_Inf == 0 ){
  15458. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15459. + xexit (EXIT_FAILURE);
  15460. + }
  15461. + memset( stpp_All_Dump_Inf,0,( sizeof(struct dump_inf*) * ul_All_Dump_Symbol_Cnt ) );
  15462. +
  15463. + // heap for the pointer of each struct dump_inf
  15464. + for( ul_cnt = 0; ul_cnt < ul_All_Dump_Symbol_Cnt; ul_cnt++ ){
  15465. + *(stpp_All_Dump_Inf+ul_cnt) = xmalloc( sizeof(struct dump_inf) );
  15466. + if( *(stpp_All_Dump_Inf+ul_cnt) == 0 ){
  15467. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15468. + xexit (EXIT_FAILURE);
  15469. + }
  15470. + memset( *(stpp_All_Dump_Inf+ul_cnt),0,( sizeof(struct dump_inf) ) );
  15471. + }
  15472. +
  15473. +
  15474. + // Second, file reopens and get symbol information.
  15475. + f_file = fopen (cp_dump_file_name, "r");
  15476. + if (f_file == NULL)
  15477. + {
  15478. + fprintf (stderr, _("Error : Cannot find the all objects\' dump file.\n"));
  15479. + xexit (EXIT_FAILURE);
  15480. + }
  15481. +
  15482. + status = format;
  15483. + i_chk_sts = 0;
  15484. + ul_cnt = 0;
  15485. + while( 1 ){
  15486. + memset( uc_buf,0,INPUT_DUMP_LINE_MAX );
  15487. + ucp_wk = fgets( uc_buf, INPUT_DUMP_LINE_MAX, f_file );
  15488. + if( ucp_wk == 0 ){
  15489. + break;
  15490. + }
  15491. +
  15492. + i_len = strlen( uc_buf );
  15493. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15494. + if( ( ucp_wk == 0 ) && ( ( INPUT_DUMP_LINE_MAX - 1 ) <= i_len ) ){
  15495. + fprintf (stderr, _("Error : There are too many characters of one line in all objects\' dump file.\n"));
  15496. + xexit (EXIT_FAILURE);
  15497. + }
  15498. +
  15499. + switch( status ){
  15500. + case format:
  15501. + // *** check the dump file format ***
  15502. + i_len = strcspn( uc_buf,"\r\n" );
  15503. + if( i_len == 13 ){
  15504. + if( 0 == memcmp( uc_buf,uc_format_chk_buf,13 ) ){
  15505. + i_chk_sts++; // format is OK
  15506. + status = global;
  15507. + }
  15508. + }
  15509. + break;
  15510. + case global:
  15511. + if( uc_buf[9] == 'g' ){
  15512. + // *** global symbol only ***
  15513. + get_label_info_from_dump( uc_buf,(stpp_All_Dump_Inf+ul_cnt) );
  15514. + ul_cnt++;
  15515. + }
  15516. + break;
  15517. + default:
  15518. + ;
  15519. + break;
  15520. + }
  15521. + }
  15522. +
  15523. + if( fclose (f_file) == EOF ){
  15524. + fprintf (stderr, _("Error : Can't close %s\n"),cp_dump_file_name);
  15525. + xexit (EXIT_FAILURE);
  15526. + }
  15527. + }
  15528. +}
  15529. +
  15530. +
  15531. +/*******************************************************************************************
  15532. +Format : void free_all_dump_info();
  15533. +Input : None
  15534. +Return : None
  15535. +Expnalantion: Free the heap area for the dump file information.
  15536. + Uses global symbols stpp_All_Dump_Inf and ul_All_Dump_Symbol_Cnt
  15537. +*******************************************************************************************/
  15538. +void free_all_dump_info()
  15539. +{
  15540. + unsigned long ul;
  15541. +
  15542. + if( stpp_All_Dump_Inf != 0 ){
  15543. +
  15544. + for( ul = 0; ul < ul_All_Dump_Symbol_Cnt; ul++ ){
  15545. +
  15546. + if( *(stpp_All_Dump_Inf+ul) != 0 ){
  15547. +
  15548. + // free member pointer
  15549. + if( (*(stpp_All_Dump_Inf+ul))->ucp_Symbol_Name != 0 ){
  15550. + free( (*(stpp_All_Dump_Inf+ul))->ucp_Symbol_Name );
  15551. + }
  15552. + if( (*(stpp_All_Dump_Inf+ul))->ucp_Area_Name != 0 ){
  15553. + free( (*(stpp_All_Dump_Inf+ul))->ucp_Area_Name );
  15554. + }
  15555. +
  15556. + // free the pointer of each struct dump_inf
  15557. + free( *(stpp_All_Dump_Inf+ul) );
  15558. + }
  15559. + }
  15560. +
  15561. + // free the pointer of the pointer of struct dump_inf
  15562. + free( stpp_All_Dump_Inf );
  15563. + stpp_All_Dump_Inf = 0;
  15564. + }
  15565. +}
  15566. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
  15567. +
  15568. +
  15569. +/*******************************************************************************************
  15570. +Format : void chk_is_file_inf( unsigned char *ucp_chk_file_pt );
  15571. +Input : unsigned char *ucp_chk_pt -- pointer for file name
  15572. +Return : None
  15573. +Expnalantion: Check whether ".file" exists from souce file.
  15574. +*******************************************************************************************/
  15575. +void chk_is_file_inf( unsigned char *ucp_chk_file_pt )
  15576. +{
  15577. + FILE *f_file;
  15578. + unsigned char uc_buf[INPUT_CUR_LINE_MAX];
  15579. + unsigned char *ucp_wk;
  15580. + int i_len;
  15581. + int i_ret;
  15582. + int i_stab_flg; // 0 -- normal
  15583. + // 1 -- during ".stabs" / ".stabn" line
  15584. +
  15585. + f_file = fopen (ucp_chk_file_pt, "r");
  15586. + if (f_file == NULL)
  15587. + {
  15588. + fprintf (stderr, _("Error : Can't open %s for reading.\n"),ucp_chk_file_pt);
  15589. + xexit (EXIT_FAILURE);
  15590. + }
  15591. +
  15592. + i_stab_flg = 0;
  15593. + while( 1 ){
  15594. + memset( uc_buf,0,INPUT_CUR_LINE_MAX );
  15595. + ucp_wk = fgets( uc_buf, INPUT_CUR_LINE_MAX, f_file );
  15596. + if( ucp_wk == 0 ){
  15597. + break;
  15598. + }
  15599. +
  15600. + i_len = strlen( uc_buf );
  15601. + ucp_wk = strpbrk( uc_buf,"\r\n" );
  15602. +
  15603. + if( i_stab_flg == 1 ){
  15604. + if( ucp_wk != 0 ){
  15605. + i_stab_flg = 0;
  15606. + }
  15607. + } else {
  15608. + if( ( ucp_wk == 0 ) && ( ( INPUT_CUR_LINE_MAX - 1 ) <= i_len ) ){
  15609. + i_ret = chk_is_stab( uc_buf );
  15610. + if( i_ret == 0 ){
  15611. + fprintf (stderr, _("Error : There are too many characters of one line in assembler source file.\n"));
  15612. + xexit (EXIT_FAILURE);
  15613. + }
  15614. + i_stab_flg = 1;
  15615. + } else {
  15616. + chk_is_file_inf_from_line( uc_buf );
  15617. + }
  15618. + }
  15619. + }
  15620. +
  15621. + if( fclose (f_file) == EOF ){
  15622. + fprintf (stderr, _("Error : Can't close %s\n"),ucp_chk_file_pt);
  15623. + xexit (EXIT_FAILURE);
  15624. + }
  15625. +}
  15626. +
  15627. +
  15628. +/*******************************************************************************************
  15629. +Format : void chk_is_file_inf( unsigned char *ucp_chk_pt );
  15630. +Input : unsigned char *ucp_chk_pt -- check pointer
  15631. +Return : None
  15632. +Expnalantion: Check whether ".file" exists from line.
  15633. + If ".file" exists, file name is set.
  15634. +*******************************************************************************************/
  15635. +void chk_is_file_inf_from_line( unsigned char *ucp_chk_pt )
  15636. +{
  15637. + if( i_File_Inf_Flg == 0 ){
  15638. + while( 1 ){
  15639. + if( ( (*ucp_chk_pt) == '\t' ) || ( (*ucp_chk_pt) == ' ' ) ){
  15640. + // skip
  15641. + ;
  15642. + } else if ( ( (*ucp_chk_pt) == ';' ) || ( (*ucp_chk_pt) == '#' ) ) {
  15643. + // this is comment
  15644. + break;
  15645. + } else if ( ( (*ucp_chk_pt) == '\r' ) || ( (*ucp_chk_pt) == '\n' ) ) {
  15646. + // this is cr/lf
  15647. + break;
  15648. + } else {
  15649. + if( 5 <= strlen( ucp_chk_pt ) ){
  15650. + if( 0 == memcmp( ucp_chk_pt,".file",5 ) ){
  15651. + i_File_Inf_Flg = 1;
  15652. + break;
  15653. + }
  15654. + } else {
  15655. + break;
  15656. + }
  15657. + }
  15658. + ucp_chk_pt++;
  15659. + }
  15660. + }
  15661. +}
  15662. +
  15663. +
  15664. +/*******************************************************************************************
  15665. +Format : int chk_is_stab( unsigned char *ucp_chk_pt );
  15666. +Input : unsigned char *ucp_chk_pt -- check pointer
  15667. +Return : 0 -- ".stabs" / ".stabn" doesn't exists.
  15668. + 1 -- ".stabs" / ".stabn" exists.
  15669. +Expnalantion: Check whether ".stabs" / ".stabn" exists.
  15670. +*******************************************************************************************/
  15671. +int chk_is_stab( unsigned char *ucp_chk_pt )
  15672. +{
  15673. + int i;
  15674. + int i_ret;
  15675. +
  15676. + i_ret = 0;
  15677. + for( i = 0; i < (INPUT_CUR_LINE_MAX - 1); i++ ){
  15678. + if( ( (*ucp_chk_pt) == '\t' ) || ( (*ucp_chk_pt) == ' ' ) ){
  15679. + // skip
  15680. + ;
  15681. + } else if ( ( (*ucp_chk_pt) == ';' ) || ( (*ucp_chk_pt) == '#' ) ) {
  15682. + // this is comment
  15683. + break;
  15684. + } else {
  15685. + if( 6 <= strlen( ucp_chk_pt ) ){
  15686. + if( ( 0 == memcmp( ucp_chk_pt,".stabs",6 ) )
  15687. + || ( 0 == memcmp( ucp_chk_pt,".stabn",6 ) ) ){
  15688. + i_ret = 1;
  15689. + break;
  15690. + }
  15691. + } else {
  15692. + break;
  15693. + }
  15694. + }
  15695. + ucp_chk_pt++;
  15696. + }
  15697. +
  15698. + return i_ret;
  15699. +}
  15700. +
  15701. +
  15702. +/*******************************************************************************************
  15703. +Format : void s_app_file_2 ();
  15704. +Input : None
  15705. +Return : None
  15706. +Expnalantion: ADD ".file" information to object file.
  15707. + If source file has already ".file" information, don't add it here.
  15708. +*******************************************************************************************/
  15709. +void s_app_file_2 ()
  15710. +{
  15711. + register char *s,*cp_wk;
  15712. +// int length;
  15713. + int may_omit;
  15714. + int appfile;
  15715. +
  15716. + int i_len;
  15717. + char *cp_file_name_pt = 0;
  15718. +
  15719. + if( i_File_Inf_Flg == 0 ){
  15720. + if( out_file_name != 0 ){
  15721. + if( 0 < strlen( out_file_name ) ){
  15722. + appfile = 0;
  15723. +
  15724. + /* Some assemblers tolerate immediately following '"' */
  15725. + // if ((s = demand_copy_string (&length)) != 0)
  15726. + // {
  15727. + // Get the file name from the "out_file_name".
  15728. + // And change extension to '*.s'.
  15729. + i_len = strlen( out_file_name );
  15730. + cp_file_name_pt = xmalloc( i_len + 1 );
  15731. + if( cp_file_name_pt == 0 ){
  15732. + fprintf (stderr, _("Error : Cannot allocate memory.\n"));
  15733. + xexit (EXIT_FAILURE);
  15734. + }
  15735. + memset( cp_file_name_pt,0,i_len + 1 );
  15736. + memcpy( cp_file_name_pt,out_file_name,i_len );
  15737. + s = strrchr( cp_file_name_pt,'/' );
  15738. + if( s != 0 ){
  15739. + s++;
  15740. + } else {
  15741. + s = cp_file_name_pt;
  15742. + }
  15743. + cp_wk = strrchr( s,'.' );
  15744. + if( cp_wk != 0 ){
  15745. + cp_wk++;
  15746. + (*cp_wk) = 's';
  15747. + cp_wk++;
  15748. + (*cp_wk) = 0;
  15749. + }
  15750. +
  15751. + /* If this is a fake .appfile, a fake newline was inserted into
  15752. + the buffer. Passing -2 to new_logical_line tells it to
  15753. + account for it. */
  15754. + may_omit= (! new_logical_line (s, appfile ? -2 : -1) && appfile);
  15755. +
  15756. + /* In MRI mode, the preprocessor may have inserted an extraneous
  15757. + backquote. */
  15758. + if (flag_m68k_mri
  15759. + && *input_line_pointer == '\''
  15760. + && is_end_of_line[(unsigned char) input_line_pointer[1]])
  15761. + ++input_line_pointer;
  15762. +
  15763. + // demand_empty_rest_of_line ();
  15764. +
  15765. + if (! may_omit)
  15766. + {
  15767. + #ifdef LISTING
  15768. + if (listing)
  15769. + listing_source_file (s);
  15770. + #endif
  15771. + register_dependency (s);
  15772. + #ifdef obj_app_file
  15773. + obj_app_file (s);
  15774. + #endif
  15775. + }
  15776. + // }
  15777. +
  15778. + if( cp_file_name_pt != 0 ){
  15779. + free( cp_file_name_pt );
  15780. + }
  15781. + }
  15782. + }
  15783. + }
  15784. +}
  15785. +
  15786. +/*******************************************************************************************
  15787. +Format : int reset_current_symbol(char *input_line_pointer);
  15788. +Input : char *input_line_pointer -- pointer for reading the source file
  15789. +Return : NONE
  15790. +Explanation : Reset the global variables if the ".section" changes.
  15791. +*******************************************************************************************/
  15792. +void reset_current_symbol(char *input_line_pointer)
  15793. +{
  15794. + // if ".section" is found,reset the "uc_Current_All_Symbol".
  15795. + if( 8 <= strlen( input_line_pointer ) ){
  15796. + if( 0 == memcmp( ".section",input_line_pointer,8 ) ){
  15797. + memset( uc_Current_All_Symbol,0,sizeof( uc_Current_All_Symbol ) );
  15798. + }
  15799. + }
  15800. +
  15801. +}
  15802. +
  15803. +/*******************************************************************************************
  15804. +Format : int update_current_symbol(char *input_line_pointer);
  15805. +Input : char *s -- label name
  15806. +Return : NONE
  15807. +Explanation : Check whether the label is local or global from the current file
  15808. + and saves it to the global variables.
  15809. +*******************************************************************************************/
  15810. +void update_current_symbol(char *s)
  15811. +{
  15812. + int i_ret; // return value of a function
  15813. + int i_len; // length of the label
  15814. +
  15815. + // Check whether the label is local or global from the current file only.
  15816. + i_ret = chk_global_label_2( s );
  15817. + if( i_ret == 1 ){
  15818. + i_len = strlen( s );
  15819. + }
  15820. +
  15821. + i_len = strlen( s );
  15822. + memset( uc_Current_All_Symbol,0,sizeof( uc_Current_All_Symbol ) );
  15823. + memcpy( uc_Current_All_Symbol,s,i_len );
  15824. +
  15825. +}
  15826. +
  15827. +
  15828. +/*******************************************************************************************
  15829. +Format : int evaluate_offset_from_symbol( void );
  15830. +Input : NONE
  15831. +Return : NONE
  15832. +Expnalantion: Save the current symbol to the previous symbol.
  15833. + Count up the offset from symbol if the current remains the same or,
  15834. + reset the offset from symbol if the current changes.
  15835. + Uses the following global vars
  15836. + uc_Current_All_Symbol
  15837. + uc_Pre_All_Symbol
  15838. + ul_All_Offset
  15839. +*******************************************************************************************/
  15840. +void evaluate_offset_from_symbol(void)
  15841. +{
  15842. +
  15843. + int i_len,i_len_2,i_chk_flg;
  15844. +
  15845. +
  15846. + // get the offset form all symbol
  15847. + i_chk_flg = 0;
  15848. + i_len = strlen( uc_Current_All_Symbol );
  15849. + i_len_2 = strlen( uc_Pre_All_Symbol );
  15850. + if( i_len == 0 ){
  15851. + i_chk_flg = 1;
  15852. + } else {
  15853. + if( i_len == i_len_2 ){
  15854. + if( 0 != memcmp( uc_Current_All_Symbol,uc_Pre_All_Symbol,i_len ) ){
  15855. + i_chk_flg = 1;
  15856. + }
  15857. + } else {
  15858. + i_chk_flg = 1;
  15859. + }
  15860. + }
  15861. +
  15862. + if( i_chk_flg == 0 ){
  15863. + // count up offset if the newest all symbol name is the same
  15864. + ul_All_Offset++; // count up the offset
  15865. + } else {
  15866. + ul_All_Offset = 0; // reset the offset
  15867. + }
  15868. +
  15869. + if( i_len != 0 ){
  15870. + memset( uc_Pre_All_Symbol,0,sizeof( uc_Pre_All_Symbol ) );
  15871. + memcpy( uc_Pre_All_Symbol,uc_Current_All_Symbol,i_len );
  15872. + } else {
  15873. + memset( uc_Pre_All_Symbol,0,sizeof( uc_Pre_All_Symbol ) );
  15874. + }
  15875. +
  15876. +}
  15877. +
  15878. +
  15879. +/*******************************************************************************************
  15880. +Format : int chk_global_label_2( char* cp_label_name );
  15881. +Input : char* cp_label_name -- pointer for label name
  15882. +Return : 0 -- local label
  15883. + 1 -- global label
  15884. +Expnalantion: Check whether the label is local or global from the current file only.
  15885. +*******************************************************************************************/
  15886. +int chk_global_label_2( char* cp_label_name )
  15887. +{
  15888. + int i_ret,i_len,i_len_2;
  15889. + unsigned long ul;
  15890. +
  15891. + // compare symbol name to the current file
  15892. + i_ret = 0; // local
  15893. + i_len = strlen( cp_label_name );
  15894. + for( ul = 0; ul < ul_Cur_File_Symbol_Cnt; ul++ ){
  15895. + i_len_2 = strlen( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name );
  15896. + if( i_len == i_len_2 ){
  15897. + if( 0 == memcmp( (*(stpp_Cur_Inf+ul))->ucp_Symbol_Name,cp_label_name,i_len ) ){
  15898. +
  15899. + // copy the attribute
  15900. + i_ret = (*(stpp_Cur_Inf+ul))->i_Attribute; // 0 -- local
  15901. + // 1 -- global
  15902. + break;
  15903. + }
  15904. + }
  15905. + }
  15906. +
  15907. + return i_ret;
  15908. +}
  15909. +
  15910. +
  15911. +/*******************************************************************************************
  15912. +Format : int chk_label_address_from_dump( char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address );
  15913. +Input : const char* cp_label_name -- pointer for label name
  15914. + offsetT off_offset -- offset from label address
  15915. + unsigned long *ulp_label_address -- pointer for label address
  15916. +Return : 0 -- don't get the address
  15917. + 1 -- get the address
  15918. +Expnalantion: Get the label address and add offset from the dump file.
  15919. + First compare the current local symbol, and if don't get the addresss,
  15920. + then compare the global symbol.
  15921. +*******************************************************************************************/
  15922. +int chk_label_address_from_dump( const char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address )
  15923. +{
  15924. + int i_ret,i_len,i_len_2;
  15925. + int i_attr; // 0 -- local
  15926. + // 1 -- global
  15927. + unsigned long ul;
  15928. +
  15929. + i_ret = 0;
  15930. + i_len = strlen( cp_label_name );
  15931. +
  15932. + // compare symbol name to the dump file
  15933. + for( i_attr = 0; i_attr < 2; i_attr++ ){
  15934. + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
  15935. + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
  15936. + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
  15937. + if( i_len == i_len_2 ){
  15938. + if( 0 == memcmp( cp_label_name,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
  15939. + i_ret = 1;
  15940. + *ulp_label_address = (*(stpp_Dump_Inf+ul))->ul_Symbol_Addr + off_offset;
  15941. + break;
  15942. + }
  15943. + }
  15944. + }
  15945. + }
  15946. + if( i_ret == 1 ){
  15947. + break;
  15948. + }
  15949. + }
  15950. +
  15951. + return i_ret;
  15952. +}
  15953. +
  15954. +
  15955. +/*******************************************************************************************
  15956. +Format : int chk_is_same_area_from_dump( unsigned char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 );
  15957. +Input : const char *ucp_chk_name_1 -- symbol name in expression
  15958. + unsigned char *ucp_chk_name_2 -- current local or global symbol
  15959. +Return : 0 -- area of check name 1 and check name 2 is not same
  15960. + or
  15961. + don't get the symbol information
  15962. + 1 -- area of check name 1 and check name 2 is same
  15963. +Expnalantion: Check whether area of check name 1 and check name 2 is same from the dump file.
  15964. + First compare the current local symbol, and if don't get the addresss,
  15965. + then compare the global symbol.
  15966. +*******************************************************************************************/
  15967. +int chk_is_same_area_from_dump( const char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 )
  15968. +{
  15969. + int i_ret;
  15970. + int i_len_1,i_len_2,i_chk_flg;
  15971. + int i_attr; // 0 -- local
  15972. + // 1 -- global
  15973. + unsigned char *ucp_area_1 = NULL;
  15974. + unsigned char *ucp_area_2 = NULL;
  15975. + unsigned long ul;
  15976. +
  15977. + i_ret = 0;
  15978. +
  15979. + // compare check name 1 to the dump file
  15980. + i_chk_flg = 0;
  15981. + i_len_1 = strlen( ucp_chk_name_1 );
  15982. + if( 0 < i_len_1 ){
  15983. + // compare symbol name to the dump file
  15984. + for( i_attr = 0; i_attr < 2; i_attr++ ){
  15985. + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
  15986. + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
  15987. + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
  15988. + if( i_len_1 == i_len_2 ){
  15989. + if( 0 == memcmp( ucp_chk_name_1,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
  15990. + i_chk_flg = 1;
  15991. + ucp_area_1 = (*(stpp_Dump_Inf+ul))->ucp_Area_Name;
  15992. + break;
  15993. + }
  15994. + }
  15995. + }
  15996. + }
  15997. + if( i_chk_flg == 1 ){
  15998. + break;
  15999. + }
  16000. + }
  16001. + }
  16002. +
  16003. + if( i_chk_flg == 1 ){
  16004. + // compare check name 2 to the dump file
  16005. + i_chk_flg = 0;
  16006. + i_len_1 = strlen( ucp_chk_name_2 );
  16007. + if( 0 < i_len_1 ){
  16008. + // compare symbol name to the dump file
  16009. + for( i_attr = 0; i_attr < 2; i_attr++ ){
  16010. + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
  16011. + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
  16012. + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
  16013. + if( i_len_1 == i_len_2 ){
  16014. + if( 0 == memcmp( ucp_chk_name_2,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
  16015. + i_chk_flg = 1;
  16016. + ucp_area_2 = (*(stpp_Dump_Inf+ul))->ucp_Area_Name;
  16017. + break;
  16018. + }
  16019. + }
  16020. + }
  16021. + }
  16022. + if( i_chk_flg == 1 ){
  16023. + break;
  16024. + }
  16025. + }
  16026. + }
  16027. + }
  16028. +
  16029. + if( i_chk_flg == 1 ){
  16030. + i_len_1 = strlen( ucp_area_1 );
  16031. + i_len_2 = strlen( ucp_area_2 );
  16032. + if( i_len_1 == i_len_2 ){
  16033. + if( 0 < i_len_1 ){
  16034. + if( 0 == memcmp( ucp_area_1,ucp_area_2,i_len_1 ) ){
  16035. + i_ret = 1;
  16036. + }
  16037. + }
  16038. + }
  16039. + }
  16040. + return i_ret;
  16041. +}
  16042. +
  16043. +
  16044. +/*******************************************************************************************
  16045. +Format : int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt );
  16046. +Input : unsigned long* ul_address -- pointer for save address
  16047. + unsigned long ul_tmp_cnt -- additional instruction(ext) counts for caluclating offset
  16048. +Return : 0 -- Address was not calculated.
  16049. + 1 -- Address was calculated.
  16050. +Expnalantion: Calculate the current address the form dump file and offset information.
  16051. + First compare the current local symbol, and if don't get the addresss,
  16052. + then compare the global symbol.
  16053. +*******************************************************************************************/
  16054. +int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt )
  16055. +{
  16056. + int i_ret;
  16057. + int i_len_1,i_len_2;
  16058. + int i_attr; // 0 -- local
  16059. + // 1 -- global
  16060. + unsigned long ul;
  16061. +
  16062. + i_ret = 0;
  16063. +
  16064. + i_len_1 = strlen( uc_Current_All_Symbol );
  16065. + if( 0 < i_len_1 ){
  16066. + // compare symbol name to the dump file
  16067. + for( i_attr = 0; i_attr < 2; i_attr++ ){
  16068. + for( ul = 0; ul < ul_Dump_Symbol_Cnt; ul++ ){
  16069. + if( (*(stpp_Dump_Inf+ul))->i_Attribute == i_attr ){ // current local symbol / global symbol
  16070. + i_len_2 = strlen( (*(stpp_Dump_Inf+ul))->ucp_Symbol_Name );
  16071. + if( i_len_1 == i_len_2 ){
  16072. + if( 0 == memcmp( uc_Current_All_Symbol,(*(stpp_Dump_Inf+ul))->ucp_Symbol_Name,i_len_2 ) ){
  16073. + i_ret = 1;
  16074. + *ul_address = (( ul_tmp_cnt + ul_All_Offset ) * 2) + (*(stpp_Dump_Inf+ul))->ul_Symbol_Addr;
  16075. + // no address masking
  16076. + break;
  16077. + }
  16078. + }
  16079. + }
  16080. + }
  16081. + if( i_ret == 1 ){
  16082. + break;
  16083. + }
  16084. + }
  16085. + }
  16086. +
  16087. + return i_ret;
  16088. +}
  16089. +
  16090. +
  16091. +/*******************************************************************************************
  16092. +Format : void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo)
  16093. +Input : char *symbolName the calculated address of a symbol
  16094. + struct dump_inf **pDumpInfo
  16095. + pointer to the global dump_inf pointer(stpp_Dump_Inf)
  16096. + the result will be stored in this parameter
  16097. +Return : NONE
  16098. +Expnalantion: Receives the pointer to dump info for symbolName
  16099. +*******************************************************************************************/
  16100. +void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo)
  16101. +{
  16102. + unsigned long i;
  16103. +
  16104. + struct dump_inf **pSearchDumpInfo = stpp_Dump_Inf;
  16105. + unsigned long symbolCount = ul_Dump_Symbol_Cnt;
  16106. +
  16107. + for (i = 0; i < symbolCount; i++) {
  16108. + if (strcmp(pSearchDumpInfo[i]->ucp_Symbol_Name, symbolName) == 0) {
  16109. + *pDumpInfo = pSearchDumpInfo[i];
  16110. + break;
  16111. + }
  16112. + }
  16113. +
  16114. +}
  16115. +
  16116. +
  16117. +/*******************************************************************************************
  16118. +Format : unsigned long getDataPointerAddress(char *dpSymbol)
  16119. +Input : char *dpSymbol the symbol for the data pointer
  16120. +Return : unsigned long address of data pointer
  16121. +Expnalantion: Returns the address of the data pointer.
  16122. + The symbol must exist in the dump file and be a global symbol,
  16123. + otherwise the value will be 0
  16124. +*******************************************************************************************/
  16125. +unsigned long getDataPointerAddress(char *dpSymbol)
  16126. +{
  16127. + unsigned long address = 0; // return value
  16128. + struct dump_inf *pDumpInfo = NULL;
  16129. +
  16130. + getSymbolInfo(dpSymbol, &pDumpInfo);
  16131. + if (pDumpInfo != NULL) {
  16132. + // get the address when the symbol is a global symbol
  16133. + if (pDumpInfo->i_Attribute == 1) {
  16134. + address = pDumpInfo->ul_Symbol_Addr;
  16135. + }
  16136. + }
  16137. +
  16138. + return address;
  16139. +
  16140. +}
  16141. +
  16142. +
  16143. +// ADD D.Fujimoto 2007/12/27 >>>>>
  16144. +/*******************************************************************************************
  16145. +Format : void countDuplicateSymbols(struct dump_inf **pDumpInfo, struct dump_inf **pAllDumpInfo, unsigned long symbolCount)
  16146. +Input : struct dump_inf **pAllDumpInfo
  16147. + pointer to the global dump_inf pointer (all object file dump).
  16148. + This will be used to check duplicate symbols
  16149. + unsigned long element count of *pAllDumpInfo
  16150. +Return : none
  16151. +Expnalantion: Count up the symbol occurence in stpp_Dump_Inf that appears in pAllDumpInfo.
  16152. + The count for pAllDumpInfo must be given as symbolCount.
  16153. + Global variable stpp_Dump_Inf is referenced here.
  16154. + Prior to calling this function, all elements of stpp_Dump_Inf[]->iCount should be 0
  16155. +*******************************************************************************************/
  16156. +void countDuplicateSymbols(struct dump_inf **pAllDumpInfo, unsigned long symbolCount)
  16157. +{
  16158. + unsigned long i;
  16159. + struct dump_inf *pDumpInfo = NULL;
  16160. +
  16161. + for (i = 0; i < symbolCount; i++) {
  16162. + // search for global symbols and match that with pDumpInfo
  16163. + if (pAllDumpInfo[i]->i_Attribute == 1) {
  16164. + getSymbolInfo(pAllDumpInfo[i]->ucp_Symbol_Name, &pDumpInfo);
  16165. +
  16166. + // count it up
  16167. + if (pDumpInfo != NULL) {
  16168. + if (pDumpInfo->i_Attribute == 1) {
  16169. + pDumpInfo->iCount++;
  16170. + }
  16171. + }
  16172. + }
  16173. + }
  16174. +
  16175. +}
  16176. +
  16177. +
  16178. +/*******************************************************************************************
  16179. +Format : int isDuplicateSymbol(char *symbolName)
  16180. +Input : char *symbolName
  16181. + symbolName to search from stpp_Dump_Inf
  16182. +Return : 1 = true, 0 = false
  16183. +Expnalantion: Search symbolName from stpp_Dump_Inf and check whether it is a duplicate.
  16184. + Duplicate symbols must not be used for ext insn optimization.
  16185. + Global variable stpp_Dump_Inf is referenced here.
  16186. +*******************************************************************************************/
  16187. +int isDuplicateSymbol(const char *symbolName)
  16188. +{
  16189. + int ret = 0;
  16190. + unsigned long i;
  16191. +
  16192. + struct dump_inf **pSearchDumpInfo = stpp_Dump_Inf;
  16193. + unsigned long symbolCount = ul_Dump_Symbol_Cnt;
  16194. +
  16195. + // duplicate when the global symbol count is more than 1
  16196. + for (i = 0; i < symbolCount; i++) {
  16197. + if (strcmp(pSearchDumpInfo[i]->ucp_Symbol_Name, symbolName) == 0 &&
  16198. + pSearchDumpInfo[i]->i_Attribute == 1 &&
  16199. + pSearchDumpInfo[i]->iCount > 1) {
  16200. + ret = 1;
  16201. + break;
  16202. + }
  16203. + }
  16204. +
  16205. + return ret;
  16206. +
  16207. +}
  16208. +// ADD D.Fujimoto 2007/12/27 <<<<<
  16209. +
  16210. +
  16211. +// ADD D.Fujimoto 2007/12/26 >>>>>
  16212. +/*******************************************************************************************
  16213. +Format : void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount)
  16214. +Input : struct dump_inf **pDumpInfo
  16215. + pointer to the global dump_inf pointer
  16216. + unsigned long element count of *pDumpInfo
  16217. +Return : none
  16218. +Expnalantion: Print symbols in struct dump_inf for debugging.
  16219. + The count for struct dump_inf must be given as symbolCount.
  16220. +*******************************************************************************************/
  16221. +void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount)
  16222. +{
  16223. + int i;
  16224. +
  16225. + for (i = 0; i < symbolCount; i++) {
  16226. + printf("%s\t%s\t0x%x", pDumpInfo[i]->ucp_Symbol_Name, pDumpInfo[i]->ucp_Area_Name, pDumpInfo[i]->ul_Symbol_Addr);
  16227. +
  16228. + printf("\t%s\n", (pDumpInfo[i]->i_Attribute == 1 ? "g" : "l"));
  16229. + }
  16230. +
  16231. +}
  16232. +// ADD D.Fujimoto 2007/12/26 <<<<<
  16233. +
  16234. +
  16235. +/*******************************************************************************************
  16236. +Format : int evaluate_ext_count(expressionS ex, ExtCountFunc pfunc)
  16237. +Input : expressionS ex expression of current line
  16238. + unsigned long dpAddress
  16239. + Address of data pointer(used when no medda32).
  16240. + Specify 0 when using medda32.
  16241. + ExtCountFunc pfunc function to count ext for the current line
  16242. +Return : The count of ext instructions,
  16243. + or MAX_EXT_INSN_CNT if maximum ext instructions should be added.
  16244. +Expnalantion: Evaluates the needed ext counts for this expression.
  16245. + The given function will determine the actual ext counts.
  16246. + The function pointer arg should not be NULL.
  16247. +*******************************************************************************************/
  16248. +int evaluate_ext_count(expressionS ex, unsigned long dpAddress, ExtCountFunc pfunc)
  16249. +{
  16250. + int i_ext_cnt = MAX_EXT_INSN_CNT; // return value
  16251. + int i_ret; // return values of the called functions
  16252. +
  16253. + unsigned long ul_address; // the address of the symbol
  16254. +
  16255. + if (pfunc == NULL) {
  16256. + abort();
  16257. + }
  16258. +
  16259. +// ADD D.Fujimoto 2008/01/07 >>>>>
  16260. + // skip counting for duplicate (c++) symbols
  16261. + if (isDuplicateSymbol(S_GET_NAME( ex.X_add_symbol ))) {
  16262. + return MAX_EXT_INSN_CNT;
  16263. + }
  16264. +// ADD D.Fujimoto 2008/01/07 <<<<<
  16265. +
  16266. + // get symbol address ( include formula )
  16267. + i_ret = chk_label_address_from_dump( S_GET_NAME( ex.X_add_symbol ),ex.X_add_number,&ul_address );
  16268. + if( i_ret == 1 ){
  16269. + // dp address is normally smaller than the symbol address
  16270. + ul_address = (ul_address >= dpAddress) ? ul_address - dpAddress : ul_address;
  16271. + i_ext_cnt = pfunc(ul_address); // call the apropriate ExtCountFunc
  16272. + }
  16273. +
  16274. + return i_ext_cnt;
  16275. +}
  16276. +
  16277. +
  16278. +/*******************************************************************************************
  16279. +Format : int count_ext_for_xld_rd_symbol(unsigned long address)
  16280. +Input : unsigned long address the calculated address of a symbol
  16281. +Return : The count of ext instructions,
  16282. + or MAX_EXT_INSN_CNT if it cannot be determined
  16283. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16284. + - xld.w %rd, LABEL
  16285. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16286. +*******************************************************************************************/
  16287. +int count_ext_for_xld_rd_symbol(unsigned long address)
  16288. +{
  16289. + int ext_count = MAX_EXT_INSN_CNT;
  16290. +
  16291. + if ( address <= 0x1F ) {
  16292. + // 0 - 0x1F
  16293. + ext_count = 0;
  16294. + } else if ( (0x20 <= address) && (address <= 0x3FFFF) ) {
  16295. + ext_count = 1;
  16296. + } else if ( (0x40000 <= address) && (address <= 0x7FFFF) ) {
  16297. + ext_count = 2;
  16298. + }
  16299. +
  16300. + return ext_count;
  16301. +}
  16302. +
  16303. +
  16304. +/*******************************************************************************************
  16305. +Format : int count_ext_for_xld_mem_rw(unsigned long address)
  16306. +Input : unsigned long address the calculated address of a symbol
  16307. +Return : The count of ext instructions,
  16308. + or MAX_EXT_INSN_CNT if it cannot be determined
  16309. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16310. + - xld.* %rd, [LABEL]
  16311. + - xld.* [LABEL], %rd
  16312. + - xb* [LABEL], imm3
  16313. + for STD, PE
  16314. + nomedda
  16315. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16316. +*******************************************************************************************/
  16317. +int count_ext_for_xld_mem_rw(unsigned long address)
  16318. +{
  16319. + int ext_count = MAX_EXT_INSN_CNT;
  16320. +
  16321. + if ( address <= 0x1FFF ) {
  16322. + // 0 - 0x1FFF
  16323. + ext_count = 1;
  16324. + }
  16325. +
  16326. + return ext_count;
  16327. +}
  16328. +
  16329. +
  16330. +/*******************************************************************************************
  16331. +Format : int count_ext_for_xld_mem_rw32(unsigned long address)
  16332. +Input : unsigned long address the calculated address of a symbol
  16333. +Return : The count of ext instructions,
  16334. + or MAX_EXT_INSN_CNT if it cannot be determined
  16335. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16336. + - xld.* %rd, [LABEL]
  16337. + - xld.* [LABEL], %rd
  16338. + - xb* [LABEL], imm3
  16339. + for STD, PE, ADV
  16340. + medda
  16341. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16342. +*******************************************************************************************/
  16343. +int count_ext_for_xld_mem_rw32(unsigned long address)
  16344. +{
  16345. + int ext_count = MAX_EXT_INSN_CNT;
  16346. +
  16347. + if ( address <= 0x1F ) {
  16348. + // 0 - 0x1F
  16349. + ext_count = 0;
  16350. + } else if ( (0x20 <= address) && (address <= 0x3FFFF) ) {
  16351. + ext_count = 1;
  16352. + }
  16353. +
  16354. + return ext_count;
  16355. +}
  16356. +
  16357. +
  16358. +/*******************************************************************************************
  16359. +Format : int count_ext_for_xld_mem_rw_adv(unsigned long address)
  16360. +Input : unsigned long address the calculated address of a symbol
  16361. +Return : The count of ext instructions,
  16362. + or MAX_EXT_INSN_CNT if it cannot be determined
  16363. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16364. + - xld.* %rd, [LABEL]
  16365. + - xld.* [LABEL], %rd
  16366. + for ADV
  16367. + nomedda
  16368. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16369. +*******************************************************************************************/
  16370. +int count_ext_for_xld_mem_rw_adv(unsigned long address)
  16371. +{
  16372. + int ext_count = MAX_EXT_INSN_CNT;
  16373. +
  16374. + if ( address <= 0x7FFFF ) {
  16375. + // 0x0 - 0x7FFFF
  16376. + ext_count = 1;
  16377. + }
  16378. +
  16379. + return ext_count;
  16380. +}
  16381. +
  16382. +
  16383. +/*******************************************************************************************
  16384. +Format : int count_ext_for_ald_mem_rw(unsigned long address)
  16385. +Input : unsigned long address the calculated address of a symbol
  16386. +Return : The count of ext instructions,
  16387. + or MAX_EXT_INSN_CNT if it cannot be determined
  16388. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16389. + - ald.* %rd, [LABEL]
  16390. + - ald.* [LABEL], %rd
  16391. + for ADV
  16392. + nomedda
  16393. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16394. +*******************************************************************************************/
  16395. +int count_ext_for_ald_mem_rw(unsigned long address)
  16396. +{
  16397. + int ext_count = MAX_EXT_INSN_CNT;
  16398. +
  16399. + if ( address <= 0x7FFFF ) {
  16400. + // 0x0 - 0x7FFFF
  16401. + ext_count = 1;
  16402. + }
  16403. +
  16404. + return ext_count;
  16405. +
  16406. +}
  16407. +
  16408. +
  16409. +/*******************************************************************************************
  16410. +Format : int count_ext_for_ald_mem_rw32(unsigned long address)
  16411. +Input : unsigned long address the calculated address of a symbol
  16412. +Return : The count of ext instructions,
  16413. + or MAX_EXT_INSN_CNT if it cannot be determined
  16414. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16415. + - ald.* %rd, [LABEL]
  16416. + - ald.* [LABEL], %rd
  16417. + for ADV
  16418. + medda
  16419. + This function is used as ExtCountFunc to be passed to evaluate_ext_count().
  16420. +*******************************************************************************************/
  16421. +int count_ext_for_ald_mem_rw32(unsigned long address)
  16422. +{
  16423. + int ext_count = MAX_EXT_INSN_CNT;
  16424. +
  16425. + if ( address <= 0x1F ) {
  16426. + // 0 - 0x1F
  16427. + ext_count = 0;
  16428. + } else if ( (0x20 <= address) && (address <= 0x7FFFF) ) {
  16429. + ext_count = 1;
  16430. + }
  16431. +
  16432. + return ext_count;
  16433. +
  16434. +}
  16435. +
  16436. +
  16437. +/*******************************************************************************************
  16438. +Format : int evaluate_ext_count_for_jumps(expressionS ex)
  16439. +Input : expressionS ex expression of current line
  16440. + : int addInstCount additional instruction(ext) counts for calculating address
  16441. + ExtCountFunc pfunc function to count ext for the current line
  16442. +Return : The count of ext instructions,
  16443. + or MAX_EXT_INSN_CNT if maximum ext instructions should be added.
  16444. +Expnalantion: Evaluates the needed ext counts for this expression(call and jp*).
  16445. + The given function will determine the actual ext counts.
  16446. + The function pointer arg should not be NULL.
  16447. +*******************************************************************************************/
  16448. +int evaluate_ext_count_for_jumps(expressionS ex, int addInstCount, ExtCountJumpFunc pfunc)
  16449. +{
  16450. +
  16451. + int i_ext_cnt = MAX_EXT_INSN_CNT; // return value
  16452. + int i_ret; // return values of the called functions
  16453. +
  16454. + unsigned long ul_dst_address; // address of the LABEL(operand)
  16455. + unsigned long ul_src_address; // address of the instruction
  16456. +
  16457. + if (pfunc == NULL) {
  16458. + abort();
  16459. + }
  16460. +
  16461. +// ADD D.Fujimoto 2008/01/07 >>>>>
  16462. + // skip counting for duplicate (c++) symbols
  16463. + if (isDuplicateSymbol(S_GET_NAME( ex.X_add_symbol ))) {
  16464. + return MAX_EXT_INSN_CNT;
  16465. + }
  16466. +// ADD D.Fujimoto 2008/01/07 <<<<<
  16467. +
  16468. + // get symbol address ( include formula )
  16469. + i_ret = chk_label_address_from_dump( S_GET_NAME( ex.X_add_symbol ),ex.X_add_number,&ul_dst_address );
  16470. + if( i_ret == 1 ){
  16471. + // check whether area is same
  16472. + i_ret = chk_is_same_area_from_dump( S_GET_NAME( ex.X_add_symbol ),uc_Current_All_Symbol );
  16473. + if( i_ret == 1 ){
  16474. + i_ret = clc_cur_address_from_dump( &ul_src_address, addInstCount ); // get current_address
  16475. + if( i_ret == 1 ){
  16476. + i_ext_cnt = pfunc(ul_dst_address, ul_src_address); // call the apropriate ExtCountFunc
  16477. + }
  16478. + }
  16479. + }
  16480. +
  16481. + return i_ext_cnt;
  16482. +
  16483. +}
  16484. +
  16485. +
  16486. +/*******************************************************************************************
  16487. +Format : int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress)
  16488. +Input : unsigned long dstAddress the calculated address of a symbol
  16489. + unsigned long srcAddress the calculated address of the instruction
  16490. +Return : The count of ext instructions,
  16491. + or MAX_EXT_INSN_CNT if it cannot be determined
  16492. +Expnalantion: Evaluates the needed ext counts for reaching the given address for patterns:
  16493. + - scall LABEL
  16494. + - xcall LABEL
  16495. + - sj* LABEL
  16496. + - xj* LABEL
  16497. + This function is used as ExtCountJumpFunc
  16498. + to be passed to evaluate_ext_count_for_jumps().
  16499. +*******************************************************************************************/
  16500. +int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress)
  16501. +{
  16502. + int ext_count = MAX_EXT_INSN_CNT;
  16503. + long distance;
  16504. +
  16505. + // distance may be negative
  16506. + distance = (long) (dstAddress - srcAddress);
  16507. + if ( ( -256 <= distance ) && ( distance <= 254 ) ) {
  16508. + ext_count = 0;
  16509. + } else if ( ((-2097152 <= distance) && (distance < -256)) ||
  16510. + ((254 < distance) && (distance <= 2097150)) ) {
  16511. + ext_count = 1;
  16512. + } else if ( (distance < -2097152) || (2097150 < distance) ) {
  16513. + ext_count = 2;
  16514. + }
  16515. +
  16516. + return ext_count;
  16517. +
  16518. +}
  16519. diff --git a/gas/ext_remove.h b/gas/ext_remove.h
  16520. new file mode 100644
  16521. index 0000000..261faad
  16522. --- /dev/null
  16523. +++ b/gas/ext_remove.h
  16524. @@ -0,0 +1,176 @@
  16525. +/* ext_remove.h - header file for 2pass assemble.
  16526. + This program will remove redundant ext 0x0 instructions
  16527. + which emerge from memory load from LABEL/SYMBOLS or
  16528. + from function calls to LABEL/SYMBOLS
  16529. + Copyright (C) 2007 SEIKO EPSON CORP.
  16530. +
  16531. + Written by D.Fujimoto@Irumasoft
  16532. + DATE:2007/02/28
  16533. +
  16534. + This file is part of GAS, the GNU Assembler.
  16535. +
  16536. + GAS is free software; you can redistribute it and/or modify
  16537. + it under the terms of the GNU General Public License as published by
  16538. + the Free Software Foundation; either version 2, or (at your option)
  16539. + any later version.
  16540. +
  16541. + GAS is distributed in the hope that it will be useful,
  16542. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  16543. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16544. + GNU General Public License for more details.
  16545. +
  16546. + You should have received a copy of the GNU General Public License
  16547. + along with GAS; see the file COPYING. If not, write to the Free
  16548. + Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  16549. + 02111-1307, USA.
  16550. +*/
  16551. +#ifndef __EXT_REMOVE_H__
  16552. +#define __EXT_REMOVE_H__
  16553. +
  16554. +//////////////////////////////////////////
  16555. +// Macro definitions
  16556. +#define EXT_REMOVE // the ext remove feature is alive where this macro appears
  16557. + // in other source files
  16558. +
  16559. +#define INPUT_CUR_LINE_MAX (0x800 + 1) // the maximum number of characters per one line of a current file
  16560. +
  16561. +#define DATA_POINTER_SYMBOL "__dp" // symbol representing data pointer
  16562. +
  16563. +#define MAX_EXT_INSN_CNT (-1) // default return value for evaluate_ext_count() and related functions
  16564. +
  16565. +//////////////////////////////////////////
  16566. +// Structure declarations
  16567. +typedef struct cur_inf
  16568. +{
  16569. + unsigned char* ucp_Symbol_Name; // pointer for symbol name
  16570. + int i_Attribute; // 0 -- local
  16571. + // 1 -- global
  16572. +} cur_inf;
  16573. +
  16574. +struct dump_inf
  16575. +{
  16576. + unsigned char* ucp_Symbol_Name; // pointer for symbol name ( cuurent local symbol & global symbol )
  16577. + unsigned long ul_Symbol_Addr; // address where symbol name is placed
  16578. + unsigned char* ucp_Area_Name; // pointer for area name in which symbol name belongs
  16579. + int i_Attribute; // 0 -- local
  16580. + // 1 -- global
  16581. + int iCount; // symbol occurence ADD D.Fujimoto 2007/12/27
  16582. + // symbols that are found more than 1 should not be used for ext optimization
  16583. +};
  16584. +
  16585. +
  16586. +//////////////////////////////////////////
  16587. +// Enum declarations
  16588. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  16589. +enum CheckStatus {format, filename, local_global, global}; // used in read_all_dump_info()
  16590. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<
  16591. +
  16592. +////////////////////////////////////////////
  16593. +// Global variables
  16594. +
  16595. +extern int g_c33_ext; // flag indicating that -mc33ext option is specified
  16596. + // 0=not specified, 1=-mc33ext specified
  16597. +
  16598. +extern int i_File_Inf_Flg ; // 0 -- initial vaule
  16599. + // 1 -- ".file" exists.
  16600. +
  16601. +extern unsigned long g_dpAddress; // address of data pointer(used when no-medda32)
  16602. +
  16603. +// symbols information of current file
  16604. +extern unsigned long ul_Cur_File_Symbol_Cnt;
  16605. +extern struct cur_inf** stpp_Cur_Inf;
  16606. +extern char *cp_Current_File_Name; // pointer for current file name( include path )
  16607. +
  16608. +// symbols information of dump file
  16609. +extern unsigned long ul_Dump_Symbol_Cnt;
  16610. +extern struct dump_inf** stpp_Dump_Inf;
  16611. +extern char *cp_Dump_File_Name; // pointer for dump file name( include path )
  16612. +
  16613. +// variables for symbol offset calculation
  16614. +extern volatile unsigned long ul_All_Offset; // offset(instruction counts) from all symbol
  16615. +extern unsigned char uc_Current_All_Symbol[INPUT_CUR_LINE_MAX]; // current symbol( local & global )
  16616. +extern unsigned char uc_Pre_All_Symbol[INPUT_CUR_LINE_MAX]; // pre symbol( local & global )
  16617. +
  16618. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  16619. +// symbols information of all object dump file
  16620. +extern unsigned long ul_All_Dump_Symbol_Cnt;
  16621. +extern struct dump_inf** stpp_All_Dump_Inf; // only global symbols will be stored
  16622. +extern char *cp_All_Dump_File_Name; // pointer for dump file name( include path )
  16623. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
  16624. +
  16625. +
  16626. +//////////////////////////////////////////
  16627. +// Function prototypes
  16628. +unsigned long chg_str_to_val PARAMS (( unsigned char* ucp_chg_ptr ));
  16629. +
  16630. +void read_cur_file_info PARAMS(( char *cp_prm_file ));
  16631. +
  16632. +void get_valid_string PARAMS(( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt ));
  16633. +int get_label_info_from_src PARAMS(( unsigned char *uc_rd_pt,unsigned char *uc_wt_pt ));
  16634. +int get_attribute_info PARAMS(( unsigned char *ucp_rd_pt,unsigned char *ucp_wt_pt ));
  16635. +
  16636. +void free_cur_info PARAMS(());
  16637. +void free_ext_heap_area PARAMS(());
  16638. +
  16639. +void read_dump_info( char* cp_dump_file_name, char* cp_out_file_name );
  16640. +void get_label_info_from_dump( unsigned char *ucp_rd_pt,struct dump_inf **stpp_prm_dump_inf );
  16641. +void free_dump_info();
  16642. +
  16643. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file >>>>>
  16644. +void read_all_dump_info( char* cp_dump_file_name, char* cp_out_file_name );
  16645. +void free_all_dump_info();
  16646. +// ADD D.Fujimoto 2007/12/26 for all 1pass objects' dump file <<<<<
  16647. +
  16648. +void chk_is_file_inf( unsigned char *ucp_chk_file_pt );
  16649. +void chk_is_file_inf_from_line( unsigned char *ucp_chk_pt );
  16650. +int chk_is_stab( unsigned char *ucp_chk_pt );
  16651. +
  16652. +
  16653. +void s_app_file_2 (); // append .file pseudo op
  16654. +void reset_current_symbol(char *input_line_pointer);
  16655. +void update_current_symbol(char *s);
  16656. +
  16657. +int chk_global_label_2 PARAMS (( char* cp_label_name ));
  16658. +
  16659. +int chk_label_address_from_dump( const char* cp_label_name,offsetT off_offset,unsigned long *ulp_label_address );
  16660. +int chk_is_same_area_from_dump( const char *ucp_chk_name_1,unsigned char *ucp_chk_name_2 );
  16661. +int clc_cur_address_from_dump( unsigned long* ul_address,unsigned long ul_tmp_cnt );
  16662. +
  16663. +void getSymbolInfo(char *symbolName, struct dump_inf **pDumpInfo);
  16664. +unsigned long getDataPointerAddress(char *dataPointerSymbol);
  16665. +
  16666. +// ADD D.Fujimoto 2007/12/27 >>>>>
  16667. +void countDuplicateSymbols(struct dump_inf **pAllDumpInfo, unsigned long symbolCount);
  16668. +int isDuplicateSymbol(const char *symbolName);
  16669. +// ADD D.Fujimoto 2007/12/27 <<<<<
  16670. +
  16671. +// ADD D.Fujimoto 2007/12/26 >>>>>
  16672. +void printDumpInf(struct dump_inf **pDumpInfo, unsigned long symbolCount); // print symbols for debugging
  16673. +// ADD D.Fujimoto 2007/12/26 <<<<<
  16674. +void evaluate_offset_from_symbol(void); // reset or increment the offset from symbol
  16675. +
  16676. +
  16677. +// function pointer for ext counter functions
  16678. +typedef int (*ExtCountFunc)(unsigned long address);
  16679. +
  16680. +int evaluate_ext_count(expressionS ex, unsigned long dpAddress, ExtCountFunc pfunc); // ext counter for mem read/write expressions
  16681. +
  16682. +// some ExtCountFuncs
  16683. +int count_ext_for_xld_rd_symbol(unsigned long address);
  16684. +int count_ext_for_xld_mem_rw(unsigned long address);
  16685. +int count_ext_for_xld_mem_rw32(unsigned long address);
  16686. +int count_ext_for_xld_mem_rw_adv(unsigned long address);
  16687. +int count_ext_for_ald_mem_rw(unsigned long address);
  16688. +int count_ext_for_ald_mem_rw32(unsigned long address);
  16689. +
  16690. +
  16691. +// function pointer for ext counter functions
  16692. +typedef int (*ExtCountJumpFunc)(unsigned long dstAddress, unsigned long srcAddress);
  16693. +
  16694. +int evaluate_ext_count_for_jumps(expressionS ex, int addInstCount, ExtCountJumpFunc pfunc); // ext counter for call/jp expressions
  16695. +
  16696. +// some ExtCountJumpFuncs
  16697. +int count_ext_for_jumps(unsigned long dstAddress, unsigned long srcAddress);
  16698. +
  16699. +
  16700. +#endif // __EXT_REMOVE_H__
  16701. diff --git a/gas/input-scrub.c b/gas/input-scrub.c
  16702. index ecbdaef..d0ce9e7 100644
  16703. --- a/gas/input-scrub.c
  16704. +++ b/gas/input-scrub.c
  16705. @@ -417,6 +417,13 @@ seen_at_least_1_file () /* TRUE if we opened any file. */
  16706. {
  16707. return (physical_input_file != NULL);
  16708. }
  16709. +/* add T.Tazaki 2002.02.05 >>> */
  16710. +line_numberT
  16711. +get_physical_input_line()
  16712. +{
  16713. + return physical_input_line;
  16714. +}
  16715. +/* add T.Tazaki 2002.02.05 <<< */
  16716. void
  16717. bump_line_counters ()
  16718. @@ -468,23 +475,33 @@ new_logical_line (fname, line_number)
  16719. * namep should be char * const *, but there are compilers which screw
  16720. * up declarations like that, and it's easier to avoid it.
  16721. */
  16722. +
  16723. +
  16724. +/* >>> add T.Tazaki 2002.03.04 */
  16725. +extern char *c33_original_input_file;
  16726. +/* <<< add T.Tazaki 2002.03.04 */
  16727. +
  16728. void
  16729. as_where (namep, linep)
  16730. char **namep;
  16731. unsigned int *linep;
  16732. {
  16733. +
  16734. + /* */
  16735. +
  16736. +
  16737. if (logical_input_file != NULL
  16738. && (linep == NULL || logical_input_line >= 0))
  16739. {
  16740. - *namep = logical_input_file;
  16741. + *namep = logical_input_file;
  16742. if (linep != NULL)
  16743. *linep = logical_input_line;
  16744. }
  16745. else if (physical_input_file != NULL)
  16746. {
  16747. - *namep = physical_input_file;
  16748. + *namep = physical_input_file;
  16749. if (linep != NULL)
  16750. - *linep = physical_input_line;
  16751. + *linep = physical_input_line;
  16752. }
  16753. else
  16754. {
  16755. @@ -492,6 +509,14 @@ as_where (namep, linep)
  16756. if (linep != NULL)
  16757. *linep = 0;
  16758. }
  16759. +
  16760. + /* >>> add T.Tazaki 2002.03.04 */
  16761. + /* input file name pointer set */
  16762. + if( *c33_original_input_file != NULL ){
  16763. + *namep = c33_original_input_file; /* cpp :# 1 "sample.s" */
  16764. + }
  16765. + /* <<< add T.Tazaki 2002.03.04 */
  16766. +
  16767. } /* as_where() */
  16768. diff --git a/gas/read.c b/gas/read.c
  16769. index 1522842..db40169 100644
  16770. --- a/gas/read.c
  16771. +++ b/gas/read.c
  16772. @@ -20,11 +20,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  16773. 02111-1307, USA. */
  16774. #if 0
  16775. -#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
  16776. - change this a bit. But then, GNU isn't
  16777. - spozed to run on your machine anyway.
  16778. - (RMS is so shortsighted sometimes.)
  16779. - */
  16780. +#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
  16781. + change this a bit. But then, GNU isn't
  16782. + spozed to run on your machine anyway.
  16783. + (RMS is so shortsighted sometimes.)
  16784. + */
  16785. #else
  16786. #define MASK_CHAR ((int)(unsigned char)-1)
  16787. #endif
  16788. @@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  16789. #include "obstack.h"
  16790. #include "listing.h"
  16791. #include "ecoff.h"
  16792. +#include "ext_remove.h" // add D.Fujimoto 2007/02/28
  16793. #ifndef TC_START_LABEL
  16794. #define TC_START_LABEL(x,y) (x==':')
  16795. @@ -76,7 +77,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  16796. #define NOP_OPCODE 0x00
  16797. #endif
  16798. -char *input_line_pointer; /*->next char of source file to parse. */
  16799. +char *input_line_pointer; /*->next char of source file to parse. */
  16800. #if BITS_PER_CHAR != 8
  16801. /* The following table is indexed by[(char)] and will break if
  16802. @@ -121,13 +122,13 @@ die horribly;
  16803. /* used by is_... macros. our ctype[] */
  16804. char lex_type[256] =
  16805. {
  16806. - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
  16807. - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
  16808. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
  16809. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
  16810. 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
  16811. - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
  16812. - LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
  16813. + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
  16814. + LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
  16815. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
  16816. - 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
  16817. + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
  16818. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */
  16819. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  16820. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  16821. @@ -148,48 +149,48 @@ char lex_type[256] =
  16822. char is_end_of_line[256] =
  16823. {
  16824. #ifdef CR_EOL
  16825. - 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, 99, Z_, Z_, /* @abcdefghijklmno */
  16826. + 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, 99, Z_, Z_, /* @abcdefghijklmno */
  16827. #else
  16828. - 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, Z_, /* @abcdefghijklmno */
  16829. + 99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, Z_, /* @abcdefghijklmno */
  16830. #endif
  16831. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16832. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16833. #ifdef TC_HPPA
  16834. - Z_,99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* _!"#$%&'()*+,-./ */
  16835. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
  16836. + Z_,99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* _!"#$%&'()*+,-./ */
  16837. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
  16838. #else
  16839. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16840. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
  16841. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16842. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, /* 0123456789:;<=>? */
  16843. #endif
  16844. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16845. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16846. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16847. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16848. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16849. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16850. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16851. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16852. - Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16853. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16854. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16855. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16856. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16857. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16858. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16859. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16860. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16861. + Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */
  16862. };
  16863. #undef Z_
  16864. /* Functions private to this file. */
  16865. -static char *buffer; /* 1st char of each buffer of lines is here. */
  16866. -static char *buffer_limit; /*->1 + last char in buffer. */
  16867. +static char *buffer; /* 1st char of each buffer of lines is here. */
  16868. +static char *buffer_limit; /*->1 + last char in buffer. */
  16869. /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1 in the
  16870. tc-<CPU>.h file. See the "Porting GAS" section of the internals manual. */
  16871. int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
  16872. -static char *old_buffer; /* JF a hack */
  16873. +static char *old_buffer; /* JF a hack */
  16874. static char *old_input;
  16875. static char *old_limit;
  16876. /* Variables for handling include file directory table. */
  16877. -char **include_dirs; /* Table of pointers to directories to
  16878. - search for .include's */
  16879. -int include_dir_count; /* How many are in the table */
  16880. +char **include_dirs; /* Table of pointers to directories to
  16881. + search for .include's */
  16882. +int include_dir_count; /* How many are in the table */
  16883. int include_dir_maxlen = 1;/* Length of longest in table */
  16884. #ifndef WORKING_DOT_WORD
  16885. @@ -318,7 +319,7 @@ static const pseudo_typeS potable[] =
  16886. /* dim */
  16887. {"double", float_cons, 'd'},
  16888. /* dsect */
  16889. - {"eject", listing_eject, 0}, /* Formfeed listing */
  16890. + {"eject", listing_eject, 0}, /* Formfeed listing */
  16891. {"else", s_else, 0},
  16892. {"elsec", s_else, 0},
  16893. {"elseif", s_elseif, (int) O_ne},
  16894. @@ -332,7 +333,7 @@ static const pseudo_typeS potable[] =
  16895. {"err", s_err, 0},
  16896. {"exitm", s_mexit, 0},
  16897. /* extend */
  16898. - {"extern", s_ignore, 0}, /* We treat all undef as ext */
  16899. + {"extern", s_ignore, 0}, /* We treat all undef as ext */
  16900. {"appfile", s_app_file, 1},
  16901. {"appline", s_app_line, 0},
  16902. {"fail", s_fail, 0},
  16903. @@ -365,19 +366,19 @@ static const pseudo_typeS potable[] =
  16904. {"irpc", s_irp, 1},
  16905. {"irepc", s_irp, 1},
  16906. {"lcomm", s_lcomm, 0},
  16907. - {"lflags", listing_flags, 0}, /* Listing flags */
  16908. + {"lflags", listing_flags, 0}, /* Listing flags */
  16909. {"linkonce", s_linkonce, 0},
  16910. - {"list", listing_list, 1}, /* Turn listing on */
  16911. + {"list", listing_list, 1}, /* Turn listing on */
  16912. {"llen", listing_psize, 1},
  16913. {"long", cons, 4},
  16914. {"lsym", s_lsym, 0},
  16915. {"macro", s_macro, 0},
  16916. {"mexit", s_mexit, 0},
  16917. {"mri", s_mri, 0},
  16918. - {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
  16919. + {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
  16920. {"name", s_ignore, 0},
  16921. {"noformat", s_ignore, 0},
  16922. - {"nolist", listing_list, 0}, /* Turn listing off */
  16923. + {"nolist", listing_list, 0}, /* Turn listing off */
  16924. {"nopage", listing_nopage, 0},
  16925. {"octa", cons, 16},
  16926. {"offset", s_struct, 0},
  16927. @@ -388,13 +389,13 @@ static const pseudo_typeS potable[] =
  16928. {"page", listing_eject, 0},
  16929. {"plen", listing_psize, 0},
  16930. {"print", s_print, 0},
  16931. - {"psize", listing_psize, 0}, /* set paper size */
  16932. + {"psize", listing_psize, 0}, /* set paper size */
  16933. {"purgem", s_purgem, 0},
  16934. {"quad", cons, 8},
  16935. {"rep", s_rept, 0},
  16936. {"rept", s_rept, 0},
  16937. {"rva", s_rva, 4},
  16938. - {"sbttl", listing_title, 1}, /* Subtitle of listing */
  16939. + {"sbttl", listing_title, 1}, /* Subtitle of listing */
  16940. /* scl */
  16941. /* sect */
  16942. {"set", s_set, 0},
  16943. @@ -423,7 +424,7 @@ static const pseudo_typeS potable[] =
  16944. this one. Match it either way... */
  16945. {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
  16946. - {"title", listing_title, 0}, /* Listing title */
  16947. + {"title", listing_title, 0}, /* Listing title */
  16948. {"ttl", listing_title, 0},
  16949. /* type */
  16950. {"uleb128", s_leb128, 0},
  16951. @@ -435,7 +436,7 @@ static const pseudo_typeS potable[] =
  16952. {"xstabs", s_xstab, 's'},
  16953. {"word", cons, 2},
  16954. {"zero", s_space, 0},
  16955. - {NULL, NULL, 0} /* end sentinel */
  16956. + {NULL, NULL, 0} /* end sentinel */
  16957. };
  16958. static int pop_override_ok = 0;
  16959. @@ -451,17 +452,17 @@ pop_insert (table)
  16960. {
  16961. errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
  16962. if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
  16963. - as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
  16964. - errtxt);
  16965. + as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
  16966. + errtxt);
  16967. }
  16968. }
  16969. #ifndef md_pop_insert
  16970. -#define md_pop_insert() pop_insert(md_pseudo_table)
  16971. +#define md_pop_insert() pop_insert(md_pseudo_table)
  16972. #endif
  16973. #ifndef obj_pop_insert
  16974. -#define obj_pop_insert() pop_insert(obj_pseudo_table)
  16975. +#define obj_pop_insert() pop_insert(obj_pseudo_table)
  16976. #endif
  16977. static void
  16978. @@ -483,13 +484,13 @@ pobegin ()
  16979. pop_insert (potable);
  16980. }
  16981. -#define HANDLE_CONDITIONAL_ASSEMBLY() \
  16982. - if (ignore_input ()) \
  16983. - { \
  16984. - while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
  16985. - if (input_line_pointer == buffer_limit) \
  16986. - break; \
  16987. - continue; \
  16988. +#define HANDLE_CONDITIONAL_ASSEMBLY() \
  16989. + if (ignore_input ()) \
  16990. + { \
  16991. + while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
  16992. + if (input_line_pointer == buffer_limit) \
  16993. + break; \
  16994. + continue; \
  16995. }
  16996. @@ -514,19 +515,48 @@ scrub_from_string (buf, buflen)
  16997. return copy;
  16998. }
  16999. -/* read_a_source_file()
  17000. +/* read_a_source_file()
  17001. *
  17002. * We read the file, putting things into a web that
  17003. * represents what we have been reading.
  17004. */
  17005. +
  17006. +/* add T.Tazaki 2002.03.04 >>> */
  17007. +char *c33_stabs_input_file;
  17008. +char szC33_stabs_input_file[300];
  17009. +char *c33_original_input_file;
  17010. +char szC33_original_input_file[300];
  17011. +extern enum debug_info_type debug_type;
  17012. +/* add T.Tazaki 2002.03.04 <<< */
  17013. +
  17014. void
  17015. read_a_source_file (name)
  17016. char *name;
  17017. {
  17018. register char c;
  17019. - register char *s; /* string of symbol, '\0' appended */
  17020. + register char *s; /* string of symbol, '\0' appended */
  17021. register int temp;
  17022. pseudo_typeS *pop;
  17023. +
  17024. + /* add T.Tazaki 2002.03.04 >>> */
  17025. + int i;
  17026. + char *hold;
  17027. + char *hold2;
  17028. + char *file;
  17029. + unsigned int lineno;
  17030. + int iPrepro = 0;
  17031. + int iFirst_stabs = 0; /* OFF */
  17032. + int iFirst_original = 0; /* OFF */
  17033. + int iLinePlusFirst = 0; /* 0=first # line add T.Tazaki 2003/05/20 */
  17034. +
  17035. +
  17036. + c33_stabs_input_file = &szC33_stabs_input_file[0];
  17037. + *c33_stabs_input_file = NULL;
  17038. +
  17039. + c33_original_input_file = &szC33_original_input_file[0];
  17040. + *c33_original_input_file = NULL;
  17041. +
  17042. + /* add T.Tazaki 2002.03.04 <<< */
  17043. buffer = input_scrub_new_file (name);
  17044. @@ -537,569 +567,815 @@ read_a_source_file (name)
  17045. /* Generate debugging information before we've read anything in to denote
  17046. this file as the "main" source file and not a subordinate one
  17047. (e.g. N_SO vs N_SOL in stabs). */
  17048. - generate_file_debug ();
  17049. +
  17050. + hold = input_line_pointer;
  17051. +
  17052. +/* generate_file_debug (); */ /* del T.Tazaki 2002.02.26 */
  17053. +
  17054. +// ADD D.Fujimoto append .file pseudo op 2007/06/25 >>>>>>>
  17055. +#ifdef EXT_REMOVE
  17056. + s_app_file_2();
  17057. +#endif
  17058. +// ADD D.Fujimoto append .file pseudo op 2007/06/25 <<<<<<<
  17059. while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
  17060. - { /* We have another line to parse. */
  17061. - know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
  17062. - contin: /* JF this goto is my fault I admit it.
  17063. - Someone brave please re-write the whole
  17064. - input section here? Pleeze??? */
  17065. + { /* We have another line to parse. */
  17066. + know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
  17067. + contin: /* JF this goto is my fault I admit it.
  17068. + Someone brave please re-write the whole
  17069. + input section here? Pleeze??? */
  17070. +
  17071. + as_where (&file, &lineno); /* debug */
  17072. +
  17073. +
  17074. while (input_line_pointer < buffer_limit)
  17075. - {
  17076. - /* We have more of this buffer to parse. */
  17077. -
  17078. - /*
  17079. - * We now have input_line_pointer->1st char of next line.
  17080. - * If input_line_pointer [-1] == '\n' then we just
  17081. - * scanned another line: so bump line counters.
  17082. - */
  17083. - if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
  17084. - {
  17085. + {
  17086. + /* We have more of this buffer to parse. */
  17087. +
  17088. + /*
  17089. + * We now have input_line_pointer->1st char of next line.
  17090. + * If input_line_pointer [-1] == '\n' then we just
  17091. + * scanned another line: so bump line counters.
  17092. + */
  17093. + if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
  17094. + {
  17095. #ifdef md_start_line_hook
  17096. - md_start_line_hook ();
  17097. + md_start_line_hook ();
  17098. #endif
  17099. - if (input_line_pointer[-1] == '\n')
  17100. - bump_line_counters ();
  17101. -
  17102. - line_label = NULL;
  17103. -
  17104. - if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
  17105. - {
  17106. - /* Text at the start of a line must be a label, we
  17107. - run down and stick a colon in. */
  17108. - if (is_name_beginner (*input_line_pointer))
  17109. - {
  17110. - char *line_start = input_line_pointer;
  17111. - char c;
  17112. - int mri_line_macro;
  17113. -
  17114. - LISTING_NEWLINE ();
  17115. - HANDLE_CONDITIONAL_ASSEMBLY ();
  17116. -
  17117. - c = get_symbol_end ();
  17118. -
  17119. - /* In MRI mode, the EQU and MACRO pseudoops must
  17120. - be handled specially. */
  17121. - mri_line_macro = 0;
  17122. - if (flag_m68k_mri)
  17123. - {
  17124. - char *rest = input_line_pointer + 1;
  17125. -
  17126. - if (*rest == ':')
  17127. - ++rest;
  17128. - if (*rest == ' ' || *rest == '\t')
  17129. - ++rest;
  17130. - if ((strncasecmp (rest, "EQU", 3) == 0
  17131. - || strncasecmp (rest, "SET", 3) == 0)
  17132. - && (rest[3] == ' ' || rest[3] == '\t'))
  17133. - {
  17134. - input_line_pointer = rest + 3;
  17135. - equals (line_start,
  17136. - strncasecmp (rest, "SET", 3) == 0);
  17137. - continue;
  17138. - }
  17139. - if (strncasecmp (rest, "MACRO", 5) == 0
  17140. - && (rest[5] == ' '
  17141. - || rest[5] == '\t'
  17142. - || is_end_of_line[(unsigned char) rest[5]]))
  17143. - mri_line_macro = 1;
  17144. - }
  17145. -
  17146. - /* In MRI mode, we need to handle the MACRO
  17147. + if (input_line_pointer[-1] == '\n')
  17148. + {
  17149. +
  17150. + /* add T.Tazaki 2002.03.18 >>> */
  17151. +
  17152. + if( *input_line_pointer == '\n' ){
  17153. + if( iFirst_stabs != 1 && iFirst_original != 1 ){ /* Non PrePro Source ? */
  17154. + ++input_line_pointer;
  17155. + bump_line_counters (); /* ++lineno */
  17156. + continue;
  17157. + }
  17158. + }
  17159. +
  17160. + /*==============================================================*/
  17161. + /* CPP Assembler debug Info : line number(stab info) modify */
  17162. + /*==============================================================*/
  17163. + /* <format> */
  17164. + /* # 999 "filename1" */
  17165. + /* # 999 "filename2" 999 */
  17166. + /* . */
  17167. + /* . */
  17168. + /* . */
  17169. + /* # 999 "filename1" 999 */
  17170. + /* . */
  17171. + /*--------------------------------------------------------------*/
  17172. + if( *input_line_pointer == '#' ){ /* After CPP Mode ? */
  17173. +
  17174. + /*==============================================================*/
  17175. + /* # */
  17176. + /*==============================================================*/
  17177. +
  17178. + ++input_line_pointer;
  17179. +
  17180. + as_where (&file, &lineno);
  17181. +
  17182. + if( debug_type == DEBUG_STABS ){
  17183. + /*==============================================================*/
  17184. + /* GSTABS */
  17185. + /*==============================================================*/
  17186. +
  17187. + if( lineno == 0 ){
  17188. + if( iFirst_stabs == 1 ){
  17189. + ++input_line_pointer;
  17190. + }
  17191. + /* Get True file name */
  17192. + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
  17193. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17194. + bump_line_counters ();
  17195. +
  17196. + }else{
  17197. + while( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){ /* Skip until value */
  17198. + ++input_line_pointer;
  17199. + }
  17200. + ++input_line_pointer;
  17201. + if( *input_line_pointer != ' ' ){
  17202. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17203. + bump_line_counters ();
  17204. + }else{
  17205. + ++input_line_pointer;
  17206. + if( *input_line_pointer != '\"' ){
  17207. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17208. + bump_line_counters ();
  17209. + }else{
  17210. + ++input_line_pointer;
  17211. + if( iFirst_stabs == 1 ){ /* ON ?*/
  17212. + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
  17213. + ++input_line_pointer;
  17214. + }
  17215. + bump_line_counters (); /* ++lineno */
  17216. + }else{
  17217. + /* Get Original Assembler File Name */
  17218. + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
  17219. + szC33_stabs_input_file[i] = szC33_original_input_file[i]
  17220. + = *input_line_pointer;
  17221. + ++input_line_pointer;
  17222. + }
  17223. +
  17224. + hold2 = input_line_pointer;
  17225. + input_line_pointer = hold;
  17226. + generate_file_debug ();
  17227. + input_line_pointer = hold2;
  17228. +
  17229. + iFirst_stabs = 1; /* ON */
  17230. + }
  17231. + }
  17232. + }
  17233. + }
  17234. + }
  17235. + }
  17236. + else
  17237. + {
  17238. + /*==============================================================*/
  17239. + /* NO GSTABS */
  17240. + /*==============================================================*/
  17241. +
  17242. + if( lineno == 0 ){
  17243. + if( iFirst_original == 1 ){
  17244. + ++input_line_pointer;
  17245. + }
  17246. + /* Get True file name */
  17247. + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
  17248. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17249. + bump_line_counters ();
  17250. + }else{
  17251. + while( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){ /* Skip until value */
  17252. + ++input_line_pointer;
  17253. + }
  17254. + ++input_line_pointer;
  17255. + if( *input_line_pointer != ' ' ){
  17256. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17257. + bump_line_counters ();
  17258. + }else{
  17259. + ++input_line_pointer;
  17260. + if( *input_line_pointer != '\"' ){
  17261. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17262. + bump_line_counters ();
  17263. + }else{
  17264. + ++input_line_pointer;
  17265. + if( iFirst_original == 1 ){ /* ON ?*/
  17266. + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
  17267. + ++input_line_pointer;
  17268. + }
  17269. + bump_line_counters (); /* ++lineno */
  17270. + }else{
  17271. + /* Get Original Assembler File Name */
  17272. + for( i = 0; *input_line_pointer != '\"'; ++i ){ /* Skip until \" */
  17273. + szC33_original_input_file[i] = *input_line_pointer;
  17274. + ++input_line_pointer;
  17275. + }
  17276. + iFirst_original = 1; /* ON */
  17277. + }
  17278. + }
  17279. + }
  17280. + }
  17281. + }
  17282. + else
  17283. + {
  17284. + ++input_line_pointer;
  17285. +
  17286. + /* smaple #include "file.h" <----- NG!! */
  17287. + if( !(*input_line_pointer >= '0' && *input_line_pointer <= '9') ){
  17288. + as_bad_where (file, lineno+1, "Invalid preprocess", NULL);
  17289. + bump_line_counters ();
  17290. + }
  17291. + ++input_line_pointer;
  17292. + }
  17293. + }
  17294. +
  17295. + while( *input_line_pointer != '\n' ){ /* Skip until CRLF */
  17296. + ++input_line_pointer;
  17297. + }
  17298. + ++input_line_pointer;
  17299. +
  17300. + /* Assembler Source Name Get ? */
  17301. +
  17302. + if( iFirst_stabs == 1 || iFirst_original == 1 ){
  17303. +
  17304. + /* form # 1 "XXXXX" to # 1 "YYYYY" + 1 : not increment line number */
  17305. + as_where (&file, &lineno);
  17306. + if( lineno > 0 ){
  17307. + if( iPrepro == 0 ){ /* line count ON/OFF switch */
  17308. + iPrepro = 1; /* ON */
  17309. + }else{
  17310. + iPrepro = 0; /* OFF */
  17311. + /* Skip 1 line */
  17312. + while( *input_line_pointer != '\n' ){
  17313. + ++input_line_pointer;
  17314. + }
  17315. + ++input_line_pointer;
  17316. + /* add T.Tazaki bug fix 2003/05/21 >>> */
  17317. + if( iLinePlusFirst == 1 )
  17318. + {
  17319. + bump_line_counters ();
  17320. + }
  17321. + else
  17322. + {
  17323. + iLinePlusFirst = 1;
  17324. + }
  17325. + /* add T.Tazaki bug fix 2003/05/21 >>> */
  17326. + }
  17327. + }
  17328. + }
  17329. +
  17330. + continue;
  17331. + }
  17332. + else{
  17333. + /*==============================================================*/
  17334. + /* NOT # */
  17335. + /*==============================================================*/
  17336. + as_where (&file, &lineno);
  17337. + if( lineno == 0 ){
  17338. + hold2 = input_line_pointer;
  17339. + input_line_pointer = hold;
  17340. + generate_file_debug ();
  17341. + input_line_pointer = hold2;
  17342. + }
  17343. + /*--------------------------------------------------------------*/
  17344. + /* line count up CASE : iPrepro == 0(OFF) */
  17345. + /* <format> */
  17346. + /* ; comment or text <== ++lineno */
  17347. + /* ; comment <== ++lineno */
  17348. + /* # 999 "filename2" 999 */
  17349. + /* .SET SYM1,1 */
  17350. + /* # 999 "filename1" */
  17351. + /* ; comment <== ++lineno */
  17352. + /* ; comment <== ++lineno */
  17353. + /* ; comment <== ++lineno */
  17354. + /*--------------------------------------------------------------*/
  17355. + if( iPrepro == 0 ){ /* OFF ? : line count increment ? */
  17356. + iLinePlusFirst = 1; /* add T.Tazaki bug fix 2003/05/22 */
  17357. + bump_line_counters ();
  17358. + }
  17359. + }
  17360. + }
  17361. +
  17362. + /* add T.Tazaki 2002.02.26 <<< */
  17363. +
  17364. + line_label = NULL;
  17365. +
  17366. + if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
  17367. + {
  17368. + /* Text at the start of a line must be a label, we
  17369. + run down and stick a colon in. */
  17370. + if (is_name_beginner (*input_line_pointer))
  17371. + {
  17372. + char *line_start = input_line_pointer;
  17373. + char c;
  17374. + int mri_line_macro;
  17375. +
  17376. + LISTING_NEWLINE ();
  17377. + HANDLE_CONDITIONAL_ASSEMBLY ();
  17378. +
  17379. + c = get_symbol_end ();
  17380. +
  17381. + /* In MRI mode, the EQU and MACRO pseudoops must
  17382. + be handled specially. */
  17383. + mri_line_macro = 0;
  17384. + if (flag_m68k_mri)
  17385. + {
  17386. + char *rest = input_line_pointer + 1;
  17387. +
  17388. + if (*rest == ':')
  17389. + ++rest;
  17390. + if (*rest == ' ' || *rest == '\t')
  17391. + ++rest;
  17392. + if ((strncasecmp (rest, "EQU", 3) == 0
  17393. + || strncasecmp (rest, "SET", 3) == 0)
  17394. + && (rest[3] == ' ' || rest[3] == '\t'))
  17395. + {
  17396. + input_line_pointer = rest + 3;
  17397. + equals (line_start,
  17398. + strncasecmp (rest, "SET", 3) == 0);
  17399. + continue;
  17400. + }
  17401. + if (strncasecmp (rest, "MACRO", 5) == 0
  17402. + && (rest[5] == ' '
  17403. + || rest[5] == '\t'
  17404. + || is_end_of_line[(unsigned char) rest[5]]))
  17405. + mri_line_macro = 1;
  17406. + }
  17407. +
  17408. + /* In MRI mode, we need to handle the MACRO
  17409. pseudo-op specially: we don't want to put the
  17410. symbol in the symbol table. */
  17411. - if (! mri_line_macro
  17412. + if (! mri_line_macro
  17413. #ifdef TC_START_LABEL_WITHOUT_COLON
  17414. && TC_START_LABEL_WITHOUT_COLON(c,
  17415. input_line_pointer)
  17416. #endif
  17417. )
  17418. - line_label = colon (line_start);
  17419. - else
  17420. - line_label = symbol_create (line_start,
  17421. - absolute_section,
  17422. - (valueT) 0,
  17423. - &zero_address_frag);
  17424. -
  17425. - *input_line_pointer = c;
  17426. - if (c == ':')
  17427. - input_line_pointer++;
  17428. - }
  17429. - }
  17430. - }
  17431. -
  17432. - /*
  17433. - * We are at the begining of a line, or similar place.
  17434. - * We expect a well-formed assembler statement.
  17435. - * A "symbol-name:" is a statement.
  17436. - *
  17437. - * Depending on what compiler is used, the order of these tests
  17438. - * may vary to catch most common case 1st.
  17439. - * Each test is independent of all other tests at the (top) level.
  17440. - * PLEASE make a compiler that doesn't use this assembler.
  17441. - * It is crufty to waste a compiler's time encoding things for this
  17442. - * assembler, which then wastes more time decoding it.
  17443. - * (And communicating via (linear) files is silly!
  17444. - * If you must pass stuff, please pass a tree!)
  17445. - */
  17446. - if ((c = *input_line_pointer++) == '\t'
  17447. - || c == ' '
  17448. - || c == '\f'
  17449. - || c == 0)
  17450. - {
  17451. - c = *input_line_pointer++;
  17452. - }
  17453. - know (c != ' '); /* No further leading whitespace. */
  17454. + line_label = colon (line_start);
  17455. + else
  17456. + line_label = symbol_create (line_start,
  17457. + absolute_section,
  17458. + (valueT) 0,
  17459. + &zero_address_frag);
  17460. +
  17461. + *input_line_pointer = c;
  17462. + if (c == ':')
  17463. + input_line_pointer++;
  17464. + }
  17465. + }
  17466. + }
  17467. +
  17468. + /*
  17469. + * We are at the begining of a line, or similar place.
  17470. + * We expect a well-formed assembler statement.
  17471. + * A "symbol-name:" is a statement.
  17472. + *
  17473. + * Depending on what compiler is used, the order of these tests
  17474. + * may vary to catch most common case 1st.
  17475. + * Each test is independent of all other tests at the (top) level.
  17476. + * PLEASE make a compiler that doesn't use this assembler.
  17477. + * It is crufty to waste a compiler's time encoding things for this
  17478. + * assembler, which then wastes more time decoding it.
  17479. + * (And communicating via (linear) files is silly!
  17480. + * If you must pass stuff, please pass a tree!)
  17481. + */
  17482. + if ((c = *input_line_pointer++) == '\t'
  17483. + || c == ' '
  17484. + || c == '\f'
  17485. + || c == 0)
  17486. + {
  17487. +
  17488. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  17489. +#ifdef EXT_REMOVE
  17490. + reset_current_symbol(input_line_pointer);
  17491. +#endif
  17492. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  17493. +
  17494. + c = *input_line_pointer++;
  17495. + }
  17496. + know (c != ' '); /* No further leading whitespace. */
  17497. #ifndef NO_LISTING
  17498. - /* If listing is on, and we are expanding a macro, then give
  17499. - the listing code the contents of the expanded line. */
  17500. - if (listing)
  17501. - {
  17502. - if ((listing & LISTING_MACEXP) && macro_nest > 0)
  17503. - {
  17504. - char *copy;
  17505. - int len;
  17506. -
  17507. - /* Find the end of the current expanded macro line. */
  17508. - for (s = input_line_pointer-1; *s ; ++s)
  17509. - if (is_end_of_line[(unsigned char) *s])
  17510. - break;
  17511. -
  17512. - /* Copy it for safe keeping. Also give an indication of
  17513. - how much macro nesting is involved at this point. */
  17514. - len = s - (input_line_pointer-1);
  17515. - copy = (char *) xmalloc (len + macro_nest + 2);
  17516. - memset (copy, '>', macro_nest);
  17517. - copy[macro_nest] = ' ';
  17518. - memcpy (copy + macro_nest + 1, input_line_pointer-1, len);
  17519. - copy[macro_nest+1+len] = '\0';
  17520. -
  17521. - /* Install the line with the listing facility. */
  17522. - listing_newline (copy);
  17523. - }
  17524. - else
  17525. - listing_newline (NULL);
  17526. - }
  17527. + /* If listing is on, and we are expanding a macro, then give
  17528. + the listing code the contents of the expanded line. */
  17529. + if (listing)
  17530. + {
  17531. + if ((listing & LISTING_MACEXP) && macro_nest > 0)
  17532. + {
  17533. + char *copy;
  17534. + int len;
  17535. +
  17536. + /* Find the end of the current expanded macro line. */
  17537. + for (s = input_line_pointer-1; *s ; ++s)
  17538. + if (is_end_of_line[(unsigned char) *s])
  17539. + break;
  17540. +
  17541. + /* Copy it for safe keeping. Also give an indication of
  17542. + how much macro nesting is involved at this point. */
  17543. + len = s - (input_line_pointer-1);
  17544. + copy = (char *) xmalloc (len + macro_nest + 2);
  17545. + memset (copy, '>', macro_nest);
  17546. + copy[macro_nest] = ' ';
  17547. + memcpy (copy + macro_nest + 1, input_line_pointer-1, len);
  17548. + copy[macro_nest+1+len] = '\0';
  17549. +
  17550. + /* Install the line with the listing facility. */
  17551. + listing_newline (copy);
  17552. + }
  17553. + else
  17554. + listing_newline (NULL);
  17555. + }
  17556. +#endif
  17557. +
  17558. + /*
  17559. + * C is the 1st significant character.
  17560. + * Input_line_pointer points after that character.
  17561. + */
  17562. + if (is_name_beginner (c))
  17563. + {
  17564. + /* want user-defined label or pseudo/opcode */
  17565. + HANDLE_CONDITIONAL_ASSEMBLY ();
  17566. +
  17567. + s = --input_line_pointer;
  17568. + c = get_symbol_end (); /* name's delimiter */
  17569. + /*
  17570. + * C is character after symbol.
  17571. + * That character's place in the input line is now '\0'.
  17572. + * S points to the beginning of the symbol.
  17573. + * [In case of pseudo-op, s->'.'.]
  17574. + * Input_line_pointer->'\0' where c was.
  17575. + */
  17576. + if (TC_START_LABEL(c, input_line_pointer))
  17577. + {
  17578. + if (flag_m68k_mri)
  17579. + {
  17580. + char *rest = input_line_pointer + 1;
  17581. +
  17582. + /* In MRI mode, \tsym: set 0 is permitted. */
  17583. +
  17584. + if (*rest == ':')
  17585. + ++rest;
  17586. + if (*rest == ' ' || *rest == '\t')
  17587. + ++rest;
  17588. + if ((strncasecmp (rest, "EQU", 3) == 0
  17589. + || strncasecmp (rest, "SET", 3) == 0)
  17590. + && (rest[3] == ' ' || rest[3] == '\t'))
  17591. + {
  17592. + input_line_pointer = rest + 3;
  17593. + equals (s, 1);
  17594. + continue;
  17595. + }
  17596. + }
  17597. +
  17598. + line_label = colon (s); /* user-defined label */
  17599. +
  17600. +// ADD D.Fujimoto 2007/06/25 >>>>>>>
  17601. +#ifdef EXT_REMOVE
  17602. + update_current_symbol(s);
  17603. #endif
  17604. +// ADD D.Fujimoto 2007/06/25 <<<<<<<
  17605. +
  17606. + *input_line_pointer++ = ':'; /* Put ':' back for error messages' sake. */
  17607. + /* Input_line_pointer->after ':'. */
  17608. + SKIP_WHITESPACE ();
  17609. - /*
  17610. - * C is the 1st significant character.
  17611. - * Input_line_pointer points after that character.
  17612. - */
  17613. - if (is_name_beginner (c))
  17614. - {
  17615. - /* want user-defined label or pseudo/opcode */
  17616. - HANDLE_CONDITIONAL_ASSEMBLY ();
  17617. -
  17618. - s = --input_line_pointer;
  17619. - c = get_symbol_end (); /* name's delimiter */
  17620. - /*
  17621. - * C is character after symbol.
  17622. - * That character's place in the input line is now '\0'.
  17623. - * S points to the beginning of the symbol.
  17624. - * [In case of pseudo-op, s->'.'.]
  17625. - * Input_line_pointer->'\0' where c was.
  17626. - */
  17627. - if (TC_START_LABEL(c, input_line_pointer))
  17628. - {
  17629. - if (flag_m68k_mri)
  17630. - {
  17631. - char *rest = input_line_pointer + 1;
  17632. -
  17633. - /* In MRI mode, \tsym: set 0 is permitted. */
  17634. -
  17635. - if (*rest == ':')
  17636. - ++rest;
  17637. - if (*rest == ' ' || *rest == '\t')
  17638. - ++rest;
  17639. - if ((strncasecmp (rest, "EQU", 3) == 0
  17640. - || strncasecmp (rest, "SET", 3) == 0)
  17641. - && (rest[3] == ' ' || rest[3] == '\t'))
  17642. - {
  17643. - input_line_pointer = rest + 3;
  17644. - equals (s, 1);
  17645. - continue;
  17646. - }
  17647. - }
  17648. -
  17649. - line_label = colon (s); /* user-defined label */
  17650. - *input_line_pointer++ = ':'; /* Put ':' back for error messages' sake. */
  17651. - /* Input_line_pointer->after ':'. */
  17652. - SKIP_WHITESPACE ();
  17653. -
  17654. -
  17655. - }
  17656. - else if (c == '='
  17657. - || ((c == ' ' || c == '\t')
  17658. - && input_line_pointer[1] == '='
  17659. +
  17660. + }
  17661. + else if (c == '='
  17662. + || ((c == ' ' || c == '\t')
  17663. + && input_line_pointer[1] == '='
  17664. #ifdef TC_EQUAL_IN_INSN
  17665. - && ! TC_EQUAL_IN_INSN (c, input_line_pointer)
  17666. + && ! TC_EQUAL_IN_INSN (c, input_line_pointer)
  17667. #endif
  17668. - ))
  17669. - {
  17670. - equals (s, 1);
  17671. - demand_empty_rest_of_line ();
  17672. - }
  17673. - else
  17674. - { /* expect pseudo-op or machine instruction */
  17675. - pop = NULL;
  17676. + ))
  17677. + {
  17678. + equals (s, 1);
  17679. + demand_empty_rest_of_line ();
  17680. + }
  17681. + else
  17682. + { /* expect pseudo-op or machine instruction */
  17683. + pop = NULL;
  17684. #define IGNORE_OPCODE_CASE
  17685. #ifdef IGNORE_OPCODE_CASE
  17686. - {
  17687. - char *s2 = s;
  17688. - while (*s2)
  17689. - {
  17690. - if (isupper ((unsigned char) *s2))
  17691. - *s2 = tolower (*s2);
  17692. - s2++;
  17693. - }
  17694. - }
  17695. + {
  17696. + char *s2 = s;
  17697. + while (*s2)
  17698. + {
  17699. + if (isupper ((unsigned char) *s2))
  17700. + *s2 = tolower (*s2);
  17701. + s2++;
  17702. + }
  17703. + }
  17704. #endif
  17705. - if (NO_PSEUDO_DOT || flag_m68k_mri)
  17706. - {
  17707. - /* The MRI assembler and the m88k use pseudo-ops
  17708. + if (NO_PSEUDO_DOT || flag_m68k_mri)
  17709. + {
  17710. + /* The MRI assembler and the m88k use pseudo-ops
  17711. without a period. */
  17712. - pop = (pseudo_typeS *) hash_find (po_hash, s);
  17713. - if (pop != NULL && pop->poc_handler == NULL)
  17714. - pop = NULL;
  17715. - }
  17716. -
  17717. - if (pop != NULL
  17718. - || (! flag_m68k_mri && *s == '.'))
  17719. - {
  17720. - /*
  17721. - * PSEUDO - OP.
  17722. - *
  17723. - * WARNING: c has next char, which may be end-of-line.
  17724. - * We lookup the pseudo-op table with s+1 because we
  17725. - * already know that the pseudo-op begins with a '.'.
  17726. - */
  17727. -
  17728. - if (pop == NULL)
  17729. - pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
  17730. -
  17731. - /* In MRI mode, we may need to insert an
  17732. + pop = (pseudo_typeS *) hash_find (po_hash, s);
  17733. + if (pop != NULL && pop->poc_handler == NULL)
  17734. + pop = NULL;
  17735. + }
  17736. +
  17737. + if (pop != NULL
  17738. + || (! flag_m68k_mri && *s == '.'))
  17739. + {
  17740. + /*
  17741. + * PSEUDO - OP.
  17742. + *
  17743. + * WARNING: c has next char, which may be end-of-line.
  17744. + * We lookup the pseudo-op table with s+1 because we
  17745. + * already know that the pseudo-op begins with a '.'.
  17746. + */
  17747. +
  17748. + if (pop == NULL)
  17749. + pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
  17750. +
  17751. + /* In MRI mode, we may need to insert an
  17752. automatic alignment directive. What a hack
  17753. this is. */
  17754. - if (mri_pending_align
  17755. - && (pop == NULL
  17756. - || ! ((pop->poc_handler == cons
  17757. - && pop->poc_val == 1)
  17758. - || (pop->poc_handler == s_space
  17759. - && pop->poc_val == 1)
  17760. + if (mri_pending_align
  17761. + && (pop == NULL
  17762. + || ! ((pop->poc_handler == cons
  17763. + && pop->poc_val == 1)
  17764. + || (pop->poc_handler == s_space
  17765. + && pop->poc_val == 1)
  17766. #ifdef tc_conditional_pseudoop
  17767. - || tc_conditional_pseudoop (pop)
  17768. + || tc_conditional_pseudoop (pop)
  17769. #endif
  17770. - || pop->poc_handler == s_if
  17771. - || pop->poc_handler == s_ifdef
  17772. - || pop->poc_handler == s_ifc
  17773. - || pop->poc_handler == s_ifeqs
  17774. - || pop->poc_handler == s_else
  17775. - || pop->poc_handler == s_endif
  17776. - || pop->poc_handler == s_globl
  17777. - || pop->poc_handler == s_ignore)))
  17778. - {
  17779. - do_align (1, (char *) NULL, 0, 0);
  17780. - mri_pending_align = 0;
  17781. - if (line_label != NULL)
  17782. - {
  17783. - symbol_set_frag (line_label, frag_now);
  17784. - S_SET_VALUE (line_label, frag_now_fix ());
  17785. - }
  17786. - }
  17787. -
  17788. - /* Print the error msg now, while we still can */
  17789. - if (pop == NULL)
  17790. - {
  17791. - as_bad (_("Unknown pseudo-op: `%s'"), s);
  17792. - *input_line_pointer = c;
  17793. - s_ignore (0);
  17794. - continue;
  17795. - }
  17796. -
  17797. - /* Put it back for error messages etc. */
  17798. - *input_line_pointer = c;
  17799. - /* The following skip of whitespace is compulsory.
  17800. - A well shaped space is sometimes all that separates
  17801. - keyword from operands. */
  17802. - if (c == ' ' || c == '\t')
  17803. - input_line_pointer++;
  17804. - /*
  17805. - * Input_line is restored.
  17806. - * Input_line_pointer->1st non-blank char
  17807. - * after pseudo-operation.
  17808. - */
  17809. - (*pop->poc_handler) (pop->poc_val);
  17810. -
  17811. - /* If that was .end, just get out now. */
  17812. - if (pop->poc_handler == s_end)
  17813. - goto quit;
  17814. - }
  17815. - else
  17816. - {
  17817. - int inquote = 0;
  17818. + || pop->poc_handler == s_if
  17819. + || pop->poc_handler == s_ifdef
  17820. + || pop->poc_handler == s_ifc
  17821. + || pop->poc_handler == s_ifeqs
  17822. + || pop->poc_handler == s_else
  17823. + || pop->poc_handler == s_endif
  17824. + || pop->poc_handler == s_globl
  17825. + || pop->poc_handler == s_ignore)))
  17826. + {
  17827. + do_align (1, (char *) NULL, 0, 0);
  17828. + mri_pending_align = 0;
  17829. + if (line_label != NULL)
  17830. + {
  17831. + symbol_set_frag (line_label, frag_now);
  17832. + S_SET_VALUE (line_label, frag_now_fix ());
  17833. + }
  17834. + }
  17835. +
  17836. + /* Print the error msg now, while we still can */
  17837. + if (pop == NULL)
  17838. + {
  17839. + as_bad (_("Unknown pseudo-op: `%s'"), s);
  17840. + *input_line_pointer = c;
  17841. + s_ignore (0);
  17842. + continue;
  17843. + }
  17844. +
  17845. + /* Put it back for error messages etc. */
  17846. + *input_line_pointer = c;
  17847. + /* The following skip of whitespace is compulsory.
  17848. + A well shaped space is sometimes all that separates
  17849. + keyword from operands. */
  17850. + if (c == ' ' || c == '\t')
  17851. + input_line_pointer++;
  17852. + /*
  17853. + * Input_line is restored.
  17854. + * Input_line_pointer->1st non-blank char
  17855. + * after pseudo-operation.
  17856. + */
  17857. + (*pop->poc_handler) (pop->poc_val);
  17858. +
  17859. + /* If that was .end, just get out now. */
  17860. + if (pop->poc_handler == s_end)
  17861. + goto quit;
  17862. + }
  17863. + else
  17864. + {
  17865. + int inquote = 0;
  17866. #ifdef QUOTES_IN_INSN
  17867. - int inescape = 0;
  17868. + int inescape = 0;
  17869. #endif
  17870. - /* WARNING: c has char, which may be end-of-line. */
  17871. - /* Also: input_line_pointer->`\0` where c was. */
  17872. - *input_line_pointer = c;
  17873. - while (!is_end_of_line[(unsigned char) *input_line_pointer]
  17874. - || inquote
  17875. + /* WARNING: c has char, which may be end-of-line. */
  17876. + /* Also: input_line_pointer->`\0` where c was. */
  17877. + *input_line_pointer = c;
  17878. + while (!is_end_of_line[(unsigned char) *input_line_pointer]
  17879. + || inquote
  17880. #ifdef TC_EOL_IN_INSN
  17881. - || TC_EOL_IN_INSN (input_line_pointer)
  17882. + || TC_EOL_IN_INSN (input_line_pointer)
  17883. #endif
  17884. - )
  17885. - {
  17886. - if (flag_m68k_mri && *input_line_pointer == '\'')
  17887. - inquote = ! inquote;
  17888. + )
  17889. + {
  17890. + if (flag_m68k_mri && *input_line_pointer == '\'')
  17891. + inquote = ! inquote;
  17892. #ifdef QUOTES_IN_INSN
  17893. - if (inescape)
  17894. - inescape = 0;
  17895. - else if (*input_line_pointer == '"')
  17896. - inquote = ! inquote;
  17897. - else if (*input_line_pointer == '\\')
  17898. - inescape = 1;
  17899. + if (inescape)
  17900. + inescape = 0;
  17901. + else if (*input_line_pointer == '"')
  17902. + inquote = ! inquote;
  17903. + else if (*input_line_pointer == '\\')
  17904. + inescape = 1;
  17905. #endif
  17906. - input_line_pointer++;
  17907. - }
  17908. + input_line_pointer++;
  17909. + }
  17910. - c = *input_line_pointer;
  17911. - *input_line_pointer = '\0';
  17912. + c = *input_line_pointer;
  17913. + *input_line_pointer = '\0';
  17914. - generate_lineno_debug ();
  17915. + generate_lineno_debug ();
  17916. - if (macro_defined)
  17917. - {
  17918. - sb out;
  17919. - const char *err;
  17920. + if (macro_defined)
  17921. + {
  17922. + sb out;
  17923. + const char *err;
  17924. macro_entry *macro;
  17925. - if (check_macro (s, &out, '\0', &err, &macro))
  17926. - {
  17927. - if (err != NULL)
  17928. - as_bad ("%s", err);
  17929. - *input_line_pointer++ = c;
  17930. - input_scrub_include_sb (&out,
  17931. - input_line_pointer, 1);
  17932. - sb_kill (&out);
  17933. - buffer_limit =
  17934. - input_scrub_next_buffer (&input_line_pointer);
  17935. + if (check_macro (s, &out, '\0', &err, &macro))
  17936. + {
  17937. + if (err != NULL)
  17938. + as_bad ("%s", err);
  17939. + *input_line_pointer++ = c;
  17940. + input_scrub_include_sb (&out,
  17941. + input_line_pointer, 1);
  17942. + sb_kill (&out);
  17943. + buffer_limit =
  17944. + input_scrub_next_buffer (&input_line_pointer);
  17945. #ifdef md_macro_info
  17946. md_macro_info (macro);
  17947. #endif
  17948. - continue;
  17949. - }
  17950. - }
  17951. -
  17952. - if (mri_pending_align)
  17953. - {
  17954. - do_align (1, (char *) NULL, 0, 0);
  17955. - mri_pending_align = 0;
  17956. - if (line_label != NULL)
  17957. - {
  17958. - symbol_set_frag (line_label, frag_now);
  17959. - S_SET_VALUE (line_label, frag_now_fix ());
  17960. - }
  17961. - }
  17962. -
  17963. - md_assemble (s); /* Assemble 1 instruction. */
  17964. -
  17965. - *input_line_pointer++ = c;
  17966. -
  17967. - /* We resume loop AFTER the end-of-line from
  17968. - this instruction. */
  17969. - } /* if (*s=='.') */
  17970. - } /* if c==':' */
  17971. - continue;
  17972. - } /* if (is_name_beginner(c) */
  17973. -
  17974. -
  17975. - /* Empty statement? */
  17976. - if (is_end_of_line[(unsigned char) c])
  17977. - continue;
  17978. -
  17979. - if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
  17980. - && isdigit ((unsigned char) c))
  17981. - {
  17982. - /* local label ("4:") */
  17983. - char *backup = input_line_pointer;
  17984. -
  17985. - HANDLE_CONDITIONAL_ASSEMBLY ();
  17986. -
  17987. - temp = c - '0';
  17988. -
  17989. - while (isdigit ((unsigned char) *input_line_pointer))
  17990. - {
  17991. - temp = (temp * 10) + *input_line_pointer - '0';
  17992. - ++input_line_pointer;
  17993. - } /* read the whole number */
  17994. -
  17995. - if (LOCAL_LABELS_DOLLAR
  17996. - && *input_line_pointer == '$'
  17997. - && *(input_line_pointer + 1) == ':')
  17998. - {
  17999. - input_line_pointer += 2;
  18000. -
  18001. - if (dollar_label_defined (temp))
  18002. - {
  18003. - as_fatal (_("label \"%d$\" redefined"), temp);
  18004. - }
  18005. -
  18006. - define_dollar_label (temp);
  18007. - colon (dollar_label_name (temp, 0));
  18008. - continue;
  18009. - }
  18010. -
  18011. - if (LOCAL_LABELS_FB
  18012. - && *input_line_pointer++ == ':')
  18013. - {
  18014. - fb_label_instance_inc (temp);
  18015. - colon (fb_label_name (temp, 0));
  18016. - continue;
  18017. - }
  18018. -
  18019. - input_line_pointer = backup;
  18020. - } /* local label ("4:") */
  18021. -
  18022. - if (c && strchr (line_comment_chars, c))
  18023. - { /* Its a comment. Better say APP or NO_APP */
  18024. - char *ends;
  18025. - char *new_buf;
  18026. - char *new_tmp;
  18027. - unsigned int new_length;
  18028. - char *tmp_buf = 0;
  18029. -
  18030. - bump_line_counters ();
  18031. - s = input_line_pointer;
  18032. - if (strncmp (s, "APP\n", 4))
  18033. - continue; /* We ignore it */
  18034. - s += 4;
  18035. -
  18036. - ends = strstr (s, "#NO_APP\n");
  18037. -
  18038. - if (!ends)
  18039. - {
  18040. - unsigned int tmp_len;
  18041. - unsigned int num;
  18042. -
  18043. - /* The end of the #APP wasn't in this buffer. We
  18044. - keep reading in buffers until we find the #NO_APP
  18045. - that goes with this #APP There is one. The specs
  18046. - guarentee it. . . */
  18047. - tmp_len = buffer_limit - s;
  18048. - tmp_buf = xmalloc (tmp_len + 1);
  18049. - memcpy (tmp_buf, s, tmp_len);
  18050. - do
  18051. - {
  18052. - new_tmp = input_scrub_next_buffer (&buffer);
  18053. - if (!new_tmp)
  18054. - break;
  18055. - else
  18056. - buffer_limit = new_tmp;
  18057. - input_line_pointer = buffer;
  18058. - ends = strstr (buffer, "#NO_APP\n");
  18059. - if (ends)
  18060. - num = ends - buffer;
  18061. - else
  18062. - num = buffer_limit - buffer;
  18063. -
  18064. - tmp_buf = xrealloc (tmp_buf, tmp_len + num);
  18065. - memcpy (tmp_buf + tmp_len, buffer, num);
  18066. - tmp_len += num;
  18067. - }
  18068. - while (!ends);
  18069. -
  18070. - input_line_pointer = ends ? ends + 8 : NULL;
  18071. -
  18072. - s = tmp_buf;
  18073. - ends = s + tmp_len;
  18074. -
  18075. - }
  18076. - else
  18077. - {
  18078. - input_line_pointer = ends + 8;
  18079. - }
  18080. -
  18081. - scrub_string = s;
  18082. - scrub_string_end = ends;
  18083. -
  18084. - new_length = ends - s;
  18085. - new_buf = (char *) xmalloc (new_length);
  18086. - new_tmp = new_buf;
  18087. - for (;;)
  18088. - {
  18089. - int space;
  18090. - int size;
  18091. -
  18092. - space = (new_buf + new_length) - new_tmp;
  18093. - size = do_scrub_chars (scrub_from_string, new_tmp, space);
  18094. -
  18095. - if (size < space)
  18096. - {
  18097. - new_tmp += size;
  18098. - break;
  18099. - }
  18100. -
  18101. - new_buf = xrealloc (new_buf, new_length + 100);
  18102. - new_tmp = new_buf + new_length;
  18103. - new_length += 100;
  18104. - }
  18105. -
  18106. - if (tmp_buf)
  18107. - free (tmp_buf);
  18108. - old_buffer = buffer;
  18109. - old_input = input_line_pointer;
  18110. - old_limit = buffer_limit;
  18111. - buffer = new_buf;
  18112. - input_line_pointer = new_buf;
  18113. - buffer_limit = new_tmp;
  18114. - continue;
  18115. - }
  18116. -
  18117. - HANDLE_CONDITIONAL_ASSEMBLY ();
  18118. + continue;
  18119. + }
  18120. + }
  18121. +
  18122. + if (mri_pending_align)
  18123. + {
  18124. + do_align (1, (char *) NULL, 0, 0);
  18125. + mri_pending_align = 0;
  18126. + if (line_label != NULL)
  18127. + {
  18128. + symbol_set_frag (line_label, frag_now);
  18129. + S_SET_VALUE (line_label, frag_now_fix ());
  18130. + }
  18131. + }
  18132. +
  18133. + md_assemble (s); /* Assemble 1 instruction. */
  18134. +
  18135. +/* add T.Tazaki 2002.03.18 >>> */
  18136. + if( *input_line_pointer == '\n' && c == '\n' ){
  18137. + bump_line_counters (); /* ++lineno */
  18138. + }
  18139. +/* add T.Tazaki 2002.03.18 <<< */
  18140. + *input_line_pointer++ = c;
  18141. +
  18142. + /* We resume loop AFTER the end-of-line from
  18143. + this instruction. */
  18144. + } /* if (*s=='.') */
  18145. + } /* if c==':' */
  18146. + continue;
  18147. + } /* if (is_name_beginner(c) */
  18148. +
  18149. +
  18150. + /* Empty statement? */
  18151. + if (is_end_of_line[(unsigned char) c])
  18152. + continue;
  18153. +
  18154. + if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
  18155. + && isdigit ((unsigned char) c))
  18156. + {
  18157. + /* local label ("4:") */
  18158. + char *backup = input_line_pointer;
  18159. +
  18160. + HANDLE_CONDITIONAL_ASSEMBLY ();
  18161. +
  18162. + temp = c - '0';
  18163. +
  18164. + while (isdigit ((unsigned char) *input_line_pointer))
  18165. + {
  18166. + temp = (temp * 10) + *input_line_pointer - '0';
  18167. + ++input_line_pointer;
  18168. + } /* read the whole number */
  18169. +
  18170. + if (LOCAL_LABELS_DOLLAR
  18171. + && *input_line_pointer == '$'
  18172. + && *(input_line_pointer + 1) == ':')
  18173. + {
  18174. + input_line_pointer += 2;
  18175. +
  18176. + if (dollar_label_defined (temp))
  18177. + {
  18178. + as_fatal (_("label \"%d$\" redefined"), temp);
  18179. + }
  18180. +
  18181. + define_dollar_label (temp);
  18182. + colon (dollar_label_name (temp, 0));
  18183. + continue;
  18184. + }
  18185. +
  18186. + if (LOCAL_LABELS_FB
  18187. + && *input_line_pointer++ == ':')
  18188. + {
  18189. + fb_label_instance_inc (temp);
  18190. + colon (fb_label_name (temp, 0));
  18191. + continue;
  18192. + }
  18193. +
  18194. + input_line_pointer = backup;
  18195. + } /* local label ("4:") */
  18196. +
  18197. + if (c && strchr (line_comment_chars, c))
  18198. + { /* Its a comment. Better say APP or NO_APP */
  18199. + char *ends;
  18200. + char *new_buf;
  18201. + char *new_tmp;
  18202. + unsigned int new_length;
  18203. + char *tmp_buf = 0;
  18204. +
  18205. + bump_line_counters ();
  18206. + s = input_line_pointer;
  18207. + if (strncmp (s, "APP\n", 4))
  18208. + continue; /* We ignore it */
  18209. + s += 4;
  18210. +
  18211. + ends = strstr (s, "#NO_APP\n");
  18212. +
  18213. + if (!ends)
  18214. + {
  18215. + unsigned int tmp_len;
  18216. + unsigned int num;
  18217. +
  18218. + /* The end of the #APP wasn't in this buffer. We
  18219. + keep reading in buffers until we find the #NO_APP
  18220. + that goes with this #APP There is one. The specs
  18221. + guarentee it. . . */
  18222. + tmp_len = buffer_limit - s;
  18223. + tmp_buf = xmalloc (tmp_len + 1);
  18224. + memcpy (tmp_buf, s, tmp_len);
  18225. + do
  18226. + {
  18227. + new_tmp = input_scrub_next_buffer (&buffer);
  18228. + if (!new_tmp)
  18229. + break;
  18230. + else
  18231. + buffer_limit = new_tmp;
  18232. + input_line_pointer = buffer;
  18233. + ends = strstr (buffer, "#NO_APP\n");
  18234. + if (ends)
  18235. + num = ends - buffer;
  18236. + else
  18237. + num = buffer_limit - buffer;
  18238. +
  18239. + tmp_buf = xrealloc (tmp_buf, tmp_len + num);
  18240. + memcpy (tmp_buf + tmp_len, buffer, num);
  18241. + tmp_len += num;
  18242. + }
  18243. + while (!ends);
  18244. +
  18245. + input_line_pointer = ends ? ends + 8 : NULL;
  18246. +
  18247. + s = tmp_buf;
  18248. + ends = s + tmp_len;
  18249. +
  18250. + }
  18251. + else
  18252. + {
  18253. + input_line_pointer = ends + 8;
  18254. + }
  18255. +
  18256. + scrub_string = s;
  18257. + scrub_string_end = ends;
  18258. +
  18259. + new_length = ends - s;
  18260. + new_buf = (char *) xmalloc (new_length);
  18261. + new_tmp = new_buf;
  18262. + for (;;)
  18263. + {
  18264. + int space;
  18265. + int size;
  18266. +
  18267. + space = (new_buf + new_length) - new_tmp;
  18268. + size = do_scrub_chars (scrub_from_string, new_tmp, space);
  18269. +
  18270. + if (size < space)
  18271. + {
  18272. + new_tmp += size;
  18273. + break;
  18274. + }
  18275. +
  18276. + new_buf = xrealloc (new_buf, new_length + 100);
  18277. + new_tmp = new_buf + new_length;
  18278. + new_length += 100;
  18279. + }
  18280. +
  18281. + if (tmp_buf)
  18282. + free (tmp_buf);
  18283. + old_buffer = buffer;
  18284. + old_input = input_line_pointer;
  18285. + old_limit = buffer_limit;
  18286. + buffer = new_buf;
  18287. + input_line_pointer = new_buf;
  18288. + buffer_limit = new_tmp;
  18289. + continue;
  18290. + }
  18291. +
  18292. + HANDLE_CONDITIONAL_ASSEMBLY ();
  18293. #ifdef tc_unrecognized_line
  18294. - if (tc_unrecognized_line (c))
  18295. - continue;
  18296. + if (tc_unrecognized_line (c))
  18297. + continue;
  18298. #endif
  18299. - /* as_warn("Junk character %d.",c); Now done by ignore_rest */
  18300. - input_line_pointer--; /* Report unknown char as ignored. */
  18301. - ignore_rest_of_line ();
  18302. - } /* while (input_line_pointer<buffer_limit) */
  18303. + /* as_warn("Junk character %d.",c); Now done by ignore_rest */
  18304. + input_line_pointer--; /* Report unknown char as ignored. */
  18305. + ignore_rest_of_line ();
  18306. + } /* while (input_line_pointer<buffer_limit) */
  18307. #ifdef md_after_pass_hook
  18308. md_after_pass_hook ();
  18309. #endif
  18310. if (old_buffer)
  18311. - {
  18312. - free (buffer);
  18313. - bump_line_counters ();
  18314. - if (old_input != 0)
  18315. - {
  18316. - buffer = old_buffer;
  18317. - input_line_pointer = old_input;
  18318. - buffer_limit = old_limit;
  18319. - old_buffer = 0;
  18320. - goto contin;
  18321. - }
  18322. - }
  18323. - } /* while (more buffers to scan) */
  18324. + {
  18325. + free (buffer);
  18326. + bump_line_counters ();
  18327. + if (old_input != 0)
  18328. + {
  18329. + buffer = old_buffer;
  18330. + input_line_pointer = old_input;
  18331. + buffer_limit = old_limit;
  18332. + old_buffer = 0;
  18333. + goto contin;
  18334. + }
  18335. + }
  18336. + } /* while (more buffers to scan) */
  18337. quit:
  18338. #ifdef md_cleanup
  18339. md_cleanup();
  18340. #endif
  18341. - input_scrub_close (); /* Close the input file */
  18342. + input_scrub_close (); /* Close the input file */
  18343. }
  18344. /* For most MRI pseudo-ops, the line actually ends at the first
  18345. @@ -1123,11 +1399,11 @@ mri_comment_field (stopcp)
  18346. for (s = input_line_pointer;
  18347. ((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
  18348. - || inquote);
  18349. + || inquote);
  18350. s++)
  18351. {
  18352. if (*s == '\'')
  18353. - inquote = ! inquote;
  18354. + inquote = ! inquote;
  18355. }
  18356. *stopcp = *s;
  18357. *s = '\0';
  18358. @@ -1191,9 +1467,9 @@ do_align (n, fill, len, max)
  18359. if (fill == NULL)
  18360. {
  18361. if (subseg_text_p (now_seg))
  18362. - default_fill = NOP_OPCODE;
  18363. + default_fill = NOP_OPCODE;
  18364. else
  18365. - default_fill = 0;
  18366. + default_fill = 0;
  18367. fill = &default_fill;
  18368. len = 1;
  18369. }
  18370. @@ -1202,9 +1478,9 @@ do_align (n, fill, len, max)
  18371. if (n != 0 && !need_pass_2)
  18372. {
  18373. if (len <= 1)
  18374. - frag_align (n, *fill, max);
  18375. + frag_align (n, *fill, max);
  18376. else
  18377. - frag_align_pattern (n, fill, len, max);
  18378. + frag_align_pattern (n, fill, len, max);
  18379. }
  18380. #ifdef md_do_align
  18381. @@ -1237,9 +1513,9 @@ s_align (arg, bytes_p)
  18382. if (is_end_of_line[(unsigned char) *input_line_pointer])
  18383. {
  18384. if (arg < 0)
  18385. - align = 0;
  18386. + align = 0;
  18387. else
  18388. - align = arg; /* Default value from pseudo-op table */
  18389. + align = arg; /* Default value from pseudo-op table */
  18390. }
  18391. else
  18392. {
  18393. @@ -1251,15 +1527,15 @@ s_align (arg, bytes_p)
  18394. {
  18395. /* Convert to a power of 2. */
  18396. if (align != 0)
  18397. - {
  18398. - unsigned int i;
  18399. + {
  18400. + unsigned int i;
  18401. - for (i = 0; (align & 1) == 0; align >>= 1, ++i)
  18402. - ;
  18403. - if (align != 1)
  18404. - as_bad (_("Alignment not a power of 2"));
  18405. - align = i;
  18406. - }
  18407. + for (i = 0; (align & 1) == 0; align >>= 1, ++i)
  18408. + ;
  18409. + if (align != 1)
  18410. + as_bad (_("Alignment not a power of 2"));
  18411. + align = i;
  18412. + }
  18413. }
  18414. if (align > 15)
  18415. @@ -1277,27 +1553,27 @@ s_align (arg, bytes_p)
  18416. {
  18417. ++input_line_pointer;
  18418. if (*input_line_pointer == ',')
  18419. - fill_p = 0;
  18420. + fill_p = 0;
  18421. else
  18422. - {
  18423. - fill = get_absolute_expression ();
  18424. - SKIP_WHITESPACE ();
  18425. - fill_p = 1;
  18426. - }
  18427. + {
  18428. + fill = get_absolute_expression ();
  18429. + SKIP_WHITESPACE ();
  18430. + fill_p = 1;
  18431. + }
  18432. if (*input_line_pointer != ',')
  18433. - max = 0;
  18434. + max = 0;
  18435. else
  18436. - {
  18437. - ++input_line_pointer;
  18438. - max = get_absolute_expression ();
  18439. - }
  18440. + {
  18441. + ++input_line_pointer;
  18442. + max = get_absolute_expression ();
  18443. + }
  18444. }
  18445. if (! fill_p)
  18446. {
  18447. if (arg < 0)
  18448. - as_warn (_("expected fill pattern missing"));
  18449. + as_warn (_("expected fill pattern missing"));
  18450. do_align (align, (char *) NULL, 0, max);
  18451. }
  18452. else
  18453. @@ -1305,25 +1581,25 @@ s_align (arg, bytes_p)
  18454. int fill_len;
  18455. if (arg >= 0)
  18456. - fill_len = 1;
  18457. + fill_len = 1;
  18458. else
  18459. - fill_len = - arg;
  18460. + fill_len = - arg;
  18461. if (fill_len <= 1)
  18462. - {
  18463. - char fill_char;
  18464. + {
  18465. + char fill_char;
  18466. - fill_char = fill;
  18467. - do_align (align, &fill_char, fill_len, max);
  18468. - }
  18469. + fill_char = fill;
  18470. + do_align (align, &fill_char, fill_len, max);
  18471. + }
  18472. else
  18473. - {
  18474. - char ab[16];
  18475. + {
  18476. + char ab[16];
  18477. - if ((size_t) fill_len > sizeof ab)
  18478. - abort ();
  18479. - md_number_to_chars (ab, fill, fill_len);
  18480. - do_align (align, ab, fill_len, max);
  18481. - }
  18482. + if ((size_t) fill_len > sizeof ab)
  18483. + abort ();
  18484. + md_number_to_chars (ab, fill, fill_len);
  18485. + do_align (align, ab, fill_len, max);
  18486. + }
  18487. }
  18488. demand_empty_rest_of_line ();
  18489. @@ -1378,16 +1654,16 @@ s_comm (ignore)
  18490. as_bad (_("Expected comma after symbol-name: rest of line ignored."));
  18491. ignore_rest_of_line ();
  18492. if (flag_mri)
  18493. - mri_comment_end (stop, stopc);
  18494. + mri_comment_end (stop, stopc);
  18495. return;
  18496. }
  18497. - input_line_pointer++; /* skip ',' */
  18498. + input_line_pointer++; /* skip ',' */
  18499. if ((temp = get_absolute_expression ()) < 0)
  18500. {
  18501. as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp);
  18502. ignore_rest_of_line ();
  18503. if (flag_mri)
  18504. - mri_comment_end (stop, stopc);
  18505. + mri_comment_end (stop, stopc);
  18506. return;
  18507. }
  18508. *p = 0;
  18509. @@ -1396,19 +1672,19 @@ s_comm (ignore)
  18510. if (S_IS_DEFINED (symbolP) && ! S_IS_COMMON (symbolP))
  18511. {
  18512. as_bad (_("Ignoring attempt to re-define symbol `%s'."),
  18513. - S_GET_NAME (symbolP));
  18514. + S_GET_NAME (symbolP));
  18515. ignore_rest_of_line ();
  18516. if (flag_mri)
  18517. - mri_comment_end (stop, stopc);
  18518. + mri_comment_end (stop, stopc);
  18519. return;
  18520. }
  18521. if (S_GET_VALUE (symbolP))
  18522. {
  18523. if (S_GET_VALUE (symbolP) != (valueT) temp)
  18524. - as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
  18525. - S_GET_NAME (symbolP),
  18526. - (long) S_GET_VALUE (symbolP),
  18527. - (long) temp);
  18528. + as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
  18529. + S_GET_NAME (symbolP),
  18530. + (long) S_GET_VALUE (symbolP),
  18531. + (long) temp);
  18532. }
  18533. else
  18534. {
  18535. @@ -1428,7 +1704,7 @@ s_comm (ignore)
  18536. if (flag_mri)
  18537. mri_comment_end (stop, stopc);
  18538. -} /* s_comm() */
  18539. +} /* s_comm() */
  18540. /* The MRI COMMON pseudo-op. We handle this by creating a common
  18541. symbol with the appropriate name. We make s_space do the right
  18542. @@ -1462,21 +1738,21 @@ s_mri_common (small)
  18543. else
  18544. {
  18545. do
  18546. - {
  18547. - ++input_line_pointer;
  18548. - }
  18549. + {
  18550. + ++input_line_pointer;
  18551. + }
  18552. while (isdigit ((unsigned char) *input_line_pointer));
  18553. c = *input_line_pointer;
  18554. *input_line_pointer = '\0';
  18555. if (line_label != NULL)
  18556. - {
  18557. - alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
  18558. - + (input_line_pointer - name)
  18559. - + 1);
  18560. - sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
  18561. - name = alc;
  18562. - }
  18563. + {
  18564. + alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
  18565. + + (input_line_pointer - name)
  18566. + + 1);
  18567. + sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
  18568. + name = alc;
  18569. + }
  18570. }
  18571. sym = symbol_find_or_make (name);
  18572. @@ -1575,30 +1851,30 @@ s_app_file (appfile)
  18573. if ((s = demand_copy_string (&length)) != 0)
  18574. {
  18575. /* If this is a fake .appfile, a fake newline was inserted into
  18576. - the buffer. Passing -2 to new_logical_line tells it to
  18577. - account for it. */
  18578. + the buffer. Passing -2 to new_logical_line tells it to
  18579. + account for it. */
  18580. int may_omit
  18581. - = (! new_logical_line (s, appfile ? -2 : -1) && appfile);
  18582. + = (! new_logical_line (s, appfile ? -2 : -1) && appfile);
  18583. /* In MRI mode, the preprocessor may have inserted an extraneous
  18584. backquote. */
  18585. if (flag_m68k_mri
  18586. - && *input_line_pointer == '\''
  18587. - && is_end_of_line[(unsigned char) input_line_pointer[1]])
  18588. - ++input_line_pointer;
  18589. + && *input_line_pointer == '\''
  18590. + && is_end_of_line[(unsigned char) input_line_pointer[1]])
  18591. + ++input_line_pointer;
  18592. demand_empty_rest_of_line ();
  18593. if (! may_omit)
  18594. - {
  18595. + {
  18596. #ifdef LISTING
  18597. - if (listing)
  18598. - listing_source_file (s);
  18599. + if (listing)
  18600. + listing_source_file (s);
  18601. #endif
  18602. - register_dependency (s);
  18603. + register_dependency (s);
  18604. #ifdef obj_app_file
  18605. - obj_app_file (s);
  18606. + obj_app_file (s);
  18607. #endif
  18608. - }
  18609. + }
  18610. }
  18611. }
  18612. @@ -1624,7 +1900,7 @@ s_app_line (ignore)
  18613. new_logical_line ((char *) NULL, l);
  18614. #ifdef LISTING
  18615. if (listing)
  18616. - listing_source_line (l);
  18617. + listing_source_line (l);
  18618. #endif
  18619. }
  18620. demand_empty_rest_of_line ();
  18621. @@ -1643,9 +1919,9 @@ s_end (ignore)
  18622. but we don't support that. */
  18623. SKIP_WHITESPACE ();
  18624. if (! is_end_of_line[(unsigned char) *input_line_pointer]
  18625. - && *input_line_pointer != '*'
  18626. - && *input_line_pointer != '!')
  18627. - as_warn (_("start address not supported"));
  18628. + && *input_line_pointer != '*'
  18629. + && *input_line_pointer != '!')
  18630. + as_warn (_("start address not supported"));
  18631. }
  18632. }
  18633. @@ -1703,10 +1979,10 @@ s_fill (ignore)
  18634. input_line_pointer++;
  18635. size = get_absolute_expression ();
  18636. if (*input_line_pointer == ',')
  18637. - {
  18638. - input_line_pointer++;
  18639. - fill = get_absolute_expression ();
  18640. - }
  18641. + {
  18642. + input_line_pointer++;
  18643. + fill = get_absolute_expression ();
  18644. + }
  18645. }
  18646. /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
  18647. @@ -1724,44 +2000,44 @@ s_fill (ignore)
  18648. else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
  18649. {
  18650. if (rep_exp.X_add_number < 0)
  18651. - as_warn (_("Repeat < 0, .fill ignored"));
  18652. + as_warn (_("Repeat < 0, .fill ignored"));
  18653. size = 0;
  18654. }
  18655. if (size && !need_pass_2)
  18656. {
  18657. if (rep_exp.X_op == O_constant)
  18658. - {
  18659. - p = frag_var (rs_fill, (int) size, (int) size,
  18660. - (relax_substateT) 0, (symbolS *) 0,
  18661. - (offsetT) rep_exp.X_add_number,
  18662. - (char *) 0);
  18663. - }
  18664. + {
  18665. + p = frag_var (rs_fill, (int) size, (int) size,
  18666. + (relax_substateT) 0, (symbolS *) 0,
  18667. + (offsetT) rep_exp.X_add_number,
  18668. + (char *) 0);
  18669. + }
  18670. else
  18671. - {
  18672. - /* We don't have a constant repeat count, so we can't use
  18673. - rs_fill. We can get the same results out of rs_space,
  18674. - but its argument is in bytes, so we must multiply the
  18675. - repeat count by size. */
  18676. -
  18677. - symbolS *rep_sym;
  18678. - rep_sym = make_expr_symbol (&rep_exp);
  18679. - if (size != 1)
  18680. - {
  18681. - expressionS size_exp;
  18682. - size_exp.X_op = O_constant;
  18683. - size_exp.X_add_number = size;
  18684. -
  18685. - rep_exp.X_op = O_multiply;
  18686. - rep_exp.X_add_symbol = rep_sym;
  18687. - rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
  18688. - rep_exp.X_add_number = 0;
  18689. - rep_sym = make_expr_symbol (&rep_exp);
  18690. - }
  18691. -
  18692. - p = frag_var (rs_space, (int) size, (int) size,
  18693. - (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
  18694. - }
  18695. + {
  18696. + /* We don't have a constant repeat count, so we can't use
  18697. + rs_fill. We can get the same results out of rs_space,
  18698. + but its argument is in bytes, so we must multiply the
  18699. + repeat count by size. */
  18700. +
  18701. + symbolS *rep_sym;
  18702. + rep_sym = make_expr_symbol (&rep_exp);
  18703. + if (size != 1)
  18704. + {
  18705. + expressionS size_exp;
  18706. + size_exp.X_op = O_constant;
  18707. + size_exp.X_add_number = size;
  18708. +
  18709. + rep_exp.X_op = O_multiply;
  18710. + rep_exp.X_add_symbol = rep_sym;
  18711. + rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
  18712. + rep_exp.X_add_number = 0;
  18713. + rep_sym = make_expr_symbol (&rep_exp);
  18714. + }
  18715. +
  18716. + p = frag_var (rs_space, (int) size, (int) size,
  18717. + (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
  18718. + }
  18719. memset (p, 0, (unsigned int) size);
  18720. /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
  18721. * flavoured AS. The following bizzare behaviour is to be
  18722. @@ -1770,9 +2046,9 @@ s_fill (ignore)
  18723. * extend. Un*x Sux. */
  18724. #define BSD_FILL_SIZE_CROCK_4 (4)
  18725. md_number_to_chars (p, (valueT) fill,
  18726. - (size > BSD_FILL_SIZE_CROCK_4
  18727. - ? BSD_FILL_SIZE_CROCK_4
  18728. - : (int) size));
  18729. + (size > BSD_FILL_SIZE_CROCK_4
  18730. + ? BSD_FILL_SIZE_CROCK_4
  18731. + : (int) size));
  18732. /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
  18733. * but emits no error message because it seems a legal thing to do.
  18734. * It is a degenerate case of .fill but could be emitted by a compiler.
  18735. @@ -1805,12 +2081,12 @@ s_globl (ignore)
  18736. SKIP_WHITESPACE ();
  18737. c = *input_line_pointer;
  18738. if (c == ',')
  18739. - {
  18740. - input_line_pointer++;
  18741. - SKIP_WHITESPACE ();
  18742. - if (*input_line_pointer == '\n')
  18743. - c = '\n';
  18744. - }
  18745. + {
  18746. + input_line_pointer++;
  18747. + SKIP_WHITESPACE ();
  18748. + if (*input_line_pointer == '\n')
  18749. + c = '\n';
  18750. + }
  18751. }
  18752. while (c == ',');
  18753. @@ -1874,15 +2150,15 @@ s_linkonce (ignore)
  18754. s = input_line_pointer;
  18755. c = get_symbol_end ();
  18756. if (strcasecmp (s, "discard") == 0)
  18757. - type = LINKONCE_DISCARD;
  18758. + type = LINKONCE_DISCARD;
  18759. else if (strcasecmp (s, "one_only") == 0)
  18760. - type = LINKONCE_ONE_ONLY;
  18761. + type = LINKONCE_ONE_ONLY;
  18762. else if (strcasecmp (s, "same_size") == 0)
  18763. - type = LINKONCE_SAME_SIZE;
  18764. + type = LINKONCE_SAME_SIZE;
  18765. else if (strcasecmp (s, "same_contents") == 0)
  18766. - type = LINKONCE_SAME_CONTENTS;
  18767. + type = LINKONCE_SAME_CONTENTS;
  18768. else
  18769. - as_warn (_("unrecognized .linkonce type `%s'"), s);
  18770. + as_warn (_("unrecognized .linkonce type `%s'"), s);
  18771. *input_line_pointer = c;
  18772. }
  18773. @@ -1902,23 +2178,23 @@ s_linkonce (ignore)
  18774. switch (type)
  18775. {
  18776. default:
  18777. - abort ();
  18778. + abort ();
  18779. case LINKONCE_DISCARD:
  18780. - flags |= SEC_LINK_DUPLICATES_DISCARD;
  18781. - break;
  18782. + flags |= SEC_LINK_DUPLICATES_DISCARD;
  18783. + break;
  18784. case LINKONCE_ONE_ONLY:
  18785. - flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
  18786. - break;
  18787. + flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
  18788. + break;
  18789. case LINKONCE_SAME_SIZE:
  18790. - flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
  18791. - break;
  18792. + flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
  18793. + break;
  18794. case LINKONCE_SAME_CONTENTS:
  18795. - flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
  18796. - break;
  18797. + flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
  18798. + break;
  18799. }
  18800. if (! bfd_set_section_flags (stdoutput, now_seg, flags))
  18801. as_bad (_("bfd_set_section_flags: %s"),
  18802. - bfd_errmsg (bfd_get_error ()));
  18803. + bfd_errmsg (bfd_get_error ()));
  18804. }
  18805. #else /* ! defined (BFD_ASSEMBLER) */
  18806. as_warn (_(".linkonce is not supported for this object file format"));
  18807. @@ -1931,10 +2207,10 @@ s_linkonce (ignore)
  18808. static void
  18809. s_lcomm_internal (needs_align, bytes_p)
  18810. /* 1 if this was a ".bss" directive, which may require a 3rd argument
  18811. - (alignment); 0 if it was an ".lcomm" (2 args only) */
  18812. + (alignment); 0 if it was an ".lcomm" (2 args only) */
  18813. int needs_align;
  18814. /* 1 if the alignment value should be interpreted as the byte boundary,
  18815. - rather than the power of 2. */
  18816. + rather than the power of 2. */
  18817. int bytes_p;
  18818. {
  18819. register char *name;
  18820. @@ -1981,15 +2257,15 @@ s_lcomm_internal (needs_align, bytes_p)
  18821. {
  18822. /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
  18823. if (temp <= bfd_get_gp_size (stdoutput))
  18824. - {
  18825. - bss_seg = subseg_new (".sbss", 1);
  18826. - seg_info (bss_seg)->bss = 1;
  18827. + {
  18828. + bss_seg = subseg_new (".sbss", 1);
  18829. + seg_info (bss_seg)->bss = 1;
  18830. #ifdef BFD_ASSEMBLER
  18831. - if (! bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
  18832. - as_warn (_("error setting flags for \".sbss\": %s"),
  18833. - bfd_errmsg (bfd_get_error ()));
  18834. + if (! bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
  18835. + as_warn (_("error setting flags for \".sbss\": %s"),
  18836. + bfd_errmsg (bfd_get_error ()));
  18837. #endif
  18838. - }
  18839. + }
  18840. }
  18841. #endif
  18842. @@ -2007,55 +2283,55 @@ s_lcomm_internal (needs_align, bytes_p)
  18843. align = 0;
  18844. SKIP_WHITESPACE ();
  18845. if (*input_line_pointer != ',')
  18846. - {
  18847. - as_bad (_("Expected comma after size"));
  18848. - ignore_rest_of_line ();
  18849. - return;
  18850. - }
  18851. + {
  18852. + as_bad (_("Expected comma after size"));
  18853. + ignore_rest_of_line ();
  18854. + return;
  18855. + }
  18856. input_line_pointer++;
  18857. SKIP_WHITESPACE ();
  18858. if (*input_line_pointer == '\n')
  18859. - {
  18860. - as_bad (_("Missing alignment"));
  18861. - return;
  18862. - }
  18863. + {
  18864. + as_bad (_("Missing alignment"));
  18865. + return;
  18866. + }
  18867. align = get_absolute_expression ();
  18868. if (bytes_p)
  18869. - {
  18870. - /* Convert to a power of 2. */
  18871. - if (align != 0)
  18872. - {
  18873. - unsigned int i;
  18874. -
  18875. - for (i = 0; (align & 1) == 0; align >>= 1, ++i)
  18876. - ;
  18877. - if (align != 1)
  18878. - as_bad (_("Alignment not a power of 2"));
  18879. - align = i;
  18880. - }
  18881. - }
  18882. + {
  18883. + /* Convert to a power of 2. */
  18884. + if (align != 0)
  18885. + {
  18886. + unsigned int i;
  18887. +
  18888. + for (i = 0; (align & 1) == 0; align >>= 1, ++i)
  18889. + ;
  18890. + if (align != 1)
  18891. + as_bad (_("Alignment not a power of 2"));
  18892. + align = i;
  18893. + }
  18894. + }
  18895. if (align > max_alignment)
  18896. - {
  18897. - align = max_alignment;
  18898. - as_warn (_("Alignment too large: %d. assumed."), align);
  18899. - }
  18900. + {
  18901. + align = max_alignment;
  18902. + as_warn (_("Alignment too large: %d. assumed."), align);
  18903. + }
  18904. else if (align < 0)
  18905. - {
  18906. - align = 0;
  18907. - as_warn (_("Alignment negative. 0 assumed."));
  18908. - }
  18909. + {
  18910. + align = 0;
  18911. + as_warn (_("Alignment negative. 0 assumed."));
  18912. + }
  18913. record_alignment (bss_seg, align);
  18914. - } /* if needs align */
  18915. + } /* if needs align */
  18916. else
  18917. {
  18918. /* Assume some objects may require alignment on some systems. */
  18919. #if defined (TC_ALPHA) && ! defined (VMS)
  18920. if (temp > 1)
  18921. - {
  18922. - align = ffs (temp) - 1;
  18923. - if (temp % (1 << align))
  18924. - abort ();
  18925. - }
  18926. + {
  18927. + align = ffs (temp) - 1;
  18928. + if (temp % (1 << align))
  18929. + abort ();
  18930. + }
  18931. #endif
  18932. }
  18933. @@ -2081,14 +2357,14 @@ s_lcomm_internal (needs_align, bytes_p)
  18934. subseg_set (bss_seg, 1);
  18935. if (align)
  18936. - frag_align (align, 0, 0);
  18937. - /* detach from old frag */
  18938. + frag_align (align, 0, 0);
  18939. + /* detach from old frag */
  18940. if (S_GET_SEGMENT (symbolP) == bss_seg)
  18941. - symbol_get_frag (symbolP)->fr_symbol = NULL;
  18942. + symbol_get_frag (symbolP)->fr_symbol = NULL;
  18943. symbol_set_frag (symbolP, frag_now);
  18944. pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
  18945. - (offsetT) temp, (char *) 0);
  18946. + (offsetT) temp, (char *) 0);
  18947. *pfrag = 0;
  18948. S_SET_SEGMENT (symbolP, bss_seg);
  18949. @@ -2098,9 +2374,9 @@ s_lcomm_internal (needs_align, bytes_p)
  18950. ".globl" directive -- be careful not to step on storage class
  18951. in that case. Otherwise, set it to static. */
  18952. if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
  18953. - {
  18954. - S_SET_STORAGE_CLASS (symbolP, C_STAT);
  18955. - }
  18956. + {
  18957. + S_SET_STORAGE_CLASS (symbolP, C_STAT);
  18958. + }
  18959. #endif /* OBJ_COFF */
  18960. #ifdef S_SET_SIZE
  18961. @@ -2109,12 +2385,12 @@ s_lcomm_internal (needs_align, bytes_p)
  18962. }
  18963. else
  18964. as_bad (_("Ignoring attempt to re-define symbol `%s'."),
  18965. - S_GET_NAME (symbolP));
  18966. + S_GET_NAME (symbolP));
  18967. subseg_set (current_seg, current_subseg);
  18968. demand_empty_rest_of_line ();
  18969. -} /* s_lcomm_internal() */
  18970. +} /* s_lcomm_internal() */
  18971. void
  18972. s_lcomm (needs_align)
  18973. @@ -2176,11 +2452,11 @@ s_lsym (ignore)
  18974. && S_GET_VALUE (symbolP) == 0)
  18975. {
  18976. /* The name might be an undefined .global symbol; be sure to
  18977. - keep the "external" bit. */
  18978. + keep the "external" bit. */
  18979. S_SET_SEGMENT (symbolP,
  18980. - (exp.X_op == O_constant
  18981. - ? absolute_section
  18982. - : reg_section));
  18983. + (exp.X_op == O_constant
  18984. + ? absolute_section
  18985. + : reg_section));
  18986. S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
  18987. }
  18988. else
  18989. @@ -2189,7 +2465,7 @@ s_lsym (ignore)
  18990. }
  18991. *p = c;
  18992. demand_empty_rest_of_line ();
  18993. -} /* s_lsym() */
  18994. +} /* s_lsym() */
  18995. /* Read a line into an sb. */
  18996. @@ -2206,7 +2482,7 @@ get_line_sb (line)
  18997. {
  18998. buffer_limit = input_scrub_next_buffer (&input_line_pointer);
  18999. if (buffer_limit == 0)
  19000. - return 0;
  19001. + return 0;
  19002. }
  19003. /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
  19004. @@ -2225,24 +2501,24 @@ get_line_sb (line)
  19005. inquote = '\0';
  19006. while (! is_end_of_line[(unsigned char) *input_line_pointer]
  19007. - || (inquote != '\0' && *input_line_pointer != '\n'))
  19008. + || (inquote != '\0' && *input_line_pointer != '\n'))
  19009. {
  19010. if (inquote == *input_line_pointer)
  19011. - inquote = '\0';
  19012. + inquote = '\0';
  19013. else if (inquote == '\0')
  19014. - {
  19015. - if (*input_line_pointer == quote1)
  19016. - inquote = quote1;
  19017. - else if (*input_line_pointer == quote2)
  19018. - inquote = quote2;
  19019. - }
  19020. + {
  19021. + if (*input_line_pointer == quote1)
  19022. + inquote = quote1;
  19023. + else if (*input_line_pointer == quote2)
  19024. + inquote = quote2;
  19025. + }
  19026. sb_add_char (line, *input_line_pointer++);
  19027. }
  19028. while (input_line_pointer < buffer_limit
  19029. - && is_end_of_line[(unsigned char) *input_line_pointer])
  19030. + && is_end_of_line[(unsigned char) *input_line_pointer])
  19031. {
  19032. if (input_line_pointer[-1] == '\n')
  19033. - bump_line_counters ();
  19034. + bump_line_counters ();
  19035. ++input_line_pointer;
  19036. }
  19037. return 1;
  19038. @@ -2278,19 +2554,19 @@ s_macro (ignore)
  19039. else
  19040. {
  19041. if (line_label != NULL)
  19042. - {
  19043. - S_SET_SEGMENT (line_label, undefined_section);
  19044. - S_SET_VALUE (line_label, 0);
  19045. - symbol_set_frag (line_label, &zero_address_frag);
  19046. - }
  19047. + {
  19048. + S_SET_SEGMENT (line_label, undefined_section);
  19049. + S_SET_VALUE (line_label, 0);
  19050. + symbol_set_frag (line_label, &zero_address_frag);
  19051. + }
  19052. if (((NO_PSEUDO_DOT || flag_m68k_mri)
  19053. - && hash_find (po_hash, name) != NULL)
  19054. - || (! flag_m68k_mri
  19055. - && *name == '.'
  19056. - && hash_find (po_hash, name + 1) != NULL))
  19057. - as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
  19058. - name);
  19059. + && hash_find (po_hash, name) != NULL)
  19060. + || (! flag_m68k_mri
  19061. + && *name == '.'
  19062. + && hash_find (po_hash, name + 1) != NULL))
  19063. + as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
  19064. + name);
  19065. }
  19066. sb_kill (&s);
  19067. @@ -2356,17 +2632,17 @@ do_org (segment, exp, fill)
  19068. {
  19069. if (segment != now_seg && segment != absolute_section)
  19070. as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"),
  19071. - segment_name (segment), segment_name (now_seg));
  19072. + segment_name (segment), segment_name (now_seg));
  19073. if (now_seg == absolute_section)
  19074. {
  19075. if (fill != 0)
  19076. - as_warn (_("ignoring fill value in absolute section"));
  19077. + as_warn (_("ignoring fill value in absolute section"));
  19078. if (exp->X_op != O_constant)
  19079. - {
  19080. - as_bad (_("only constant offsets supported in absolute section"));
  19081. - exp->X_add_number = 0;
  19082. - }
  19083. + {
  19084. + as_bad (_("only constant offsets supported in absolute section"));
  19085. + exp->X_add_number = 0;
  19086. + }
  19087. abs_section_offset = exp->X_add_number;
  19088. }
  19089. else
  19090. @@ -2374,7 +2650,7 @@ do_org (segment, exp, fill)
  19091. char *p;
  19092. p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
  19093. - exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
  19094. + exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
  19095. *p = fill;
  19096. }
  19097. }
  19098. @@ -2426,7 +2702,7 @@ s_org (ignore)
  19099. do_org (segment, &exp, temp_fill);
  19100. demand_empty_rest_of_line ();
  19101. -} /* s_org() */
  19102. +} /* s_org() */
  19103. /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
  19104. called by the obj-format routine which handles section changing
  19105. @@ -2453,9 +2729,9 @@ s_mri_sect (type)
  19106. else
  19107. {
  19108. do
  19109. - {
  19110. - ++input_line_pointer;
  19111. - }
  19112. + {
  19113. + ++input_line_pointer;
  19114. + }
  19115. while (isdigit ((unsigned char) *input_line_pointer));
  19116. c = *input_line_pointer;
  19117. *input_line_pointer = '\0';
  19118. @@ -2482,29 +2758,29 @@ s_mri_sect (type)
  19119. c = *++input_line_pointer;
  19120. c = toupper ((unsigned char) c);
  19121. if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
  19122. - *type = c;
  19123. + *type = c;
  19124. else
  19125. - as_bad (_("unrecognized section type"));
  19126. + as_bad (_("unrecognized section type"));
  19127. ++input_line_pointer;
  19128. #ifdef BFD_ASSEMBLER
  19129. {
  19130. - flagword flags;
  19131. -
  19132. - flags = SEC_NO_FLAGS;
  19133. - if (*type == 'C')
  19134. - flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
  19135. - else if (*type == 'D' || *type == 'M')
  19136. - flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
  19137. - else if (*type == 'R')
  19138. - flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
  19139. - if (flags != SEC_NO_FLAGS)
  19140. - {
  19141. - if (! bfd_set_section_flags (stdoutput, seg, flags))
  19142. - as_warn (_("error setting flags for \"%s\": %s"),
  19143. - bfd_section_name (stdoutput, seg),
  19144. - bfd_errmsg (bfd_get_error ()));
  19145. - }
  19146. + flagword flags;
  19147. +
  19148. + flags = SEC_NO_FLAGS;
  19149. + if (*type == 'C')
  19150. + flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
  19151. + else if (*type == 'D' || *type == 'M')
  19152. + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
  19153. + else if (*type == 'R')
  19154. + flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
  19155. + if (flags != SEC_NO_FLAGS)
  19156. + {
  19157. + if (! bfd_set_section_flags (stdoutput, seg, flags))
  19158. + as_warn (_("error setting flags for \"%s\": %s"),
  19159. + bfd_section_name (stdoutput, seg),
  19160. + bfd_errmsg (bfd_get_error ()));
  19161. + }
  19162. }
  19163. #endif
  19164. }
  19165. @@ -2544,15 +2820,15 @@ s_mri_sect (type)
  19166. sectype = input_line_pointer;
  19167. c = get_symbol_end ();
  19168. if (*sectype == '\0')
  19169. - *type = 'C';
  19170. + *type = 'C';
  19171. else if (strcasecmp (sectype, "text") == 0)
  19172. - *type = 'C';
  19173. + *type = 'C';
  19174. else if (strcasecmp (sectype, "data") == 0)
  19175. - *type = 'D';
  19176. + *type = 'D';
  19177. else if (strcasecmp (sectype, "romdata") == 0)
  19178. - *type = 'R';
  19179. + *type = 'R';
  19180. else
  19181. - as_warn (_("unrecognized section type `%s'"), sectype);
  19182. + as_warn (_("unrecognized section type `%s'"), sectype);
  19183. *input_line_pointer = c;
  19184. }
  19185. @@ -2565,28 +2841,28 @@ s_mri_sect (type)
  19186. seccmd = input_line_pointer;
  19187. c = get_symbol_end ();
  19188. if (strcasecmp (seccmd, "absolute") == 0)
  19189. - {
  19190. - as_bad (_("absolute sections are not supported"));
  19191. - *input_line_pointer = c;
  19192. - ignore_rest_of_line ();
  19193. - return;
  19194. - }
  19195. + {
  19196. + as_bad (_("absolute sections are not supported"));
  19197. + *input_line_pointer = c;
  19198. + ignore_rest_of_line ();
  19199. + return;
  19200. + }
  19201. else if (strcasecmp (seccmd, "align") == 0)
  19202. - {
  19203. - int align;
  19204. + {
  19205. + int align;
  19206. - *input_line_pointer = c;
  19207. - align = get_absolute_expression ();
  19208. - record_alignment (seg, align);
  19209. - }
  19210. + *input_line_pointer = c;
  19211. + align = get_absolute_expression ();
  19212. + record_alignment (seg, align);
  19213. + }
  19214. else
  19215. - {
  19216. - as_warn (_("unrecognized section command `%s'"), seccmd);
  19217. - *input_line_pointer = c;
  19218. - }
  19219. + {
  19220. + as_warn (_("unrecognized section command `%s'"), seccmd);
  19221. + *input_line_pointer = c;
  19222. + }
  19223. }
  19224. - demand_empty_rest_of_line ();
  19225. + demand_empty_rest_of_line ();
  19226. #else /* ! TC_I960 */
  19227. /* The MRI assembler seems to use different forms of .sect for
  19228. @@ -2746,7 +3022,7 @@ s_set (equiv)
  19229. segment = get_known_segmented_expression (&exp);
  19230. if (!need_pass_2)
  19231. - do_org (segment, &exp, 0);
  19232. + do_org (segment, &exp, 0);
  19233. *end_name = delim;
  19234. return;
  19235. @@ -2757,28 +3033,28 @@ s_set (equiv)
  19236. {
  19237. #ifndef NO_LISTING
  19238. /* When doing symbol listings, play games with dummy fragments living
  19239. - outside the normal fragment chain to record the file and line info
  19240. + outside the normal fragment chain to record the file and line info
  19241. for this symbol. */
  19242. if (listing & LISTING_SYMBOLS)
  19243. - {
  19244. - extern struct list_info_struct *listing_tail;
  19245. - fragS *dummy_frag = (fragS *) xmalloc (sizeof(fragS));
  19246. - memset (dummy_frag, 0, sizeof(fragS));
  19247. - dummy_frag->fr_type = rs_fill;
  19248. - dummy_frag->line = listing_tail;
  19249. - symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
  19250. - dummy_frag->fr_symbol = symbolP;
  19251. - }
  19252. + {
  19253. + extern struct list_info_struct *listing_tail;
  19254. + fragS *dummy_frag = (fragS *) xmalloc (sizeof(fragS));
  19255. + memset (dummy_frag, 0, sizeof(fragS));
  19256. + dummy_frag->fr_type = rs_fill;
  19257. + dummy_frag->line = listing_tail;
  19258. + symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
  19259. + dummy_frag->fr_symbol = symbolP;
  19260. + }
  19261. else
  19262. #endif
  19263. symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag);
  19264. -
  19265. +
  19266. #ifdef OBJ_COFF
  19267. /* "set" symbols are local unless otherwise specified. */
  19268. SF_SET_LOCAL (symbolP);
  19269. #endif /* OBJ_COFF */
  19270. - } /* make a new symbol */
  19271. + } /* make a new symbol */
  19272. symbol_table_insert (symbolP);
  19273. @@ -2791,7 +3067,7 @@ s_set (equiv)
  19274. pseudo_set (symbolP);
  19275. demand_empty_rest_of_line ();
  19276. -} /* s_set() */
  19277. +} /* s_set() */
  19278. void
  19279. s_space (mult)
  19280. @@ -2816,39 +3092,39 @@ s_space (mult)
  19281. if (flag_m68k_mri && mult > 1)
  19282. {
  19283. if (now_seg == absolute_section)
  19284. - {
  19285. - abs_section_offset += abs_section_offset & 1;
  19286. - if (line_label != NULL)
  19287. - S_SET_VALUE (line_label, abs_section_offset);
  19288. - }
  19289. + {
  19290. + abs_section_offset += abs_section_offset & 1;
  19291. + if (line_label != NULL)
  19292. + S_SET_VALUE (line_label, abs_section_offset);
  19293. + }
  19294. else if (mri_common_symbol != NULL)
  19295. - {
  19296. - valueT val;
  19297. -
  19298. - val = S_GET_VALUE (mri_common_symbol);
  19299. - if ((val & 1) != 0)
  19300. - {
  19301. - S_SET_VALUE (mri_common_symbol, val + 1);
  19302. - if (line_label != NULL)
  19303. - {
  19304. - expressionS *symexp;
  19305. -
  19306. - symexp = symbol_get_value_expression (line_label);
  19307. - know (symexp->X_op == O_symbol);
  19308. - know (symexp->X_add_symbol == mri_common_symbol);
  19309. - symexp->X_add_number += 1;
  19310. - }
  19311. - }
  19312. - }
  19313. + {
  19314. + valueT val;
  19315. +
  19316. + val = S_GET_VALUE (mri_common_symbol);
  19317. + if ((val & 1) != 0)
  19318. + {
  19319. + S_SET_VALUE (mri_common_symbol, val + 1);
  19320. + if (line_label != NULL)
  19321. + {
  19322. + expressionS *symexp;
  19323. +
  19324. + symexp = symbol_get_value_expression (line_label);
  19325. + know (symexp->X_op == O_symbol);
  19326. + know (symexp->X_add_symbol == mri_common_symbol);
  19327. + symexp->X_add_number += 1;
  19328. + }
  19329. + }
  19330. + }
  19331. else
  19332. - {
  19333. - do_align (1, (char *) NULL, 0, 0);
  19334. - if (line_label != NULL)
  19335. - {
  19336. - symbol_set_frag (line_label, frag_now);
  19337. - S_SET_VALUE (line_label, frag_now_fix ());
  19338. - }
  19339. - }
  19340. + {
  19341. + do_align (1, (char *) NULL, 0, 0);
  19342. + if (line_label != NULL)
  19343. + {
  19344. + symbol_set_frag (line_label, frag_now);
  19345. + S_SET_VALUE (line_label, frag_now_fix ());
  19346. + }
  19347. + }
  19348. }
  19349. bytes = mult;
  19350. @@ -2873,77 +3149,77 @@ s_space (mult)
  19351. || (mult != 0 && mult != 1 && val.X_add_number != 0))
  19352. {
  19353. if (exp.X_op != O_constant)
  19354. - as_bad (_("Unsupported variable size or fill value"));
  19355. + as_bad (_("Unsupported variable size or fill value"));
  19356. else
  19357. - {
  19358. - offsetT i;
  19359. + {
  19360. + offsetT i;
  19361. - if (mult == 0)
  19362. - mult = 1;
  19363. - bytes = mult * exp.X_add_number;
  19364. - for (i = 0; i < exp.X_add_number; i++)
  19365. - emit_expr (&val, mult);
  19366. - }
  19367. + if (mult == 0)
  19368. + mult = 1;
  19369. + bytes = mult * exp.X_add_number;
  19370. + for (i = 0; i < exp.X_add_number; i++)
  19371. + emit_expr (&val, mult);
  19372. + }
  19373. }
  19374. else
  19375. {
  19376. if (exp.X_op == O_constant)
  19377. - {
  19378. - long repeat;
  19379. -
  19380. - repeat = exp.X_add_number;
  19381. - if (mult)
  19382. - repeat *= mult;
  19383. - bytes = repeat;
  19384. - if (repeat <= 0)
  19385. - {
  19386. - if (! flag_mri)
  19387. - as_warn (_(".space repeat count is zero, ignored"));
  19388. - else if (repeat < 0)
  19389. - as_warn (_(".space repeat count is negative, ignored"));
  19390. - goto getout;
  19391. - }
  19392. -
  19393. - /* If we are in the absolute section, just bump the offset. */
  19394. - if (now_seg == absolute_section)
  19395. - {
  19396. - abs_section_offset += repeat;
  19397. - goto getout;
  19398. - }
  19399. -
  19400. - /* If we are secretly in an MRI common section, then
  19401. - creating space just increases the size of the common
  19402. - symbol. */
  19403. - if (mri_common_symbol != NULL)
  19404. - {
  19405. - S_SET_VALUE (mri_common_symbol,
  19406. - S_GET_VALUE (mri_common_symbol) + repeat);
  19407. - goto getout;
  19408. - }
  19409. -
  19410. - if (!need_pass_2)
  19411. - p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
  19412. - (offsetT) repeat, (char *) 0);
  19413. - }
  19414. + {
  19415. + long repeat;
  19416. +
  19417. + repeat = exp.X_add_number;
  19418. + if (mult)
  19419. + repeat *= mult;
  19420. + bytes = repeat;
  19421. + if (repeat <= 0)
  19422. + {
  19423. + if (! flag_mri)
  19424. + as_warn (_(".space repeat count is zero, ignored"));
  19425. + else if (repeat < 0)
  19426. + as_warn (_(".space repeat count is negative, ignored"));
  19427. + goto getout;
  19428. + }
  19429. +
  19430. + /* If we are in the absolute section, just bump the offset. */
  19431. + if (now_seg == absolute_section)
  19432. + {
  19433. + abs_section_offset += repeat;
  19434. + goto getout;
  19435. + }
  19436. +
  19437. + /* If we are secretly in an MRI common section, then
  19438. + creating space just increases the size of the common
  19439. + symbol. */
  19440. + if (mri_common_symbol != NULL)
  19441. + {
  19442. + S_SET_VALUE (mri_common_symbol,
  19443. + S_GET_VALUE (mri_common_symbol) + repeat);
  19444. + goto getout;
  19445. + }
  19446. +
  19447. + if (!need_pass_2)
  19448. + p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
  19449. + (offsetT) repeat, (char *) 0);
  19450. + }
  19451. else
  19452. - {
  19453. - if (now_seg == absolute_section)
  19454. - {
  19455. - as_bad (_("space allocation too complex in absolute section"));
  19456. - subseg_set (text_section, 0);
  19457. - }
  19458. - if (mri_common_symbol != NULL)
  19459. - {
  19460. - as_bad (_("space allocation too complex in common section"));
  19461. - mri_common_symbol = NULL;
  19462. - }
  19463. - if (!need_pass_2)
  19464. - p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
  19465. - make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
  19466. - }
  19467. + {
  19468. + if (now_seg == absolute_section)
  19469. + {
  19470. + as_bad (_("space allocation too complex in absolute section"));
  19471. + subseg_set (text_section, 0);
  19472. + }
  19473. + if (mri_common_symbol != NULL)
  19474. + {
  19475. + as_bad (_("space allocation too complex in common section"));
  19476. + mri_common_symbol = NULL;
  19477. + }
  19478. + if (!need_pass_2)
  19479. + p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
  19480. + make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
  19481. + }
  19482. if (p)
  19483. - *p = val.X_add_number;
  19484. + *p = val.X_add_number;
  19485. }
  19486. getout:
  19487. @@ -2985,7 +3261,7 @@ s_float_space (float_type)
  19488. as_bad (_("missing value"));
  19489. ignore_rest_of_line ();
  19490. if (flag_mri)
  19491. - mri_comment_end (stop, stopc);
  19492. + mri_comment_end (stop, stopc);
  19493. return;
  19494. }
  19495. @@ -3005,12 +3281,12 @@ s_float_space (float_type)
  19496. {
  19497. flen = hex_float (float_type, temp);
  19498. if (flen < 0)
  19499. - {
  19500. - ignore_rest_of_line ();
  19501. - if (flag_mri)
  19502. - mri_comment_end (stop, stopc);
  19503. - return;
  19504. - }
  19505. + {
  19506. + ignore_rest_of_line ();
  19507. + if (flag_mri)
  19508. + mri_comment_end (stop, stopc);
  19509. + return;
  19510. + }
  19511. }
  19512. else
  19513. {
  19514. @@ -3020,13 +3296,13 @@ s_float_space (float_type)
  19515. know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
  19516. know (flen > 0);
  19517. if (err)
  19518. - {
  19519. - as_bad (_("Bad floating literal: %s"), err);
  19520. - ignore_rest_of_line ();
  19521. - if (flag_mri)
  19522. - mri_comment_end (stop, stopc);
  19523. - return;
  19524. - }
  19525. + {
  19526. + as_bad (_("Bad floating literal: %s"), err);
  19527. + ignore_rest_of_line ();
  19528. + if (flag_mri)
  19529. + mri_comment_end (stop, stopc);
  19530. + return;
  19531. + }
  19532. }
  19533. while (--count >= 0)
  19534. @@ -3073,7 +3349,7 @@ s_text (ignore)
  19535. #ifdef OBJ_VMS
  19536. const_flag &= ~IN_DEFAULT_SECTION;
  19537. #endif
  19538. -} /* s_text() */
  19539. +} /* s_text() */
  19540. void
  19541. @@ -3089,26 +3365,26 @@ demand_empty_rest_of_line ()
  19542. ignore_rest_of_line ();
  19543. }
  19544. /* Return having already swallowed end-of-line. */
  19545. -} /* Return pointing just after end-of-line. */
  19546. +} /* Return pointing just after end-of-line. */
  19547. void
  19548. -ignore_rest_of_line () /* For suspect lines: gives warning. */
  19549. +ignore_rest_of_line () /* For suspect lines: gives warning. */
  19550. {
  19551. if (!is_end_of_line[(unsigned char) *input_line_pointer])
  19552. {
  19553. if (isprint ((unsigned char) *input_line_pointer))
  19554. - as_bad (_("Rest of line ignored. First ignored character is `%c'."),
  19555. - *input_line_pointer);
  19556. + as_bad (_("Rest of line ignored. First ignored character is `%c'."),
  19557. + *input_line_pointer);
  19558. else
  19559. - as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
  19560. - *input_line_pointer);
  19561. + as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
  19562. + *input_line_pointer);
  19563. while (input_line_pointer < buffer_limit
  19564. - && !is_end_of_line[(unsigned char) *input_line_pointer])
  19565. - {
  19566. - input_line_pointer++;
  19567. - }
  19568. + && !is_end_of_line[(unsigned char) *input_line_pointer])
  19569. + {
  19570. + input_line_pointer++;
  19571. + }
  19572. }
  19573. - input_line_pointer++; /* Return pointing just after end-of-line. */
  19574. + input_line_pointer++; /* Return pointing just after end-of-line. */
  19575. know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
  19576. }
  19577. @@ -3125,14 +3401,14 @@ discard_rest_of_line ()
  19578. }
  19579. /*
  19580. - * pseudo_set()
  19581. + * pseudo_set()
  19582. *
  19583. - * In: Pointer to a symbol.
  19584. - * Input_line_pointer->expression.
  19585. + * In: Pointer to a symbol.
  19586. + * Input_line_pointer->expression.
  19587. *
  19588. - * Out: Input_line_pointer->just after any whitespace after expression.
  19589. - * Tried to set symbol to value of expression.
  19590. - * Will change symbols type, value, and frag;
  19591. + * Out: Input_line_pointer->just after any whitespace after expression.
  19592. + * Tried to set symbol to value of expression.
  19593. + * Will change symbols type, value, and frag;
  19594. */
  19595. void
  19596. pseudo_set (symbolP)
  19597. @@ -3143,7 +3419,7 @@ pseudo_set (symbolP)
  19598. int ext;
  19599. #endif /* OBJ_AOUT or OBJ_BOUT */
  19600. - know (symbolP); /* NULL pointer is logic error. */
  19601. + know (symbolP); /* NULL pointer is logic error. */
  19602. #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
  19603. ext = S_IS_EXTERNAL (symbolP);
  19604. #endif /* OBJ_AOUT or OBJ_BOUT */
  19605. @@ -3157,20 +3433,20 @@ pseudo_set (symbolP)
  19606. else if (exp.X_op == O_big)
  19607. {
  19608. if (exp.X_add_number > 0)
  19609. - as_bad (_("bignum invalid; zero assumed"));
  19610. + as_bad (_("bignum invalid; zero assumed"));
  19611. else
  19612. - as_bad (_("floating point number invalid; zero assumed"));
  19613. + as_bad (_("floating point number invalid; zero assumed"));
  19614. }
  19615. else if (exp.X_op == O_subtract
  19616. - && (S_GET_SEGMENT (exp.X_add_symbol)
  19617. - == S_GET_SEGMENT (exp.X_op_symbol))
  19618. - && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
  19619. - && (symbol_get_frag (exp.X_add_symbol)
  19620. - == symbol_get_frag (exp.X_op_symbol)))
  19621. + && (S_GET_SEGMENT (exp.X_add_symbol)
  19622. + == S_GET_SEGMENT (exp.X_op_symbol))
  19623. + && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
  19624. + && (symbol_get_frag (exp.X_add_symbol)
  19625. + == symbol_get_frag (exp.X_op_symbol)))
  19626. {
  19627. exp.X_op = O_constant;
  19628. exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
  19629. - - S_GET_VALUE (exp.X_op_symbol));
  19630. + - S_GET_VALUE (exp.X_op_symbol));
  19631. }
  19632. switch (exp.X_op)
  19633. @@ -3184,9 +3460,9 @@ pseudo_set (symbolP)
  19634. S_SET_SEGMENT (symbolP, absolute_section);
  19635. #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
  19636. if (ext)
  19637. - S_SET_EXTERNAL (symbolP);
  19638. + S_SET_EXTERNAL (symbolP);
  19639. else
  19640. - S_CLEAR_EXTERNAL (symbolP);
  19641. + S_CLEAR_EXTERNAL (symbolP);
  19642. #endif /* OBJ_AOUT or OBJ_BOUT */
  19643. S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
  19644. if (exp.X_op != O_constant)
  19645. @@ -3201,38 +3477,38 @@ pseudo_set (symbolP)
  19646. case O_symbol:
  19647. if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section
  19648. - || exp.X_add_number != 0)
  19649. - symbol_set_value_expression (symbolP, &exp);
  19650. + || exp.X_add_number != 0)
  19651. + symbol_set_value_expression (symbolP, &exp);
  19652. else if (symbol_section_p (symbolP))
  19653. - as_bad ("invalid attempt to set value of section symbol");
  19654. + as_bad ("invalid attempt to set value of section symbol");
  19655. else
  19656. - {
  19657. - symbolS *s = exp.X_add_symbol;
  19658. + {
  19659. + symbolS *s = exp.X_add_symbol;
  19660. - S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
  19661. + S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
  19662. #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
  19663. - if (ext)
  19664. - S_SET_EXTERNAL (symbolP);
  19665. - else
  19666. - S_CLEAR_EXTERNAL (symbolP);
  19667. + if (ext)
  19668. + S_SET_EXTERNAL (symbolP);
  19669. + else
  19670. + S_CLEAR_EXTERNAL (symbolP);
  19671. #endif /* OBJ_AOUT or OBJ_BOUT */
  19672. - S_SET_VALUE (symbolP,
  19673. - exp.X_add_number + S_GET_VALUE (s));
  19674. - symbol_set_frag (symbolP, symbol_get_frag (s));
  19675. - copy_symbol_attributes (symbolP, s);
  19676. - }
  19677. + S_SET_VALUE (symbolP,
  19678. + exp.X_add_number + S_GET_VALUE (s));
  19679. + symbol_set_frag (symbolP, symbol_get_frag (s));
  19680. + copy_symbol_attributes (symbolP, s);
  19681. + }
  19682. break;
  19683. default:
  19684. /* The value is some complex expression.
  19685. - FIXME: Should we set the segment to anything? */
  19686. + FIXME: Should we set the segment to anything? */
  19687. symbol_set_value_expression (symbolP, &exp);
  19688. break;
  19689. }
  19690. }
  19691. /*
  19692. - * cons()
  19693. + * cons()
  19694. *
  19695. * CONStruct more frag of .bytes, or .words etc.
  19696. * Should need_pass_2 be 1 then emit no frag(s).
  19697. @@ -3284,7 +3560,7 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
  19698. /* end-of-line. */
  19699. static void
  19700. cons_worker (nbytes, rva)
  19701. - register int nbytes; /* 1=.byte, 2=.word, 4=.long */
  19702. + register int nbytes; /* 1=.byte, 2=.word, 4=.long */
  19703. int rva;
  19704. {
  19705. int c;
  19706. @@ -3303,7 +3579,7 @@ cons_worker (nbytes, rva)
  19707. {
  19708. demand_empty_rest_of_line ();
  19709. if (flag_mri)
  19710. - mri_comment_end (stop, stopc);
  19711. + mri_comment_end (stop, stopc);
  19712. return;
  19713. }
  19714. @@ -3316,18 +3592,18 @@ cons_worker (nbytes, rva)
  19715. {
  19716. #ifdef TC_M68K
  19717. if (flag_m68k_mri)
  19718. - parse_mri_cons (&exp, (unsigned int) nbytes);
  19719. + parse_mri_cons (&exp, (unsigned int) nbytes);
  19720. else
  19721. #endif
  19722. - TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
  19723. + TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
  19724. if (rva)
  19725. - {
  19726. - if (exp.X_op == O_symbol)
  19727. - exp.X_op = O_symbol_rva;
  19728. - else
  19729. - as_fatal (_("rva without symbol"));
  19730. - }
  19731. + {
  19732. + if (exp.X_op == O_symbol)
  19733. + exp.X_op = O_symbol_rva;
  19734. + else
  19735. + as_fatal (_("rva without symbol"));
  19736. + }
  19737. emit_expr (&exp, (unsigned int) nbytes);
  19738. ++c;
  19739. }
  19740. @@ -3339,7 +3615,7 @@ cons_worker (nbytes, rva)
  19741. if (flag_mri && nbytes == 1 && (c & 1) != 0)
  19742. mri_pending_align = 1;
  19743. - input_line_pointer--; /* Put terminator back into stream. */
  19744. + input_line_pointer--; /* Put terminator back into stream. */
  19745. demand_empty_rest_of_line ();
  19746. @@ -3389,13 +3665,13 @@ emit_expr (exp, nbytes)
  19747. if (strcmp (segment_name (now_seg), ".line") != 0)
  19748. dwarf_line = -1;
  19749. else if (dwarf_line >= 0
  19750. - && nbytes == 2
  19751. - && exp->X_op == O_constant
  19752. - && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
  19753. + && nbytes == 2
  19754. + && exp->X_op == O_constant
  19755. + && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
  19756. listing_source_line ((unsigned int) dwarf_line);
  19757. else if (nbytes == 4
  19758. - && exp->X_op == O_constant
  19759. - && exp->X_add_number >= 0)
  19760. + && exp->X_op == O_constant
  19761. + && exp->X_add_number >= 0)
  19762. dwarf_line = exp->X_add_number;
  19763. else
  19764. dwarf_line = -1;
  19765. @@ -3412,22 +3688,22 @@ emit_expr (exp, nbytes)
  19766. if (strcmp (segment_name (now_seg), ".debug") != 0)
  19767. dwarf_file = 0;
  19768. else if (dwarf_file == 0
  19769. - && nbytes == 2
  19770. - && exp->X_op == O_constant
  19771. - && exp->X_add_number == 0x11)
  19772. + && nbytes == 2
  19773. + && exp->X_op == O_constant
  19774. + && exp->X_add_number == 0x11)
  19775. dwarf_file = 1;
  19776. else if (dwarf_file == 1
  19777. - && nbytes == 2
  19778. - && exp->X_op == O_constant
  19779. - && exp->X_add_number == 0x12)
  19780. + && nbytes == 2
  19781. + && exp->X_op == O_constant
  19782. + && exp->X_add_number == 0x12)
  19783. dwarf_file = 2;
  19784. else if (dwarf_file == 2
  19785. - && nbytes == 4)
  19786. + && nbytes == 4)
  19787. dwarf_file = 3;
  19788. else if (dwarf_file == 3
  19789. - && nbytes == 2
  19790. - && exp->X_op == O_constant
  19791. - && exp->X_add_number == 0x38)
  19792. + && nbytes == 2
  19793. + && exp->X_op == O_constant
  19794. + && exp->X_add_number == 0x38)
  19795. dwarf_file = 4;
  19796. else
  19797. dwarf_file = 0;
  19798. @@ -3451,7 +3727,7 @@ emit_expr (exp, nbytes)
  19799. if (now_seg == absolute_section)
  19800. {
  19801. if (op != O_constant || exp->X_add_number != 0)
  19802. - as_bad (_("attempt to store value in absolute section"));
  19803. + as_bad (_("attempt to store value in absolute section"));
  19804. abs_section_offset += nbytes;
  19805. return;
  19806. }
  19807. @@ -3470,18 +3746,18 @@ emit_expr (exp, nbytes)
  19808. /* Negate the bignum: one's complement each digit and add 1. */
  19809. carry = 1;
  19810. for (i = 0; i < exp->X_add_number; i++)
  19811. - {
  19812. - unsigned long next;
  19813. + {
  19814. + unsigned long next;
  19815. - next = (((~ (generic_bignum[i] & LITTLENUM_MASK))
  19816. - & LITTLENUM_MASK)
  19817. - + carry);
  19818. - generic_bignum[i] = next & LITTLENUM_MASK;
  19819. - carry = next >> LITTLENUM_NUMBER_OF_BITS;
  19820. - }
  19821. + next = (((~ (generic_bignum[i] & LITTLENUM_MASK))
  19822. + & LITTLENUM_MASK)
  19823. + + carry);
  19824. + generic_bignum[i] = next & LITTLENUM_MASK;
  19825. + carry = next >> LITTLENUM_NUMBER_OF_BITS;
  19826. + }
  19827. /* We can ignore any carry out, because it will be handled by
  19828. - extra_digit if it is needed. */
  19829. + extra_digit if it is needed. */
  19830. extra_digit = (valueT) -1;
  19831. op = O_big;
  19832. @@ -3539,15 +3815,15 @@ emit_expr (exp, nbytes)
  19833. int gencnt;
  19834. if (! exp->X_unsigned && exp->X_add_number < 0)
  19835. - extra_digit = (valueT) -1;
  19836. + extra_digit = (valueT) -1;
  19837. val = (valueT) exp->X_add_number;
  19838. gencnt = 0;
  19839. do
  19840. - {
  19841. - generic_bignum[gencnt] = val & LITTLENUM_MASK;
  19842. - val >>= LITTLENUM_NUMBER_OF_BITS;
  19843. - ++gencnt;
  19844. - }
  19845. + {
  19846. + generic_bignum[gencnt] = val & LITTLENUM_MASK;
  19847. + val >>= LITTLENUM_NUMBER_OF_BITS;
  19848. + ++gencnt;
  19849. + }
  19850. while (val != 0);
  19851. op = exp->X_op = O_big;
  19852. exp->X_add_number = gencnt;
  19853. @@ -3562,38 +3838,38 @@ emit_expr (exp, nbytes)
  19854. register valueT unmask;
  19855. /* JF << of >= number of bits in the object is undefined. In
  19856. - particular SPARC (Sun 4) has problems */
  19857. + particular SPARC (Sun 4) has problems */
  19858. if (nbytes >= sizeof (valueT))
  19859. - {
  19860. - mask = 0;
  19861. - if (nbytes > sizeof (valueT))
  19862. - hibit = 0;
  19863. - else
  19864. - hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
  19865. - }
  19866. + {
  19867. + mask = 0;
  19868. + if (nbytes > sizeof (valueT))
  19869. + hibit = 0;
  19870. + else
  19871. + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
  19872. + }
  19873. else
  19874. - {
  19875. - /* Don't store these bits. */
  19876. - mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
  19877. - hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
  19878. - }
  19879. + {
  19880. + /* Don't store these bits. */
  19881. + mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
  19882. + hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
  19883. + }
  19884. - unmask = ~mask; /* Do store these bits. */
  19885. + unmask = ~mask; /* Do store these bits. */
  19886. #ifdef NEVER
  19887. "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
  19888. - mask = ~(unmask >> 1); /* Includes sign bit now. */
  19889. + mask = ~(unmask >> 1); /* Includes sign bit now. */
  19890. #endif
  19891. get = exp->X_add_number;
  19892. use = get & unmask;
  19893. if ((get & mask) != 0
  19894. - && ((get & mask) != mask
  19895. - || (get & hibit) == 0))
  19896. - { /* Leading bits contain both 0s & 1s. */
  19897. - as_warn (_("Value 0x%lx truncated to 0x%lx."),
  19898. - (unsigned long) get, (unsigned long) use);
  19899. - }
  19900. + && ((get & mask) != mask
  19901. + || (get & hibit) == 0))
  19902. + { /* Leading bits contain both 0s & 1s. */
  19903. + as_warn (_("Value 0x%lx truncated to 0x%lx."),
  19904. + (unsigned long) get, (unsigned long) use);
  19905. + }
  19906. /* put bytes in right order. */
  19907. md_number_to_chars (p, use, (int) nbytes);
  19908. }
  19909. @@ -3606,90 +3882,90 @@ emit_expr (exp, nbytes)
  19910. size = exp->X_add_number * CHARS_PER_LITTLENUM;
  19911. if (nbytes < size)
  19912. - {
  19913. - as_warn (_("Bignum truncated to %d bytes"), nbytes);
  19914. - size = nbytes;
  19915. - }
  19916. + {
  19917. + as_warn (_("Bignum truncated to %d bytes"), nbytes);
  19918. + size = nbytes;
  19919. + }
  19920. if (target_big_endian)
  19921. - {
  19922. - while (nbytes > size)
  19923. - {
  19924. - md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
  19925. - nbytes -= CHARS_PER_LITTLENUM;
  19926. - p += CHARS_PER_LITTLENUM;
  19927. - }
  19928. -
  19929. - nums = generic_bignum + size / CHARS_PER_LITTLENUM;
  19930. - while (size > 0)
  19931. - {
  19932. - --nums;
  19933. - md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
  19934. - size -= CHARS_PER_LITTLENUM;
  19935. - p += CHARS_PER_LITTLENUM;
  19936. - }
  19937. - }
  19938. + {
  19939. + while (nbytes > size)
  19940. + {
  19941. + md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
  19942. + nbytes -= CHARS_PER_LITTLENUM;
  19943. + p += CHARS_PER_LITTLENUM;
  19944. + }
  19945. +
  19946. + nums = generic_bignum + size / CHARS_PER_LITTLENUM;
  19947. + while (size > 0)
  19948. + {
  19949. + --nums;
  19950. + md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
  19951. + size -= CHARS_PER_LITTLENUM;
  19952. + p += CHARS_PER_LITTLENUM;
  19953. + }
  19954. + }
  19955. else
  19956. - {
  19957. - nums = generic_bignum;
  19958. - while (size > 0)
  19959. - {
  19960. - md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
  19961. - ++nums;
  19962. - size -= CHARS_PER_LITTLENUM;
  19963. - p += CHARS_PER_LITTLENUM;
  19964. - nbytes -= CHARS_PER_LITTLENUM;
  19965. - }
  19966. -
  19967. - while (nbytes > 0)
  19968. - {
  19969. - md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
  19970. - nbytes -= CHARS_PER_LITTLENUM;
  19971. - p += CHARS_PER_LITTLENUM;
  19972. - }
  19973. - }
  19974. + {
  19975. + nums = generic_bignum;
  19976. + while (size > 0)
  19977. + {
  19978. + md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
  19979. + ++nums;
  19980. + size -= CHARS_PER_LITTLENUM;
  19981. + p += CHARS_PER_LITTLENUM;
  19982. + nbytes -= CHARS_PER_LITTLENUM;
  19983. + }
  19984. +
  19985. + while (nbytes > 0)
  19986. + {
  19987. + md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
  19988. + nbytes -= CHARS_PER_LITTLENUM;
  19989. + p += CHARS_PER_LITTLENUM;
  19990. + }
  19991. + }
  19992. }
  19993. else
  19994. {
  19995. memset (p, 0, nbytes);
  19996. /* Now we need to generate a fixS to record the symbol value.
  19997. - This is easy for BFD. For other targets it can be more
  19998. - complex. For very complex cases (currently, the HPPA and
  19999. - NS32K), you can define TC_CONS_FIX_NEW to do whatever you
  20000. - want. For simpler cases, you can define TC_CONS_RELOC to be
  20001. - the name of the reloc code that should be stored in the fixS.
  20002. - If neither is defined, the code uses NO_RELOC if it is
  20003. - defined, and otherwise uses 0. */
  20004. + This is easy for BFD. For other targets it can be more
  20005. + complex. For very complex cases (currently, the HPPA and
  20006. + NS32K), you can define TC_CONS_FIX_NEW to do whatever you
  20007. + want. For simpler cases, you can define TC_CONS_RELOC to be
  20008. + the name of the reloc code that should be stored in the fixS.
  20009. + If neither is defined, the code uses NO_RELOC if it is
  20010. + defined, and otherwise uses 0. */
  20011. #ifdef BFD_ASSEMBLER
  20012. #ifdef TC_CONS_FIX_NEW
  20013. TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
  20014. #else
  20015. {
  20016. - bfd_reloc_code_real_type r;
  20017. -
  20018. - switch (nbytes)
  20019. - {
  20020. - case 1:
  20021. - r = BFD_RELOC_8;
  20022. - break;
  20023. - case 2:
  20024. - r = BFD_RELOC_16;
  20025. - break;
  20026. - case 4:
  20027. - r = BFD_RELOC_32;
  20028. - break;
  20029. - case 8:
  20030. - r = BFD_RELOC_64;
  20031. - break;
  20032. - default:
  20033. - as_bad (_("unsupported BFD relocation size %u"), nbytes);
  20034. - r = BFD_RELOC_32;
  20035. - break;
  20036. - }
  20037. - fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
  20038. - 0, r);
  20039. + bfd_reloc_code_real_type r;
  20040. +
  20041. + switch (nbytes)
  20042. + {
  20043. + case 1:
  20044. + r = BFD_RELOC_8;
  20045. + break;
  20046. + case 2:
  20047. + r = BFD_RELOC_16;
  20048. + break;
  20049. + case 4:
  20050. + r = BFD_RELOC_32;
  20051. + break;
  20052. + case 8:
  20053. + r = BFD_RELOC_64;
  20054. + break;
  20055. + default:
  20056. + as_bad (_("unsupported BFD relocation size %u"), nbytes);
  20057. + r = BFD_RELOC_32;
  20058. + break;
  20059. + }
  20060. + fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
  20061. + 0, r);
  20062. }
  20063. #endif
  20064. #else
  20065. @@ -3697,8 +3973,8 @@ emit_expr (exp, nbytes)
  20066. TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
  20067. #else
  20068. /* Figure out which reloc number to use. Use TC_CONS_RELOC if
  20069. - it is defined, otherwise use NO_RELOC if it is defined,
  20070. - otherwise use 0. */
  20071. + it is defined, otherwise use NO_RELOC if it is defined,
  20072. + otherwise use 0. */
  20073. #ifndef TC_CONS_RELOC
  20074. #ifdef NO_RELOC
  20075. #define TC_CONS_RELOC NO_RELOC
  20076. @@ -3707,7 +3983,7 @@ emit_expr (exp, nbytes)
  20077. #endif
  20078. #endif
  20079. fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
  20080. - TC_CONS_RELOC);
  20081. + TC_CONS_RELOC);
  20082. #endif /* TC_CONS_FIX_NEW */
  20083. #endif /* BFD_ASSEMBLER */
  20084. }
  20085. @@ -3740,101 +4016,101 @@ parse_bitfield_cons (exp, nbytes)
  20086. (void) expression (exp);
  20087. if (*input_line_pointer == ':')
  20088. - { /* bitfields */
  20089. + { /* bitfields */
  20090. long value = 0;
  20091. for (;;)
  20092. - {
  20093. - unsigned long width;
  20094. -
  20095. - if (*input_line_pointer != ':')
  20096. - {
  20097. - input_line_pointer = hold;
  20098. - break;
  20099. - } /* next piece is not a bitfield */
  20100. -
  20101. - /* In the general case, we can't allow
  20102. - full expressions with symbol
  20103. - differences and such. The relocation
  20104. - entries for symbols not defined in this
  20105. - assembly would require arbitrary field
  20106. - widths, positions, and masks which most
  20107. - of our current object formats don't
  20108. - support.
  20109. -
  20110. - In the specific case where a symbol
  20111. - *is* defined in this assembly, we
  20112. - *could* build fixups and track it, but
  20113. - this could lead to confusion for the
  20114. - backends. I'm lazy. I'll take any
  20115. - SEG_ABSOLUTE. I think that means that
  20116. - you can use a previous .set or
  20117. - .equ type symbol. xoxorich. */
  20118. -
  20119. - if (exp->X_op == O_absent)
  20120. - {
  20121. - as_warn (_("using a bit field width of zero"));
  20122. - exp->X_add_number = 0;
  20123. - exp->X_op = O_constant;
  20124. - } /* implied zero width bitfield */
  20125. -
  20126. - if (exp->X_op != O_constant)
  20127. - {
  20128. - *input_line_pointer = '\0';
  20129. - as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
  20130. - *input_line_pointer = ':';
  20131. - demand_empty_rest_of_line ();
  20132. - return;
  20133. - } /* too complex */
  20134. -
  20135. - if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
  20136. - {
  20137. - as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
  20138. - width, nbytes, (BITS_PER_CHAR * nbytes));
  20139. - width = BITS_PER_CHAR * nbytes;
  20140. - } /* too big */
  20141. -
  20142. - if (width > bits_available)
  20143. - {
  20144. - /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
  20145. - input_line_pointer = hold;
  20146. - exp->X_add_number = value;
  20147. - break;
  20148. - } /* won't fit */
  20149. -
  20150. - hold = ++input_line_pointer; /* skip ':' */
  20151. -
  20152. - (void) expression (exp);
  20153. - if (exp->X_op != O_constant)
  20154. - {
  20155. - char cache = *input_line_pointer;
  20156. -
  20157. - *input_line_pointer = '\0';
  20158. - as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
  20159. - *input_line_pointer = cache;
  20160. - demand_empty_rest_of_line ();
  20161. - return;
  20162. - } /* too complex */
  20163. -
  20164. - value |= ((~(-1 << width) & exp->X_add_number)
  20165. - << ((BITS_PER_CHAR * nbytes) - bits_available));
  20166. -
  20167. - if ((bits_available -= width) == 0
  20168. - || is_it_end_of_statement ()
  20169. - || *input_line_pointer != ',')
  20170. - {
  20171. - break;
  20172. - } /* all the bitfields we're gonna get */
  20173. -
  20174. - hold = ++input_line_pointer;
  20175. - (void) expression (exp);
  20176. - } /* forever loop */
  20177. + {
  20178. + unsigned long width;
  20179. +
  20180. + if (*input_line_pointer != ':')
  20181. + {
  20182. + input_line_pointer = hold;
  20183. + break;
  20184. + } /* next piece is not a bitfield */
  20185. +
  20186. + /* In the general case, we can't allow
  20187. + full expressions with symbol
  20188. + differences and such. The relocation
  20189. + entries for symbols not defined in this
  20190. + assembly would require arbitrary field
  20191. + widths, positions, and masks which most
  20192. + of our current object formats don't
  20193. + support.
  20194. +
  20195. + In the specific case where a symbol
  20196. + *is* defined in this assembly, we
  20197. + *could* build fixups and track it, but
  20198. + this could lead to confusion for the
  20199. + backends. I'm lazy. I'll take any
  20200. + SEG_ABSOLUTE. I think that means that
  20201. + you can use a previous .set or
  20202. + .equ type symbol. xoxorich. */
  20203. +
  20204. + if (exp->X_op == O_absent)
  20205. + {
  20206. + as_warn (_("using a bit field width of zero"));
  20207. + exp->X_add_number = 0;
  20208. + exp->X_op = O_constant;
  20209. + } /* implied zero width bitfield */
  20210. +
  20211. + if (exp->X_op != O_constant)
  20212. + {
  20213. + *input_line_pointer = '\0';
  20214. + as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
  20215. + *input_line_pointer = ':';
  20216. + demand_empty_rest_of_line ();
  20217. + return;
  20218. + } /* too complex */
  20219. +
  20220. + if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
  20221. + {
  20222. + as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
  20223. + width, nbytes, (BITS_PER_CHAR * nbytes));
  20224. + width = BITS_PER_CHAR * nbytes;
  20225. + } /* too big */
  20226. +
  20227. + if (width > bits_available)
  20228. + {
  20229. + /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
  20230. + input_line_pointer = hold;
  20231. + exp->X_add_number = value;
  20232. + break;
  20233. + } /* won't fit */
  20234. +
  20235. + hold = ++input_line_pointer; /* skip ':' */
  20236. +
  20237. + (void) expression (exp);
  20238. + if (exp->X_op != O_constant)
  20239. + {
  20240. + char cache = *input_line_pointer;
  20241. +
  20242. + *input_line_pointer = '\0';
  20243. + as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
  20244. + *input_line_pointer = cache;
  20245. + demand_empty_rest_of_line ();
  20246. + return;
  20247. + } /* too complex */
  20248. +
  20249. + value |= ((~(-1 << width) & exp->X_add_number)
  20250. + << ((BITS_PER_CHAR * nbytes) - bits_available));
  20251. +
  20252. + if ((bits_available -= width) == 0
  20253. + || is_it_end_of_statement ()
  20254. + || *input_line_pointer != ',')
  20255. + {
  20256. + break;
  20257. + } /* all the bitfields we're gonna get */
  20258. +
  20259. + hold = ++input_line_pointer;
  20260. + (void) expression (exp);
  20261. + } /* forever loop */
  20262. exp->X_add_number = value;
  20263. exp->X_op = O_constant;
  20264. exp->X_unsigned = 1;
  20265. - } /* if looks like a bitfield */
  20266. -} /* parse_bitfield_cons() */
  20267. + } /* if looks like a bitfield */
  20268. +} /* parse_bitfield_cons() */
  20269. #endif /* BITFIELD_CONS_EXPRESSIONS */
  20270. @@ -3848,8 +4124,8 @@ parse_mri_cons (exp, nbytes)
  20271. {
  20272. if (*input_line_pointer != '\''
  20273. && (input_line_pointer[1] != '\''
  20274. - || (*input_line_pointer != 'A'
  20275. - && *input_line_pointer != 'E')))
  20276. + || (*input_line_pointer != 'A'
  20277. + && *input_line_pointer != 'E')))
  20278. TC_PARSE_CONS_EXPRESSION (exp, nbytes);
  20279. else
  20280. {
  20281. @@ -3857,50 +4133,50 @@ parse_mri_cons (exp, nbytes)
  20282. unsigned int result = 0;
  20283. /* An MRI style string. Cut into as many bytes as will fit into
  20284. - a nbyte chunk, left justify if necessary, and separate with
  20285. - commas so we can try again later. */
  20286. + a nbyte chunk, left justify if necessary, and separate with
  20287. + commas so we can try again later. */
  20288. if (*input_line_pointer == 'A')
  20289. - ++input_line_pointer;
  20290. + ++input_line_pointer;
  20291. else if (*input_line_pointer == 'E')
  20292. - {
  20293. - as_bad (_("EBCDIC constants are not supported"));
  20294. - ++input_line_pointer;
  20295. - }
  20296. + {
  20297. + as_bad (_("EBCDIC constants are not supported"));
  20298. + ++input_line_pointer;
  20299. + }
  20300. input_line_pointer++;
  20301. for (scan = 0; scan < nbytes; scan++)
  20302. - {
  20303. - if (*input_line_pointer == '\'')
  20304. - {
  20305. - if (input_line_pointer[1] == '\'')
  20306. - {
  20307. - input_line_pointer++;
  20308. - }
  20309. - else
  20310. - break;
  20311. - }
  20312. - result = (result << 8) | (*input_line_pointer++);
  20313. - }
  20314. + {
  20315. + if (*input_line_pointer == '\'')
  20316. + {
  20317. + if (input_line_pointer[1] == '\'')
  20318. + {
  20319. + input_line_pointer++;
  20320. + }
  20321. + else
  20322. + break;
  20323. + }
  20324. + result = (result << 8) | (*input_line_pointer++);
  20325. + }
  20326. /* Left justify */
  20327. while (scan < nbytes)
  20328. - {
  20329. - result <<= 8;
  20330. - scan++;
  20331. - }
  20332. + {
  20333. + result <<= 8;
  20334. + scan++;
  20335. + }
  20336. /* Create correct expression */
  20337. exp->X_op = O_constant;
  20338. exp->X_add_number = result;
  20339. /* Fake it so that we can read the next char too */
  20340. if (input_line_pointer[0] != '\'' ||
  20341. - (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
  20342. - {
  20343. - input_line_pointer -= 2;
  20344. - input_line_pointer[0] = ',';
  20345. - input_line_pointer[1] = '\'';
  20346. - }
  20347. + (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
  20348. + {
  20349. + input_line_pointer -= 2;
  20350. + input_line_pointer[0] = ',';
  20351. + input_line_pointer[1] = '\'';
  20352. + }
  20353. else
  20354. - input_line_pointer++;
  20355. + input_line_pointer++;
  20356. }
  20357. }
  20358. #endif /* TC_M68K */
  20359. @@ -3998,47 +4274,47 @@ hex_float (float_type, bytes)
  20360. int d;
  20361. /* The MRI assembler accepts arbitrary underscores strewn about
  20362. - through the hex constant, so we ignore them as well. */
  20363. + through the hex constant, so we ignore them as well. */
  20364. if (*input_line_pointer == '_')
  20365. - {
  20366. - ++input_line_pointer;
  20367. - continue;
  20368. - }
  20369. + {
  20370. + ++input_line_pointer;
  20371. + continue;
  20372. + }
  20373. if (i >= length)
  20374. - {
  20375. - as_warn (_("Floating point constant too large"));
  20376. - return -1;
  20377. - }
  20378. + {
  20379. + as_warn (_("Floating point constant too large"));
  20380. + return -1;
  20381. + }
  20382. d = hex_value (*input_line_pointer) << 4;
  20383. ++input_line_pointer;
  20384. while (*input_line_pointer == '_')
  20385. - ++input_line_pointer;
  20386. + ++input_line_pointer;
  20387. if (hex_p (*input_line_pointer))
  20388. - {
  20389. - d += hex_value (*input_line_pointer);
  20390. - ++input_line_pointer;
  20391. - }
  20392. + {
  20393. + d += hex_value (*input_line_pointer);
  20394. + ++input_line_pointer;
  20395. + }
  20396. if (target_big_endian)
  20397. - bytes[i] = d;
  20398. + bytes[i] = d;
  20399. else
  20400. - bytes[length - i - 1] = d;
  20401. + bytes[length - i - 1] = d;
  20402. ++i;
  20403. }
  20404. if (i < length)
  20405. {
  20406. if (target_big_endian)
  20407. - memset (bytes + i, 0, length - i);
  20408. + memset (bytes + i, 0, length - i);
  20409. else
  20410. - memset (bytes, 0, length - i);
  20411. + memset (bytes, 0, length - i);
  20412. }
  20413. return length;
  20414. }
  20415. /*
  20416. - * float_cons()
  20417. + * float_cons()
  20418. *
  20419. * CONStruct some more frag chars of .floats .ffloats etc.
  20420. * Makes 0 or more new frags.
  20421. @@ -4053,18 +4329,18 @@ hex_float (float_type, bytes)
  20422. * a choice of 2 flavours of noise according to which of 2 floating-point
  20423. * scanners you directed AS to use.
  20424. *
  20425. - * In: input_line_pointer->whitespace before, or '0' of flonum.
  20426. + * In: input_line_pointer->whitespace before, or '0' of flonum.
  20427. *
  20428. */
  20429. void
  20430. float_cons (float_type)
  20431. /* Clobbers input_line-pointer, checks end-of-line. */
  20432. - register int float_type; /* 'f':.ffloat ... 'F':.float ... */
  20433. + register int float_type; /* 'f':.ffloat ... 'F':.float ... */
  20434. {
  20435. register char *p;
  20436. - int length; /* Number of chars in an object. */
  20437. - register char *err; /* Error from scanning floating literal. */
  20438. + int length; /* Number of chars in an object. */
  20439. + register char *err; /* Error from scanning floating literal. */
  20440. char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
  20441. if (is_it_end_of_statement ())
  20442. @@ -4088,70 +4364,70 @@ float_cons (float_type)
  20443. * diagnostics if your input is ill-conditioned.
  20444. */
  20445. if (input_line_pointer[0] == '0'
  20446. - && isalpha ((unsigned char) input_line_pointer[1]))
  20447. - input_line_pointer += 2;
  20448. + && isalpha ((unsigned char) input_line_pointer[1]))
  20449. + input_line_pointer += 2;
  20450. /* Accept :xxxx, where the x's are hex digits, for a floating
  20451. point with the exact digits specified. */
  20452. if (input_line_pointer[0] == ':')
  20453. - {
  20454. - ++input_line_pointer;
  20455. - length = hex_float (float_type, temp);
  20456. - if (length < 0)
  20457. - {
  20458. - ignore_rest_of_line ();
  20459. - return;
  20460. - }
  20461. - }
  20462. + {
  20463. + ++input_line_pointer;
  20464. + length = hex_float (float_type, temp);
  20465. + if (length < 0)
  20466. + {
  20467. + ignore_rest_of_line ();
  20468. + return;
  20469. + }
  20470. + }
  20471. else
  20472. - {
  20473. - err = md_atof (float_type, temp, &length);
  20474. - know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
  20475. - know (length > 0);
  20476. - if (err)
  20477. - {
  20478. - as_bad (_("Bad floating literal: %s"), err);
  20479. - ignore_rest_of_line ();
  20480. - return;
  20481. - }
  20482. - }
  20483. + {
  20484. + err = md_atof (float_type, temp, &length);
  20485. + know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
  20486. + know (length > 0);
  20487. + if (err)
  20488. + {
  20489. + as_bad (_("Bad floating literal: %s"), err);
  20490. + ignore_rest_of_line ();
  20491. + return;
  20492. + }
  20493. + }
  20494. if (!need_pass_2)
  20495. - {
  20496. - int count;
  20497. + {
  20498. + int count;
  20499. - count = 1;
  20500. + count = 1;
  20501. #ifdef REPEAT_CONS_EXPRESSIONS
  20502. - if (*input_line_pointer == ':')
  20503. - {
  20504. - expressionS count_exp;
  20505. -
  20506. - ++input_line_pointer;
  20507. - expression (&count_exp);
  20508. - if (count_exp.X_op != O_constant
  20509. - || count_exp.X_add_number <= 0)
  20510. - {
  20511. - as_warn (_("unresolvable or nonpositive repeat count; using 1"));
  20512. - }
  20513. - else
  20514. - count = count_exp.X_add_number;
  20515. - }
  20516. + if (*input_line_pointer == ':')
  20517. + {
  20518. + expressionS count_exp;
  20519. +
  20520. + ++input_line_pointer;
  20521. + expression (&count_exp);
  20522. + if (count_exp.X_op != O_constant
  20523. + || count_exp.X_add_number <= 0)
  20524. + {
  20525. + as_warn (_("unresolvable or nonpositive repeat count; using 1"));
  20526. + }
  20527. + else
  20528. + count = count_exp.X_add_number;
  20529. + }
  20530. #endif
  20531. - while (--count >= 0)
  20532. - {
  20533. - p = frag_more (length);
  20534. - memcpy (p, temp, (unsigned int) length);
  20535. - }
  20536. - }
  20537. + while (--count >= 0)
  20538. + {
  20539. + p = frag_more (length);
  20540. + memcpy (p, temp, (unsigned int) length);
  20541. + }
  20542. + }
  20543. SKIP_WHITESPACE ();
  20544. }
  20545. while (*input_line_pointer++ == ',');
  20546. - --input_line_pointer; /* Put terminator back into stream. */
  20547. + --input_line_pointer; /* Put terminator back into stream. */
  20548. demand_empty_rest_of_line ();
  20549. -} /* float_cons() */
  20550. +} /* float_cons() */
  20551. /* Return the size of a LEB128 value */
  20552. @@ -4166,13 +4442,13 @@ sizeof_sleb128 (value)
  20553. {
  20554. byte = (value & 0x7f);
  20555. /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
  20556. - Fortunately, we can structure things so that the extra work reduces
  20557. - to a noop on systems that do things "properly". */
  20558. + Fortunately, we can structure things so that the extra work reduces
  20559. + to a noop on systems that do things "properly". */
  20560. value = (value >> 7) | ~(-(offsetT)1 >> 7);
  20561. size += 1;
  20562. }
  20563. while (!(((value == 0) && ((byte & 0x40) == 0))
  20564. - || ((value == -1) && ((byte & 0x40) != 0))));
  20565. + || ((value == -1) && ((byte & 0x40) != 0))));
  20566. return size;
  20567. }
  20568. @@ -4221,14 +4497,14 @@ output_sleb128 (p, value)
  20569. unsigned byte = (value & 0x7f);
  20570. /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
  20571. - Fortunately, we can structure things so that the extra work reduces
  20572. - to a noop on systems that do things "properly". */
  20573. + Fortunately, we can structure things so that the extra work reduces
  20574. + to a noop on systems that do things "properly". */
  20575. value = (value >> 7) | ~(-(offsetT)1 >> 7);
  20576. more = !((((value == 0) && ((byte & 0x40) == 0))
  20577. - || ((value == -1) && ((byte & 0x40) != 0))));
  20578. + || ((value == -1) && ((byte & 0x40) != 0))));
  20579. if (more)
  20580. - byte |= 0x80;
  20581. + byte |= 0x80;
  20582. *p++ = byte;
  20583. }
  20584. @@ -4249,8 +4525,8 @@ output_uleb128 (p, value)
  20585. unsigned byte = (value & 0x7f);
  20586. value >>= 7;
  20587. if (value != 0)
  20588. - /* More bytes to follow. */
  20589. - byte |= 0x80;
  20590. + /* More bytes to follow. */
  20591. + byte |= 0x80;
  20592. *p++ = byte;
  20593. }
  20594. @@ -4293,27 +4569,27 @@ output_big_sleb128 (p, bignum, size)
  20595. do
  20596. {
  20597. if (loaded < 7 && size > 0)
  20598. - {
  20599. - val |= (*bignum << loaded);
  20600. - loaded += 8 * CHARS_PER_LITTLENUM;
  20601. - size--;
  20602. - bignum++;
  20603. - }
  20604. + {
  20605. + val |= (*bignum << loaded);
  20606. + loaded += 8 * CHARS_PER_LITTLENUM;
  20607. + size--;
  20608. + bignum++;
  20609. + }
  20610. byte = val & 0x7f;
  20611. loaded -= 7;
  20612. val >>= 7;
  20613. if (size == 0)
  20614. - {
  20615. - if ((val == 0 && (byte & 0x40) == 0)
  20616. - || (~(val | ~(((valueT)1 << loaded) - 1)) == 0
  20617. - && (byte & 0x40) != 0))
  20618. - byte |= 0x80;
  20619. - }
  20620. + {
  20621. + if ((val == 0 && (byte & 0x40) == 0)
  20622. + || (~(val | ~(((valueT)1 << loaded) - 1)) == 0
  20623. + && (byte & 0x40) != 0))
  20624. + byte |= 0x80;
  20625. + }
  20626. if (orig)
  20627. - *p = byte;
  20628. + *p = byte;
  20629. p++;
  20630. }
  20631. while (byte & 0x80);
  20632. @@ -4340,22 +4616,22 @@ output_big_uleb128 (p, bignum, size)
  20633. do
  20634. {
  20635. if (loaded < 7 && size > 0)
  20636. - {
  20637. - val |= (*bignum << loaded);
  20638. - loaded += 8 * CHARS_PER_LITTLENUM;
  20639. - size--;
  20640. - bignum++;
  20641. - }
  20642. + {
  20643. + val |= (*bignum << loaded);
  20644. + loaded += 8 * CHARS_PER_LITTLENUM;
  20645. + size--;
  20646. + bignum++;
  20647. + }
  20648. byte = val & 0x7f;
  20649. loaded -= 7;
  20650. val >>= 7;
  20651. if (size > 0 || val)
  20652. - byte |= 0x80;
  20653. + byte |= 0x80;
  20654. if (orig)
  20655. - *p = byte;
  20656. + *p = byte;
  20657. p++;
  20658. }
  20659. while (byte & 0x80);
  20660. @@ -4429,10 +4705,10 @@ emit_leb128_expr(exp, sign)
  20661. else
  20662. {
  20663. /* Otherwise, we have to create a variable sized fragment and
  20664. - resolve things later. */
  20665. + resolve things later. */
  20666. frag_var (rs_leb128, sizeof_uleb128 (~(valueT)0), 0, sign,
  20667. - make_expr_symbol (exp), 0, (char *) NULL);
  20668. + make_expr_symbol (exp), 0, (char *) NULL);
  20669. }
  20670. }
  20671. @@ -4454,7 +4730,7 @@ s_leb128 (sign)
  20672. }
  20673. /*
  20674. - * stringer()
  20675. + * stringer()
  20676. *
  20677. * We read 0 or more ',' separated, double-quoted strings.
  20678. *
  20679. @@ -4463,9 +4739,9 @@ s_leb128 (sign)
  20680. void
  20681. -stringer (append_zero) /* Worker to do .ascii etc statements. */
  20682. +stringer (append_zero) /* Worker to do .ascii etc statements. */
  20683. /* Checks end-of-line. */
  20684. - register int append_zero; /* 0: don't append '\0', else 1 */
  20685. + register int append_zero; /* 0: don't append '\0', else 1 */
  20686. {
  20687. register unsigned int c;
  20688. char *start;
  20689. @@ -4484,72 +4760,72 @@ stringer (append_zero) /* Worker to do .ascii etc statements. */
  20690. */
  20691. if (is_it_end_of_statement ())
  20692. {
  20693. - c = 0; /* Skip loop. */
  20694. - ++input_line_pointer; /* Compensate for end of loop. */
  20695. + c = 0; /* Skip loop. */
  20696. + ++input_line_pointer; /* Compensate for end of loop. */
  20697. }
  20698. else
  20699. {
  20700. - c = ','; /* Do loop. */
  20701. + c = ','; /* Do loop. */
  20702. }
  20703. while (c == ',' || c == '<' || c == '"')
  20704. {
  20705. SKIP_WHITESPACE ();
  20706. switch (*input_line_pointer)
  20707. - {
  20708. - case '\"':
  20709. - ++input_line_pointer; /*->1st char of string. */
  20710. - start = input_line_pointer;
  20711. - while (is_a_char (c = next_char_of_string ()))
  20712. - {
  20713. - FRAG_APPEND_1_CHAR (c);
  20714. - }
  20715. - if (append_zero)
  20716. - {
  20717. - FRAG_APPEND_1_CHAR (0);
  20718. - }
  20719. - know (input_line_pointer[-1] == '\"');
  20720. + {
  20721. + case '\"':
  20722. + ++input_line_pointer; /*->1st char of string. */
  20723. + start = input_line_pointer;
  20724. + while (is_a_char (c = next_char_of_string ()))
  20725. + {
  20726. + FRAG_APPEND_1_CHAR (c);
  20727. + }
  20728. + if (append_zero)
  20729. + {
  20730. + FRAG_APPEND_1_CHAR (0);
  20731. + }
  20732. + know (input_line_pointer[-1] == '\"');
  20733. #ifndef NO_LISTING
  20734. #ifdef OBJ_ELF
  20735. - /* In ELF, when gcc is emitting DWARF 1 debugging output, it
  20736. + /* In ELF, when gcc is emitting DWARF 1 debugging output, it
  20737. will emit .string with a filename in the .debug section
  20738. after a sequence of constants. See the comment in
  20739. emit_expr for the sequence. emit_expr will set
  20740. dwarf_file_string to non-zero if this string might be a
  20741. source file name. */
  20742. - if (strcmp (segment_name (now_seg), ".debug") != 0)
  20743. - dwarf_file_string = 0;
  20744. - else if (dwarf_file_string)
  20745. - {
  20746. - c = input_line_pointer[-1];
  20747. - input_line_pointer[-1] = '\0';
  20748. - listing_source_file (start);
  20749. - input_line_pointer[-1] = c;
  20750. - }
  20751. + if (strcmp (segment_name (now_seg), ".debug") != 0)
  20752. + dwarf_file_string = 0;
  20753. + else if (dwarf_file_string)
  20754. + {
  20755. + c = input_line_pointer[-1];
  20756. + input_line_pointer[-1] = '\0';
  20757. + listing_source_file (start);
  20758. + input_line_pointer[-1] = c;
  20759. + }
  20760. #endif
  20761. #endif
  20762. - break;
  20763. - case '<':
  20764. - input_line_pointer++;
  20765. - c = get_single_number ();
  20766. - FRAG_APPEND_1_CHAR (c);
  20767. - if (*input_line_pointer != '>')
  20768. - {
  20769. - as_bad (_("Expected <nn>"));
  20770. - }
  20771. - input_line_pointer++;
  20772. - break;
  20773. - case ',':
  20774. - input_line_pointer++;
  20775. - break;
  20776. - }
  20777. + break;
  20778. + case '<':
  20779. + input_line_pointer++;
  20780. + c = get_single_number ();
  20781. + FRAG_APPEND_1_CHAR (c);
  20782. + if (*input_line_pointer != '>')
  20783. + {
  20784. + as_bad (_("Expected <nn>"));
  20785. + }
  20786. + input_line_pointer++;
  20787. + break;
  20788. + case ',':
  20789. + input_line_pointer++;
  20790. + break;
  20791. + }
  20792. SKIP_WHITESPACE ();
  20793. c = *input_line_pointer;
  20794. }
  20795. demand_empty_rest_of_line ();
  20796. -} /* stringer() */
  20797. +} /* stringer() */
  20798. /* FIXME-SOMEDAY: I had trouble here on characters with the
  20799. high bits set. We'll probably also have trouble with
  20800. @@ -4576,104 +4852,104 @@ next_char_of_string ()
  20801. #ifndef NO_STRING_ESCAPES
  20802. case '\\':
  20803. switch (c = *input_line_pointer++)
  20804. - {
  20805. - case 'b':
  20806. - c = '\b';
  20807. - break;
  20808. -
  20809. - case 'f':
  20810. - c = '\f';
  20811. - break;
  20812. -
  20813. - case 'n':
  20814. - c = '\n';
  20815. - break;
  20816. -
  20817. - case 'r':
  20818. - c = '\r';
  20819. - break;
  20820. -
  20821. - case 't':
  20822. - c = '\t';
  20823. - break;
  20824. -
  20825. - case 'v':
  20826. - c = '\013';
  20827. - break;
  20828. -
  20829. - case '\\':
  20830. - case '"':
  20831. - break; /* As itself. */
  20832. -
  20833. - case '0':
  20834. - case '1':
  20835. - case '2':
  20836. - case '3':
  20837. - case '4':
  20838. - case '5':
  20839. - case '6':
  20840. - case '7':
  20841. - case '8':
  20842. - case '9':
  20843. - {
  20844. - long number;
  20845. - int i;
  20846. -
  20847. - for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
  20848. - {
  20849. - number = number * 8 + c - '0';
  20850. - }
  20851. - c = number & 0xff;
  20852. - }
  20853. - --input_line_pointer;
  20854. - break;
  20855. -
  20856. - case 'x':
  20857. - case 'X':
  20858. - {
  20859. - long number;
  20860. -
  20861. - number = 0;
  20862. - c = *input_line_pointer++;
  20863. - while (isxdigit (c))
  20864. - {
  20865. - if (isdigit (c))
  20866. - number = number * 16 + c - '0';
  20867. - else if (isupper (c))
  20868. - number = number * 16 + c - 'A' + 10;
  20869. - else
  20870. - number = number * 16 + c - 'a' + 10;
  20871. - c = *input_line_pointer++;
  20872. - }
  20873. - c = number & 0xff;
  20874. - --input_line_pointer;
  20875. - }
  20876. - break;
  20877. -
  20878. - case '\n':
  20879. - /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
  20880. - as_warn (_("Unterminated string: Newline inserted."));
  20881. - c = '\n';
  20882. - bump_line_counters ();
  20883. - break;
  20884. -
  20885. - default:
  20886. + {
  20887. + case 'b':
  20888. + c = '\b';
  20889. + break;
  20890. +
  20891. + case 'f':
  20892. + c = '\f';
  20893. + break;
  20894. +
  20895. + case 'n':
  20896. + c = '\n';
  20897. + break;
  20898. +
  20899. + case 'r':
  20900. + c = '\r';
  20901. + break;
  20902. +
  20903. + case 't':
  20904. + c = '\t';
  20905. + break;
  20906. +
  20907. + case 'v':
  20908. + c = '\013';
  20909. + break;
  20910. +
  20911. + case '\\':
  20912. + case '"':
  20913. + break; /* As itself. */
  20914. +
  20915. + case '0':
  20916. + case '1':
  20917. + case '2':
  20918. + case '3':
  20919. + case '4':
  20920. + case '5':
  20921. + case '6':
  20922. + case '7':
  20923. + case '8':
  20924. + case '9':
  20925. + {
  20926. + long number;
  20927. + int i;
  20928. +
  20929. + for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
  20930. + {
  20931. + number = number * 8 + c - '0';
  20932. + }
  20933. + c = number & 0xff;
  20934. + }
  20935. + --input_line_pointer;
  20936. + break;
  20937. +
  20938. + case 'x':
  20939. + case 'X':
  20940. + {
  20941. + long number;
  20942. +
  20943. + number = 0;
  20944. + c = *input_line_pointer++;
  20945. + while (isxdigit (c))
  20946. + {
  20947. + if (isdigit (c))
  20948. + number = number * 16 + c - '0';
  20949. + else if (isupper (c))
  20950. + number = number * 16 + c - 'A' + 10;
  20951. + else
  20952. + number = number * 16 + c - 'a' + 10;
  20953. + c = *input_line_pointer++;
  20954. + }
  20955. + c = number & 0xff;
  20956. + --input_line_pointer;
  20957. + }
  20958. + break;
  20959. +
  20960. + case '\n':
  20961. + /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
  20962. + as_warn (_("Unterminated string: Newline inserted."));
  20963. + c = '\n';
  20964. + bump_line_counters ();
  20965. + break;
  20966. +
  20967. + default:
  20968. #ifdef ONLY_STANDARD_ESCAPES
  20969. - as_bad (_("Bad escaped character in string, '?' assumed"));
  20970. - c = '?';
  20971. + as_bad (_("Bad escaped character in string, '?' assumed"));
  20972. + c = '?';
  20973. #endif /* ONLY_STANDARD_ESCAPES */
  20974. - break;
  20975. - } /* switch on escaped char */
  20976. + break;
  20977. + } /* switch on escaped char */
  20978. break;
  20979. #endif /* ! defined (NO_STRING_ESCAPES) */
  20980. default:
  20981. break;
  20982. - } /* switch on char */
  20983. + } /* switch on char */
  20984. return (c);
  20985. -} /* next_char_of_string() */
  20986. +} /* next_char_of_string() */
  20987. static segT
  20988. get_segmented_expression (expP)
  20989. @@ -4703,20 +4979,20 @@ get_known_segmented_expression (expP)
  20990. if ((retval = get_segmented_expression (expP)) == undefined_section)
  20991. {
  20992. /* There is no easy way to extract the undefined symbol from the
  20993. - expression. */
  20994. + expression. */
  20995. if (expP->X_add_symbol != NULL
  20996. - && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
  20997. - as_warn (_("symbol \"%s\" undefined; zero assumed"),
  20998. - S_GET_NAME (expP->X_add_symbol));
  20999. + && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
  21000. + as_warn (_("symbol \"%s\" undefined; zero assumed"),
  21001. + S_GET_NAME (expP->X_add_symbol));
  21002. else
  21003. - as_warn (_("some symbol undefined; zero assumed"));
  21004. + as_warn (_("some symbol undefined; zero assumed"));
  21005. retval = absolute_section;
  21006. expP->X_op = O_constant;
  21007. expP->X_add_number = 0;
  21008. }
  21009. know (retval == absolute_section || SEG_NORMAL (retval));
  21010. return (retval);
  21011. -} /* get_known_segmented_expression() */
  21012. +} /* get_known_segmented_expression() */
  21013. offsetT
  21014. get_absolute_expression ()
  21015. @@ -4727,15 +5003,15 @@ get_absolute_expression ()
  21016. if (exp.X_op != O_constant)
  21017. {
  21018. if (exp.X_op != O_absent)
  21019. - as_bad (_("bad or irreducible absolute expression; zero assumed"));
  21020. + as_bad (_("bad or irreducible absolute expression; zero assumed"));
  21021. exp.X_add_number = 0;
  21022. }
  21023. return exp.X_add_number;
  21024. }
  21025. -char /* return terminator */
  21026. +char /* return terminator */
  21027. get_absolute_expression_and_terminator (val_pointer)
  21028. - long *val_pointer; /* return value of expression */
  21029. + long *val_pointer; /* return value of expression */
  21030. {
  21031. /* FIXME: val_pointer should probably be offsetT *. */
  21032. *val_pointer = (long) get_absolute_expression ();
  21033. @@ -4743,7 +5019,7 @@ get_absolute_expression_and_terminator (val_pointer)
  21034. }
  21035. /*
  21036. - * demand_copy_C_string()
  21037. + * demand_copy_C_string()
  21038. *
  21039. * Like demand_copy_string, but return NULL if the string contains any '\0's.
  21040. * Give a warning if that happens.
  21041. @@ -4759,21 +5035,21 @@ demand_copy_C_string (len_pointer)
  21042. register int len;
  21043. for (len = *len_pointer; len > 0; len--)
  21044. - {
  21045. - if (*s == 0)
  21046. - {
  21047. - s = 0;
  21048. - len = 1;
  21049. - *len_pointer = 0;
  21050. - as_bad (_("This string may not contain \'\\0\'"));
  21051. - }
  21052. - }
  21053. + {
  21054. + if (*s == 0)
  21055. + {
  21056. + s = 0;
  21057. + len = 1;
  21058. + *len_pointer = 0;
  21059. + as_bad (_("This string may not contain \'\\0\'"));
  21060. + }
  21061. + }
  21062. }
  21063. return s;
  21064. }
  21065. /*
  21066. - * demand_copy_string()
  21067. + * demand_copy_string()
  21068. *
  21069. * Demand string, but return a safe (=private) copy of the string.
  21070. * Return NULL if we can't read a string here.
  21071. @@ -4790,15 +5066,15 @@ demand_copy_string (lenP)
  21072. SKIP_WHITESPACE ();
  21073. if (*input_line_pointer == '\"')
  21074. {
  21075. - input_line_pointer++; /* Skip opening quote. */
  21076. + input_line_pointer++; /* Skip opening quote. */
  21077. while (is_a_char (c = next_char_of_string ()))
  21078. - {
  21079. - obstack_1grow (&notes, c);
  21080. - len++;
  21081. - }
  21082. + {
  21083. + obstack_1grow (&notes, c);
  21084. + len++;
  21085. + }
  21086. /* JF this next line is so demand_copy_C_string will return a
  21087. - null terminated string. */
  21088. + null terminated string. */
  21089. obstack_1grow (&notes, '\0');
  21090. retval = obstack_finish (&notes);
  21091. }
  21092. @@ -4810,30 +5086,30 @@ demand_copy_string (lenP)
  21093. }
  21094. *lenP = len;
  21095. return (retval);
  21096. -} /* demand_copy_string() */
  21097. +} /* demand_copy_string() */
  21098. /*
  21099. - * is_it_end_of_statement()
  21100. + * is_it_end_of_statement()
  21101. *
  21102. - * In: Input_line_pointer->next character.
  21103. + * In: Input_line_pointer->next character.
  21104. *
  21105. - * Do: Skip input_line_pointer over all whitespace.
  21106. + * Do: Skip input_line_pointer over all whitespace.
  21107. *
  21108. - * Out: 1 if input_line_pointer->end-of-line.
  21109. + * Out: 1 if input_line_pointer->end-of-line.
  21110. */
  21111. int
  21112. is_it_end_of_statement ()
  21113. {
  21114. SKIP_WHITESPACE ();
  21115. return (is_end_of_line[(unsigned char) *input_line_pointer]);
  21116. -} /* is_it_end_of_statement() */
  21117. +} /* is_it_end_of_statement() */
  21118. void
  21119. equals (sym_name, reassign)
  21120. char *sym_name;
  21121. int reassign;
  21122. {
  21123. - register symbolS *symbolP; /* symbol we are working with */
  21124. + register symbolS *symbolP; /* symbol we are working with */
  21125. char *stop = NULL;
  21126. char stopc;
  21127. @@ -4855,16 +5131,16 @@ equals (sym_name, reassign)
  21128. segment = get_known_segmented_expression (&exp);
  21129. if (!need_pass_2)
  21130. - do_org (segment, &exp, 0);
  21131. + do_org (segment, &exp, 0);
  21132. }
  21133. else
  21134. {
  21135. symbolP = symbol_find_or_make (sym_name);
  21136. /* Permit register names to be redefined. */
  21137. if (! reassign
  21138. - && S_IS_DEFINED (symbolP)
  21139. - && S_GET_SEGMENT (symbolP) != reg_section)
  21140. - as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
  21141. + && S_IS_DEFINED (symbolP)
  21142. + && S_GET_SEGMENT (symbolP) != reg_section)
  21143. + as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP));
  21144. pseudo_set (symbolP);
  21145. }
  21146. @@ -4873,7 +5149,7 @@ equals (sym_name, reassign)
  21147. ignore_rest_of_line (); /* check garbage after the expression */
  21148. mri_comment_end (stop, stopc);
  21149. }
  21150. -} /* equals() */
  21151. +} /* equals() */
  21152. /* .include -- include a file at this point. */
  21153. @@ -4891,28 +5167,28 @@ s_include (arg)
  21154. {
  21155. filename = demand_copy_string (&i);
  21156. if (filename == NULL)
  21157. - {
  21158. - /* demand_copy_string has already printed an error and
  21159. + {
  21160. + /* demand_copy_string has already printed an error and
  21161. called ignore_rest_of_line. */
  21162. - return;
  21163. - }
  21164. + return;
  21165. + }
  21166. }
  21167. else
  21168. {
  21169. SKIP_WHITESPACE ();
  21170. i = 0;
  21171. while (! is_end_of_line[(unsigned char) *input_line_pointer]
  21172. - && *input_line_pointer != ' '
  21173. - && *input_line_pointer != '\t')
  21174. - {
  21175. - obstack_1grow (&notes, *input_line_pointer);
  21176. - ++input_line_pointer;
  21177. - ++i;
  21178. - }
  21179. + && *input_line_pointer != ' '
  21180. + && *input_line_pointer != '\t')
  21181. + {
  21182. + obstack_1grow (&notes, *input_line_pointer);
  21183. + ++input_line_pointer;
  21184. + ++i;
  21185. + }
  21186. obstack_1grow (&notes, '\0');
  21187. filename = obstack_finish (&notes);
  21188. while (! is_end_of_line[(unsigned char) *input_line_pointer])
  21189. - ++input_line_pointer;
  21190. + ++input_line_pointer;
  21191. }
  21192. demand_empty_rest_of_line ();
  21193. path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
  21194. @@ -4922,10 +5198,10 @@ s_include (arg)
  21195. strcat (path, "/");
  21196. strcat (path, filename);
  21197. if (0 != (try = fopen (path, "r")))
  21198. - {
  21199. - fclose (try);
  21200. - goto gotit;
  21201. - }
  21202. + {
  21203. + fclose (try);
  21204. + goto gotit;
  21205. + }
  21206. }
  21207. free (path);
  21208. path = filename;
  21209. @@ -4933,7 +5209,7 @@ gotit:
  21210. /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
  21211. register_dependency (path);
  21212. input_scrub_insert_file (path);
  21213. -} /* s_include() */
  21214. +} /* s_include() */
  21215. void
  21216. add_include_dir (path)
  21217. @@ -4944,29 +5220,29 @@ add_include_dir (path)
  21218. if (include_dir_count == 0)
  21219. {
  21220. include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
  21221. - include_dirs[0] = "."; /* Current dir */
  21222. + include_dirs[0] = "."; /* Current dir */
  21223. include_dir_count = 2;
  21224. }
  21225. else
  21226. {
  21227. include_dir_count++;
  21228. include_dirs = (char **) realloc (include_dirs,
  21229. - include_dir_count * sizeof (*include_dirs));
  21230. + include_dir_count * sizeof (*include_dirs));
  21231. }
  21232. - include_dirs[include_dir_count - 1] = path; /* New one */
  21233. + include_dirs[include_dir_count - 1] = path; /* New one */
  21234. i = strlen (path);
  21235. if (i > include_dir_maxlen)
  21236. include_dir_maxlen = i;
  21237. -} /* add_include_dir() */
  21238. +} /* add_include_dir() */
  21239. /* Output debugging information to denote the source file. */
  21240. static void
  21241. generate_file_debug ()
  21242. {
  21243. - if (debug_type == DEBUG_STABS)
  21244. + if (debug_type == DEBUG_STABS)
  21245. stabs_generate_asm_file ();
  21246. }
  21247. @@ -4983,7 +5259,7 @@ generate_lineno_debug ()
  21248. if (ECOFF_DEBUGGING && ecoff_no_current_file ())
  21249. debug_type = DEBUG_ECOFF;
  21250. else
  21251. - debug_type = DEBUG_NONE;
  21252. + debug_type = DEBUG_NONE;
  21253. }
  21254. #endif
  21255. @@ -5032,14 +5308,14 @@ do_s_func (end_p, default_prefix)
  21256. if (end_p)
  21257. {
  21258. if (current_name == NULL)
  21259. - {
  21260. - as_bad (_("missing .func"));
  21261. - ignore_rest_of_line ();
  21262. - return;
  21263. - }
  21264. + {
  21265. + as_bad (_("missing .func"));
  21266. + ignore_rest_of_line ();
  21267. + return;
  21268. + }
  21269. if (debug_type == DEBUG_STABS)
  21270. - stabs_generate_asm_endfunc (current_name, current_label);
  21271. + stabs_generate_asm_endfunc (current_name, current_label);
  21272. current_name = current_label = NULL;
  21273. }
  21274. @@ -5049,11 +5325,11 @@ do_s_func (end_p, default_prefix)
  21275. char delim1,delim2;
  21276. if (current_name != NULL)
  21277. - {
  21278. - as_bad (_(".endfunc missing for previous .func"));
  21279. - ignore_rest_of_line ();
  21280. - return;
  21281. - }
  21282. + {
  21283. + as_bad (_(".endfunc missing for previous .func"));
  21284. + ignore_rest_of_line ();
  21285. + return;
  21286. + }
  21287. name = input_line_pointer;
  21288. delim1 = get_symbol_end ();
  21289. @@ -5061,35 +5337,35 @@ do_s_func (end_p, default_prefix)
  21290. *input_line_pointer = delim1;
  21291. SKIP_WHITESPACE ();
  21292. if (*input_line_pointer != ',')
  21293. - {
  21294. - if (default_prefix)
  21295. - asprintf (&label, "%s%s", default_prefix, name);
  21296. - else
  21297. - {
  21298. - char leading_char = 0;
  21299. + {
  21300. + if (default_prefix)
  21301. + asprintf (&label, "%s%s", default_prefix, name);
  21302. + else
  21303. + {
  21304. + char leading_char = 0;
  21305. #ifdef BFD_ASSEMBLER
  21306. - leading_char = bfd_get_symbol_leading_char (stdoutput);
  21307. + leading_char = bfd_get_symbol_leading_char (stdoutput);
  21308. #endif
  21309. - /* Missing entry point, use function's name with the leading
  21310. - char prepended. */
  21311. - if (leading_char)
  21312. - asprintf (&label, "%c%s", leading_char, name);
  21313. - else
  21314. - label = name;
  21315. - }
  21316. - }
  21317. + /* Missing entry point, use function's name with the leading
  21318. + char prepended. */
  21319. + if (leading_char)
  21320. + asprintf (&label, "%c%s", leading_char, name);
  21321. + else
  21322. + label = name;
  21323. + }
  21324. + }
  21325. else
  21326. - {
  21327. - ++input_line_pointer;
  21328. - SKIP_WHITESPACE ();
  21329. - label = input_line_pointer;
  21330. - delim2 = get_symbol_end ();
  21331. - label = xstrdup (label);
  21332. - *input_line_pointer = delim2;
  21333. - }
  21334. + {
  21335. + ++input_line_pointer;
  21336. + SKIP_WHITESPACE ();
  21337. + label = input_line_pointer;
  21338. + delim2 = get_symbol_end ();
  21339. + label = xstrdup (label);
  21340. + *input_line_pointer = delim2;
  21341. + }
  21342. if (debug_type == DEBUG_STABS)
  21343. - stabs_generate_asm_func (name, label);
  21344. + stabs_generate_asm_func (name, label);
  21345. current_name = name;
  21346. current_label = label;
  21347. diff --git a/gas/stabs.c b/gas/stabs.c
  21348. index 7c13c2f..bbd8bfc 100644
  21349. --- a/gas/stabs.c
  21350. +++ b/gas/stabs.c
  21351. @@ -107,12 +107,12 @@ get_stab_string_offset (string, stabstr_secname)
  21352. #ifdef BFD_ASSEMBLER
  21353. bfd_set_section_flags (stdoutput, seg, SEC_READONLY | SEC_DEBUGGING);
  21354. if (seg->name == stabstr_secname)
  21355. - seg->name = xstrdup (stabstr_secname);
  21356. + seg->name = xstrdup (stabstr_secname);
  21357. #endif
  21358. }
  21359. if (length > 0)
  21360. - { /* Ordinary case. */
  21361. + { /* Ordinary case. */
  21362. p = frag_more (length + 1);
  21363. strcpy (p, string);
  21364. @@ -128,7 +128,7 @@ get_stab_string_offset (string, stabstr_secname)
  21365. #ifdef AOUT_STABS
  21366. #ifndef OBJ_PROCESS_STAB
  21367. -#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D)
  21368. +#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) aout_process_stab(W,S,T,O,D)
  21369. #endif
  21370. static void aout_process_stab PARAMS ((int, const char *, int, int, int));
  21371. @@ -148,7 +148,7 @@ aout_process_stab (what, string, type, other, desc)
  21372. ends in "\" and the debug info is continued in the next .stabs
  21373. directive) from being separated by other random symbols. */
  21374. symbol = symbol_create (string, undefined_section, 0,
  21375. - (struct frag *) NULL);
  21376. + (struct frag *) NULL);
  21377. if (what == 's' || what == 'n')
  21378. {
  21379. /* Pick up the value from the input line. */
  21380. @@ -203,13 +203,13 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21381. string = demand_copy_C_string (&length);
  21382. SKIP_WHITESPACE ();
  21383. if (*input_line_pointer == ',')
  21384. - input_line_pointer++;
  21385. + input_line_pointer++;
  21386. else
  21387. - {
  21388. - as_warn (_(".stabs: Missing comma"));
  21389. - ignore_rest_of_line ();
  21390. - return;
  21391. - }
  21392. + {
  21393. + as_warn (_(".stabs: Missing comma"));
  21394. + ignore_rest_of_line ();
  21395. + return;
  21396. + }
  21397. }
  21398. if (get_absolute_expression_and_terminator (&longint) != ',')
  21399. @@ -232,11 +232,11 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21400. if (what == 's' || what == 'n')
  21401. {
  21402. if (*input_line_pointer != ',')
  21403. - {
  21404. - as_warn (_(".stab%c: Missing comma"), what);
  21405. - ignore_rest_of_line ();
  21406. - return;
  21407. - }
  21408. + {
  21409. + as_warn (_(".stab%c: Missing comma"), what);
  21410. + ignore_rest_of_line ();
  21411. + return;
  21412. + }
  21413. input_line_pointer++;
  21414. SKIP_WHITESPACE ();
  21415. }
  21416. @@ -251,12 +251,12 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21417. SKIP_WHITESPACE ();
  21418. if (*input_line_pointer == ',')
  21419. - {
  21420. - input_line_pointer++;
  21421. - what = 'n';
  21422. - }
  21423. + {
  21424. + input_line_pointer++;
  21425. + what = 'n';
  21426. + }
  21427. else
  21428. - input_line_pointer = save_location;
  21429. + input_line_pointer = save_location;
  21430. }
  21431. #endif /* OBJ_ELF */
  21432. #endif /* TC_PPC */
  21433. @@ -265,15 +265,15 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21434. if (listing)
  21435. {
  21436. switch (type)
  21437. - {
  21438. - case N_SLINE:
  21439. - listing_source_line ((unsigned int) desc);
  21440. - break;
  21441. - case N_SO:
  21442. - case N_SOL:
  21443. - listing_source_file (string);
  21444. - break;
  21445. - }
  21446. + {
  21447. + case N_SLINE:
  21448. + listing_source_line ((unsigned int) desc);
  21449. + break;
  21450. + case N_SO:
  21451. + case N_SOL:
  21452. + listing_source_file (string);
  21453. + break;
  21454. + }
  21455. }
  21456. #endif /* ! NO_LISTING */
  21457. @@ -303,40 +303,40 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21458. #endif
  21459. if (cached_secname && !strcmp (cached_secname, stab_secname))
  21460. - {
  21461. - seg = cached_sec;
  21462. - subseg_set (seg, 0);
  21463. - }
  21464. + {
  21465. + seg = cached_sec;
  21466. + subseg_set (seg, 0);
  21467. + }
  21468. else
  21469. - {
  21470. - seg = subseg_new (stab_secname, 0);
  21471. - if (cached_secname)
  21472. - free (cached_secname);
  21473. - cached_secname = xstrdup (stab_secname);
  21474. - cached_sec = seg;
  21475. - }
  21476. + {
  21477. + seg = subseg_new (stab_secname, 0);
  21478. + if (cached_secname)
  21479. + free (cached_secname);
  21480. + cached_secname = xstrdup (stab_secname);
  21481. + cached_sec = seg;
  21482. + }
  21483. if (! seg_info (seg)->hadone)
  21484. - {
  21485. + {
  21486. #ifdef BFD_ASSEMBLER
  21487. - bfd_set_section_flags (stdoutput, seg,
  21488. - SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
  21489. + bfd_set_section_flags (stdoutput, seg,
  21490. + SEC_READONLY | SEC_RELOC | SEC_DEBUGGING);
  21491. #endif
  21492. #ifdef INIT_STAB_SECTION
  21493. - INIT_STAB_SECTION (seg);
  21494. + INIT_STAB_SECTION (seg);
  21495. #endif
  21496. - seg_info (seg)->hadone = 1;
  21497. - }
  21498. + seg_info (seg)->hadone = 1;
  21499. + }
  21500. stroff = get_stab_string_offset (string, stabstr_secname);
  21501. if (what == 's')
  21502. - {
  21503. - /* release the string */
  21504. - obstack_free (&notes, string);
  21505. - }
  21506. + {
  21507. + /* release the string */
  21508. + obstack_free (&notes, string);
  21509. + }
  21510. /* At least for now, stabs in a special stab section are always
  21511. - output as 12 byte blocks of information. */
  21512. + output as 12 byte blocks of information. */
  21513. p = frag_more (8);
  21514. md_number_to_chars (p, (valueT) stroff, 4);
  21515. md_number_to_chars (p + 4, (valueT) type, 1);
  21516. @@ -344,27 +344,27 @@ s_stab_generic (what, stab_secname, stabstr_secname)
  21517. md_number_to_chars (p + 6, (valueT) desc, 2);
  21518. if (what == 's' || what == 'n')
  21519. - {
  21520. - /* Pick up the value from the input line. */
  21521. - cons (4);
  21522. - input_line_pointer--;
  21523. - }
  21524. + {
  21525. + /* Pick up the value from the input line. */
  21526. + cons (4);
  21527. + input_line_pointer--;
  21528. + }
  21529. else
  21530. - {
  21531. - const char *fake;
  21532. - symbolS *symbol;
  21533. - expressionS exp;
  21534. + {
  21535. + const char *fake;
  21536. + symbolS *symbol;
  21537. + expressionS exp;
  21538. - /* Arrange for a value representing the current location. */
  21539. - fake = FAKE_LABEL_NAME;
  21540. - symbol = symbol_new (fake, saved_seg, dot, saved_frag);
  21541. + /* Arrange for a value representing the current location. */
  21542. + fake = FAKE_LABEL_NAME;
  21543. + symbol = symbol_new (fake, saved_seg, dot, saved_frag);
  21544. - exp.X_op = O_symbol;
  21545. - exp.X_add_symbol = symbol;
  21546. - exp.X_add_number = 0;
  21547. + exp.X_op = O_symbol;
  21548. + exp.X_add_symbol = symbol;
  21549. + exp.X_add_number = 0;
  21550. - emit_expr (&exp, 4);
  21551. - }
  21552. + emit_expr (&exp, 4);
  21553. + }
  21554. #ifdef OBJ_PROCESS_STAB
  21555. OBJ_PROCESS_STAB (seg, what, string, type, other, desc);
  21556. @@ -425,10 +425,10 @@ s_xstab (what)
  21557. strcpy (stabstr_secname, stab_secname);
  21558. strcat (stabstr_secname, "str");
  21559. if (saved_secname)
  21560. - {
  21561. - free (saved_secname);
  21562. - free (saved_strsecname);
  21563. - }
  21564. + {
  21565. + free (saved_secname);
  21566. + free (saved_strsecname);
  21567. + }
  21568. saved_secname = stab_secname;
  21569. saved_strsecname = stabstr_secname;
  21570. }
  21571. @@ -471,12 +471,17 @@ s_desc (ignore)
  21572. S_SET_DESC (symbolP, temp);
  21573. }
  21574. demand_empty_rest_of_line ();
  21575. -} /* s_desc() */
  21576. +} /* s_desc() */
  21577. #endif /* defined (S_SET_DESC) */
  21578. /* Generate stabs debugging information to denote the main source file. */
  21579. +/* add T.Tazaki 2002.02.26 >>> */
  21580. +extern char *c33_stabs_input_file;
  21581. +extern enum debug_info_type debug_type;
  21582. +/* add T.Tazaki 2002.02.26 <<< */
  21583. +
  21584. void
  21585. stabs_generate_asm_file ()
  21586. {
  21587. @@ -484,6 +489,10 @@ stabs_generate_asm_file ()
  21588. unsigned int lineno;
  21589. as_where (&file, &lineno);
  21590. +
  21591. + if( *c33_stabs_input_file != NULL ) /* add T.Tazaki 2002.02.26 */
  21592. + file = c33_stabs_input_file; /* add T.Tazaki 2002.02.26 */
  21593. +
  21594. generate_asm_file (N_SO, file);
  21595. }
  21596. @@ -498,8 +507,11 @@ generate_asm_file (type, file)
  21597. static char *last_file;
  21598. static int label_count;
  21599. char *hold;
  21600. - char *buf = xmalloc (2 * strlen (file) + 10);
  21601. - char sym[30];
  21602. +// char *buf = xmalloc (2 * strlen (file) + 10);/* buf fix 2003/06/17 */
  21603. +// char *buf = xmalloc (2 * strlen (file) + 12); /* buf fix 2003/06/17 */
  21604. + char *buf = xmalloc (2 * strlen (file) + 30); /* buf fix 2004/01/05 */
  21605. +// char sym[30];/* buf fix 2004/01/05 */
  21606. + char sym[60];/* buf fix 2004/01/05 */
  21607. /* Rather than try to do this in some efficient fashion, we just
  21608. generate a string and then parse it again. That lets us use the
  21609. @@ -538,7 +550,7 @@ generate_asm_file (type, file)
  21610. colon (sym);
  21611. if (last_file != NULL)
  21612. - free (last_file);
  21613. + free (last_file);
  21614. last_file = xstrdup (file);
  21615. }
  21616. @@ -568,6 +580,9 @@ stabs_generate_asm_lineno ()
  21617. as_where (&file, &lineno);
  21618. + if( *c33_stabs_input_file != NULL ) /* add T.Tazaki 2002.02.26 */
  21619. + file = c33_stabs_input_file; /* add T.Tazaki 2002.02.26 */
  21620. +
  21621. generate_asm_file (N_SOL, file);
  21622. sprintf (sym, "%sL%d", FAKE_LABEL_NAME, label_count);
  21623. @@ -577,7 +592,7 @@ stabs_generate_asm_lineno ()
  21624. {
  21625. buf = (char *) alloca (100 + strlen (current_function_label));
  21626. sprintf (buf, "%d,0,%d,%s-%s\n", N_SLINE, lineno,
  21627. - sym, current_function_label);
  21628. + sym, current_function_label);
  21629. }
  21630. else
  21631. {
  21632. @@ -614,7 +629,7 @@ stabs_generate_asm_func (funcname, startlabname)
  21633. as_where (&file, &lineno);
  21634. asprintf (&buf, "\"%s:F1\",%d,0,%d,%s",
  21635. - funcname, N_FUN, lineno + 1, startlabname);
  21636. + funcname, N_FUN, lineno + 1, startlabname);
  21637. input_line_pointer = buf;
  21638. s_stab ('s');
  21639. free (buf);
  21640. diff --git a/gas/write.c b/gas/write.c
  21641. index e386ece..8386c4f 100644
  21642. --- a/gas/write.c
  21643. +++ b/gas/write.c
  21644. @@ -48,7 +48,7 @@
  21645. #define TC_FORCE_RELOCATION_SECTION(FIXP,SEG) TC_FORCE_RELOCATION(FIXP)
  21646. #endif
  21647. -#ifndef MD_PCREL_FROM_SECTION
  21648. +#ifndef MD_PCREL_FROM_SECTION
  21649. #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from(FIXP)
  21650. #endif
  21651. @@ -77,9 +77,9 @@ struct frag *text_frag_root;
  21652. struct frag *data_frag_root;
  21653. struct frag *bss_frag_root;
  21654. -struct frag *text_last_frag; /* Last frag in segment. */
  21655. -struct frag *data_last_frag; /* Last frag in segment. */
  21656. -static struct frag *bss_last_frag; /* Last frag in segment. */
  21657. +struct frag *text_last_frag; /* Last frag in segment. */
  21658. +struct frag *data_last_frag; /* Last frag in segment. */
  21659. +static struct frag *bss_last_frag; /* Last frag in segment. */
  21660. #endif
  21661. #ifndef BFD
  21662. @@ -87,7 +87,7 @@ static object_headers headers;
  21663. #endif
  21664. long string_byte_count;
  21665. -char *next_object_file_charP; /* Tracks object file bytes. */
  21666. +char *next_object_file_charP; /* Tracks object file bytes. */
  21667. #ifndef OBJ_VMS
  21668. int magic_number_for_object_file = DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE;
  21669. @@ -99,14 +99,14 @@ static int n_fixups;
  21670. #ifdef BFD_ASSEMBLER
  21671. static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
  21672. - symbolS *add, symbolS *sub,
  21673. - offsetT offset, int pcrel,
  21674. - bfd_reloc_code_real_type r_type));
  21675. + symbolS *add, symbolS *sub,
  21676. + offsetT offset, int pcrel,
  21677. + bfd_reloc_code_real_type r_type));
  21678. #else
  21679. static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
  21680. - symbolS *add, symbolS *sub,
  21681. - offsetT offset, int pcrel,
  21682. - int r_type));
  21683. + symbolS *add, symbolS *sub,
  21684. + offsetT offset, int pcrel,
  21685. + int r_type));
  21686. #endif
  21687. #if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
  21688. static long fixup_segment PARAMS ((fixS * fixP, segT this_segment_type));
  21689. @@ -134,24 +134,24 @@ static void relax_and_size_all_segments PARAMS ((void));
  21690. #endif
  21691. /*
  21692. - * fix_new()
  21693. + * fix_new()
  21694. *
  21695. * Create a fixS in obstack 'notes'.
  21696. */
  21697. static fixS *
  21698. fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
  21699. - r_type)
  21700. - fragS *frag; /* Which frag? */
  21701. - int where; /* Where in that frag? */
  21702. - int size; /* 1, 2, or 4 usually. */
  21703. - symbolS *add_symbol; /* X_add_symbol. */
  21704. - symbolS *sub_symbol; /* X_op_symbol. */
  21705. - offsetT offset; /* X_add_number. */
  21706. - int pcrel; /* TRUE if PC-relative relocation. */
  21707. + r_type)
  21708. + fragS *frag; /* Which frag? */
  21709. + int where; /* Where in that frag? */
  21710. + int size; /* 1, 2, or 4 usually. */
  21711. + symbolS *add_symbol; /* X_add_symbol. */
  21712. + symbolS *sub_symbol; /* X_op_symbol. */
  21713. + offsetT offset; /* X_add_number. */
  21714. + int pcrel; /* TRUE if PC-relative relocation. */
  21715. #ifdef BFD_ASSEMBLER
  21716. bfd_reloc_code_real_type r_type; /* Relocation type */
  21717. #else
  21718. - int r_type; /* Relocation type */
  21719. + int r_type; /* Relocation type */
  21720. #endif
  21721. {
  21722. fixS *fixP;
  21723. @@ -206,11 +206,11 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
  21724. #ifdef BFD_ASSEMBLER
  21725. fixS **seg_fix_rootP = (frags_chained
  21726. - ? &seg_info (now_seg)->fix_root
  21727. - : &frchain_now->fix_root);
  21728. + ? &seg_info (now_seg)->fix_root
  21729. + : &frchain_now->fix_root);
  21730. fixS **seg_fix_tailP = (frags_chained
  21731. - ? &seg_info (now_seg)->fix_tail
  21732. - : &frchain_now->fix_tail);
  21733. + ? &seg_info (now_seg)->fix_tail
  21734. + : &frchain_now->fix_tail);
  21735. #endif
  21736. #ifdef REVERSE_SORT_RELOCS
  21737. @@ -239,20 +239,20 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
  21738. fixS *
  21739. fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
  21740. - fragS *frag; /* Which frag? */
  21741. - int where; /* Where in that frag? */
  21742. - int size; /* 1, 2, or 4 usually. */
  21743. - symbolS *add_symbol; /* X_add_symbol. */
  21744. - offsetT offset; /* X_add_number. */
  21745. - int pcrel; /* TRUE if PC-relative relocation. */
  21746. + fragS *frag; /* Which frag? */
  21747. + int where; /* Where in that frag? */
  21748. + int size; /* 1, 2, or 4 usually. */
  21749. + symbolS *add_symbol; /* X_add_symbol. */
  21750. + offsetT offset; /* X_add_number. */
  21751. + int pcrel; /* TRUE if PC-relative relocation. */
  21752. #ifdef BFD_ASSEMBLER
  21753. bfd_reloc_code_real_type r_type; /* Relocation type */
  21754. #else
  21755. - int r_type; /* Relocation type */
  21756. + int r_type; /* Relocation type */
  21757. #endif
  21758. {
  21759. return fix_new_internal (frag, where, size, add_symbol,
  21760. - (symbolS *) NULL, offset, pcrel, r_type);
  21761. + (symbolS *) NULL, offset, pcrel, r_type);
  21762. }
  21763. /* Create a fixup for an expression. Currently we only support fixups
  21764. @@ -261,15 +261,15 @@ fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
  21765. fixS *
  21766. fix_new_exp (frag, where, size, exp, pcrel, r_type)
  21767. - fragS *frag; /* Which frag? */
  21768. - int where; /* Where in that frag? */
  21769. - int size; /* 1, 2, or 4 usually. */
  21770. - expressionS *exp; /* Expression. */
  21771. - int pcrel; /* TRUE if PC-relative relocation. */
  21772. + fragS *frag; /* Which frag? */
  21773. + int where; /* Where in that frag? */
  21774. + int size; /* 1, 2, or 4 usually. */
  21775. + expressionS *exp; /* Expression. */
  21776. + int pcrel; /* TRUE if PC-relative relocation. */
  21777. #ifdef BFD_ASSEMBLER
  21778. bfd_reloc_code_real_type r_type; /* Relocation type */
  21779. #else
  21780. - int r_type; /* Relocation type */
  21781. + int r_type; /* Relocation type */
  21782. #endif
  21783. {
  21784. symbolS *add = NULL;
  21785. @@ -283,14 +283,14 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
  21786. case O_add:
  21787. /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if
  21788. - the difference expression cannot immediately be reduced. */
  21789. + the difference expression cannot immediately be reduced. */
  21790. {
  21791. - symbolS *stmp = make_expr_symbol (exp);
  21792. - exp->X_op = O_symbol;
  21793. - exp->X_op_symbol = 0;
  21794. - exp->X_add_symbol = stmp;
  21795. - exp->X_add_number = 0;
  21796. - return fix_new_exp (frag, where, size, exp, pcrel, r_type);
  21797. + symbolS *stmp = make_expr_symbol (exp);
  21798. + exp->X_op = O_symbol;
  21799. + exp->X_op_symbol = 0;
  21800. + exp->X_add_symbol = stmp;
  21801. + exp->X_add_number = 0;
  21802. + return fix_new_exp (frag, where, size, exp, pcrel, r_type);
  21803. }
  21804. case O_symbol_rva:
  21805. @@ -329,7 +329,7 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
  21806. }
  21807. return fix_new_internal (frag, where, size, add, sub, off,
  21808. - pcrel, r_type);
  21809. + pcrel, r_type);
  21810. }
  21811. /* Append a string onto another string, bumping the pointer along. */
  21812. @@ -362,7 +362,7 @@ record_alignment (seg, align)
  21813. /* Segment to which alignment pertains */
  21814. segT seg;
  21815. /* Alignment, as a power of 2 (e.g., 1 => 2-byte boundary, 2 => 4-byte
  21816. - boundary, etc.) */
  21817. + boundary, etc.) */
  21818. int align;
  21819. {
  21820. if (seg == absolute_section)
  21821. @@ -413,13 +413,13 @@ chain_frchains_together_1 (section, frchp)
  21822. assert (prev_frag->fr_type != 0);
  21823. #ifdef BFD_ASSEMBLER
  21824. if (frchp->fix_root != (fixS *) NULL)
  21825. - {
  21826. - if (seg_info (section)->fix_root == (fixS *) NULL)
  21827. - seg_info (section)->fix_root = frchp->fix_root;
  21828. - prev_fix->fx_next = frchp->fix_root;
  21829. - seg_info (section)->fix_tail = frchp->fix_tail;
  21830. - prev_fix = frchp->fix_tail;
  21831. - }
  21832. + {
  21833. + if (seg_info (section)->fix_root == (fixS *) NULL)
  21834. + seg_info (section)->fix_root = frchp->fix_root;
  21835. + prev_fix->fx_next = frchp->fix_root;
  21836. + seg_info (section)->fix_tail = frchp->fix_tail;
  21837. + prev_fix = frchp->fix_tail;
  21838. + }
  21839. #endif
  21840. }
  21841. assert (prev_frag->fr_type != 0);
  21842. @@ -494,14 +494,14 @@ cvt_frag_to_fill (headersP, sec, fragP)
  21843. #endif
  21844. know (fragP->fr_next != NULL);
  21845. fragP->fr_offset = (fragP->fr_next->fr_address
  21846. - - fragP->fr_address
  21847. - - fragP->fr_fix) / fragP->fr_var;
  21848. + - fragP->fr_address
  21849. + - fragP->fr_fix) / fragP->fr_var;
  21850. if (fragP->fr_offset < 0)
  21851. - {
  21852. - as_bad_where (fragP->fr_file, fragP->fr_line,
  21853. - _("attempt to .org/.space backwards? (%ld)"),
  21854. - (long) fragP->fr_offset);
  21855. - }
  21856. + {
  21857. + as_bad_where (fragP->fr_file, fragP->fr_line,
  21858. + _("attempt to .org/.space backwards? (%ld)"),
  21859. + (long) fragP->fr_offset);
  21860. + }
  21861. fragP->fr_type = rs_fill;
  21862. break;
  21863. @@ -510,17 +510,17 @@ cvt_frag_to_fill (headersP, sec, fragP)
  21864. case rs_leb128:
  21865. {
  21866. - valueT value = S_GET_VALUE (fragP->fr_symbol);
  21867. - int size;
  21868. + valueT value = S_GET_VALUE (fragP->fr_symbol);
  21869. + int size;
  21870. - size = output_leb128 (fragP->fr_literal + fragP->fr_fix, value,
  21871. - fragP->fr_subtype);
  21872. + size = output_leb128 (fragP->fr_literal + fragP->fr_fix, value,
  21873. + fragP->fr_subtype);
  21874. - fragP->fr_fix += size;
  21875. - fragP->fr_type = rs_fill;
  21876. - fragP->fr_var = 0;
  21877. - fragP->fr_offset = 0;
  21878. - fragP->fr_symbol = NULL;
  21879. + fragP->fr_fix += size;
  21880. + fragP->fr_type = rs_fill;
  21881. + fragP->fr_var = 0;
  21882. + fragP->fr_offset = 0;
  21883. + fragP->fr_symbol = NULL;
  21884. }
  21885. break;
  21886. @@ -536,8 +536,8 @@ cvt_frag_to_fill (headersP, sec, fragP)
  21887. #endif
  21888. assert (fragP->fr_next == NULL
  21889. - || ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
  21890. - == fragP->fr_fix));
  21891. + || ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
  21892. + == fragP->fr_fix));
  21893. /*
  21894. * After md_convert_frag, we make the frag into a ".space 0".
  21895. @@ -550,18 +550,18 @@ cvt_frag_to_fill (headersP, sec, fragP)
  21896. #ifndef WORKING_DOT_WORD
  21897. case rs_broken_word:
  21898. {
  21899. - struct broken_word *lie;
  21900. -
  21901. - if (fragP->fr_subtype)
  21902. - {
  21903. - fragP->fr_fix += md_short_jump_size;
  21904. - for (lie = (struct broken_word *) (fragP->fr_symbol);
  21905. - lie && lie->dispfrag == fragP;
  21906. - lie = lie->next_broken_word)
  21907. - if (lie->added == 1)
  21908. - fragP->fr_fix += md_long_jump_size;
  21909. - }
  21910. - frag_wane (fragP);
  21911. + struct broken_word *lie;
  21912. +
  21913. + if (fragP->fr_subtype)
  21914. + {
  21915. + fragP->fr_fix += md_short_jump_size;
  21916. + for (lie = (struct broken_word *) (fragP->fr_symbol);
  21917. + lie && lie->dispfrag == fragP;
  21918. + lie = lie->next_broken_word)
  21919. + if (lie->added == 1)
  21920. + fragP->fr_fix += md_long_jump_size;
  21921. + }
  21922. + frag_wane (fragP);
  21923. }
  21924. break;
  21925. #endif
  21926. @@ -596,11 +596,11 @@ relax_and_size_seg (abfd, sec, xxx)
  21927. {
  21928. relax_segment (seginfo->frchainP->frch_root, sec);
  21929. for (fragp = seginfo->frchainP->frch_root; fragp; fragp = fragp->fr_next)
  21930. - cvt_frag_to_fill (sec, fragp);
  21931. + cvt_frag_to_fill (sec, fragp);
  21932. for (fragp = seginfo->frchainP->frch_root;
  21933. - fragp->fr_next;
  21934. - fragp = fragp->fr_next)
  21935. - /* walk to last elt */;
  21936. + fragp->fr_next;
  21937. + fragp = fragp->fr_next)
  21938. + /* walk to last elt */;
  21939. size = fragp->fr_address + fragp->fr_fix;
  21940. }
  21941. else
  21942. @@ -629,7 +629,7 @@ relax_and_size_seg (abfd, sec, xxx)
  21943. fragS *last = seginfo->frchainP->frch_last;
  21944. fragp = seginfo->frchainP->frch_root;
  21945. while (fragp->fr_next != last)
  21946. - fragp = fragp->fr_next;
  21947. + fragp = fragp->fr_next;
  21948. last->fr_address = size;
  21949. fragp->fr_offset += newsize - size;
  21950. }
  21951. @@ -662,19 +662,19 @@ dump_section_relocs (abfd, sec, stream_)
  21952. symbolS *s = fixp->fx_addsy;
  21953. fprintf (stream, " %08lx: type %d ", (unsigned long) fixp,
  21954. - (int) fixp->fx_r_type);
  21955. + (int) fixp->fx_r_type);
  21956. if (s == NULL)
  21957. - fprintf (stream, "no sym\n");
  21958. + fprintf (stream, "no sym\n");
  21959. else
  21960. - {
  21961. - print_symbol_value_1 (stream, s);
  21962. - fprintf (stream, "\n");
  21963. - }
  21964. + {
  21965. + print_symbol_value_1 (stream, s);
  21966. + fprintf (stream, "\n");
  21967. + }
  21968. fixp = fixp->fx_next;
  21969. }
  21970. }
  21971. #else
  21972. -#define dump_section_relocs(ABFD,SEC,STREAM) ((void) 0)
  21973. +#define dump_section_relocs(ABFD,SEC,STREAM) ((void) 0)
  21974. #endif
  21975. #ifndef EMIT_SECTION_SYMBOLS
  21976. @@ -700,184 +700,184 @@ adjust_reloc_syms (abfd, sec, xxx)
  21977. /* ignore it */;
  21978. else if (fixp->fx_addsy)
  21979. {
  21980. - symbolS *sym;
  21981. - asection *symsec;
  21982. + symbolS *sym;
  21983. + asection *symsec;
  21984. #ifdef DEBUG5
  21985. - fprintf (stderr, "\n\nadjusting fixup:\n");
  21986. - print_fixup (fixp);
  21987. + fprintf (stderr, "\n\nadjusting fixup:\n");
  21988. + print_fixup (fixp);
  21989. #endif
  21990. - sym = fixp->fx_addsy;
  21991. + sym = fixp->fx_addsy;
  21992. - /* All symbols should have already been resolved at this
  21993. - point. It is possible to see unresolved expression
  21994. - symbols, though, since they are not in the regular symbol
  21995. - table. */
  21996. - if (sym != NULL)
  21997. - resolve_symbol_value (sym, 1);
  21998. -
  21999. - if (fixp->fx_subsy != NULL)
  22000. - resolve_symbol_value (fixp->fx_subsy, 1);
  22001. + /* All symbols should have already been resolved at this
  22002. + point. It is possible to see unresolved expression
  22003. + symbols, though, since they are not in the regular symbol
  22004. + table. */
  22005. + if (sym != NULL)
  22006. + resolve_symbol_value (sym, 1);
  22007. +
  22008. + if (fixp->fx_subsy != NULL)
  22009. + resolve_symbol_value (fixp->fx_subsy, 1);
  22010. - /* If this symbol is equated to an undefined symbol, convert
  22011. + /* If this symbol is equated to an undefined symbol, convert
  22012. the fixup to being against that symbol. */
  22013. - if (sym != NULL && symbol_equated_p (sym)
  22014. - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22015. - {
  22016. - fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
  22017. - sym = symbol_get_value_expression (sym)->X_add_symbol;
  22018. - fixp->fx_addsy = sym;
  22019. - }
  22020. -
  22021. - if (sym != NULL && symbol_mri_common_p (sym))
  22022. - {
  22023. - /* These symbols are handled specially in fixup_segment. */
  22024. - goto done;
  22025. - }
  22026. -
  22027. - symsec = S_GET_SEGMENT (sym);
  22028. -
  22029. - if (symsec == NULL)
  22030. - abort ();
  22031. -
  22032. - if (bfd_is_abs_section (symsec))
  22033. - {
  22034. - /* The fixup_segment routine will not use this symbol in a
  22035. + if (sym != NULL && symbol_equated_p (sym)
  22036. + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22037. + {
  22038. + fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
  22039. + sym = symbol_get_value_expression (sym)->X_add_symbol;
  22040. + fixp->fx_addsy = sym;
  22041. + }
  22042. +
  22043. + if (sym != NULL && symbol_mri_common_p (sym))
  22044. + {
  22045. + /* These symbols are handled specially in fixup_segment. */
  22046. + goto done;
  22047. + }
  22048. +
  22049. + symsec = S_GET_SEGMENT (sym);
  22050. +
  22051. + if (symsec == NULL)
  22052. + abort ();
  22053. +
  22054. + if (bfd_is_abs_section (symsec))
  22055. + {
  22056. + /* The fixup_segment routine will not use this symbol in a
  22057. relocation unless TC_FORCE_RELOCATION returns 1. */
  22058. - if (TC_FORCE_RELOCATION (fixp))
  22059. - {
  22060. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22061. + if (TC_FORCE_RELOCATION (fixp))
  22062. + {
  22063. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22064. #ifdef UNDEFINED_DIFFERENCE_OK
  22065. - if (fixp->fx_subsy != NULL)
  22066. - symbol_mark_used_in_reloc (fixp->fx_subsy);
  22067. -#endif
  22068. - }
  22069. - goto done;
  22070. - }
  22071. -
  22072. - /* If it's one of these sections, assume the symbol is
  22073. - definitely going to be output. The code in
  22074. - md_estimate_size_before_relax in tc-mips.c uses this test
  22075. - as well, so if you change this code you should look at that
  22076. - code. */
  22077. - if (bfd_is_und_section (symsec)
  22078. - || bfd_is_com_section (symsec))
  22079. - {
  22080. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22081. + if (fixp->fx_subsy != NULL)
  22082. + symbol_mark_used_in_reloc (fixp->fx_subsy);
  22083. +#endif
  22084. + }
  22085. + goto done;
  22086. + }
  22087. +
  22088. + /* If it's one of these sections, assume the symbol is
  22089. + definitely going to be output. The code in
  22090. + md_estimate_size_before_relax in tc-mips.c uses this test
  22091. + as well, so if you change this code you should look at that
  22092. + code. */
  22093. + if (bfd_is_und_section (symsec)
  22094. + || bfd_is_com_section (symsec))
  22095. + {
  22096. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22097. #ifdef UNDEFINED_DIFFERENCE_OK
  22098. - /* We have the difference of an undefined symbol and some
  22099. - other symbol. Make sure to mark the other symbol as used
  22100. - in a relocation so that it will always be output. */
  22101. - if (fixp->fx_subsy)
  22102. - symbol_mark_used_in_reloc (fixp->fx_subsy);
  22103. + /* We have the difference of an undefined symbol and some
  22104. + other symbol. Make sure to mark the other symbol as used
  22105. + in a relocation so that it will always be output. */
  22106. + if (fixp->fx_subsy)
  22107. + symbol_mark_used_in_reloc (fixp->fx_subsy);
  22108. #endif
  22109. - goto done;
  22110. - }
  22111. + goto done;
  22112. + }
  22113. - /* Don't try to reduce relocs which refer to non-local symbols
  22114. + /* Don't try to reduce relocs which refer to non-local symbols
  22115. in .linkonce sections. It can lead to confusion when a
  22116. debugging section refers to a .linkonce section. I hope
  22117. this will always be correct. */
  22118. - if (symsec != sec && ! S_IS_LOCAL (sym))
  22119. - {
  22120. - boolean linkonce;
  22121. + if (symsec != sec && ! S_IS_LOCAL (sym))
  22122. + {
  22123. + boolean linkonce;
  22124. - linkonce = false;
  22125. + linkonce = false;
  22126. #ifdef BFD_ASSEMBLER
  22127. - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE)
  22128. - != 0)
  22129. - linkonce = true;
  22130. + if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE)
  22131. + != 0)
  22132. + linkonce = true;
  22133. #endif
  22134. #ifdef OBJ_ELF
  22135. - /* The GNU toolchain uses an extension for ELF: a section
  22136. + /* The GNU toolchain uses an extension for ELF: a section
  22137. beginning with the magic string .gnu.linkonce is a
  22138. linkonce section. */
  22139. - if (strncmp (segment_name (symsec), ".gnu.linkonce",
  22140. - sizeof ".gnu.linkonce" - 1) == 0)
  22141. - linkonce = true;
  22142. + if (strncmp (segment_name (symsec), ".gnu.linkonce",
  22143. + sizeof ".gnu.linkonce" - 1) == 0)
  22144. + linkonce = true;
  22145. #endif
  22146. - if (linkonce)
  22147. - {
  22148. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22149. + if (linkonce)
  22150. + {
  22151. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22152. #ifdef UNDEFINED_DIFFERENCE_OK
  22153. - if (fixp->fx_subsy != NULL)
  22154. - symbol_mark_used_in_reloc (fixp->fx_subsy);
  22155. + if (fixp->fx_subsy != NULL)
  22156. + symbol_mark_used_in_reloc (fixp->fx_subsy);
  22157. #endif
  22158. - goto done;
  22159. - }
  22160. - }
  22161. + goto done;
  22162. + }
  22163. + }
  22164. - /* Since we're reducing to section symbols, don't attempt to reduce
  22165. - anything that's already using one. */
  22166. - if (symbol_section_p (sym))
  22167. - {
  22168. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22169. - goto done;
  22170. - }
  22171. + /* Since we're reducing to section symbols, don't attempt to reduce
  22172. + anything that's already using one. */
  22173. + if (symbol_section_p (sym))
  22174. + {
  22175. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22176. + goto done;
  22177. + }
  22178. #ifdef BFD_ASSEMBLER
  22179. - /* We can never adjust a reloc against a weak symbol. If we
  22180. + /* We can never adjust a reloc against a weak symbol. If we
  22181. did, and the weak symbol was overridden by a real symbol
  22182. somewhere else, then our relocation would be pointing at
  22183. the wrong area of memory. */
  22184. - if (S_IS_WEAK (sym))
  22185. - {
  22186. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22187. - goto done;
  22188. - }
  22189. + if (S_IS_WEAK (sym))
  22190. + {
  22191. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22192. + goto done;
  22193. + }
  22194. #endif
  22195. - /* Is there some other reason we can't adjust this one? (E.g.,
  22196. - call/bal links in i960-bout symbols.) */
  22197. + /* Is there some other reason we can't adjust this one? (E.g.,
  22198. + call/bal links in i960-bout symbols.) */
  22199. #ifdef obj_fix_adjustable
  22200. - if (! obj_fix_adjustable (fixp))
  22201. - {
  22202. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22203. - goto done;
  22204. - }
  22205. + if (! obj_fix_adjustable (fixp))
  22206. + {
  22207. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22208. + goto done;
  22209. + }
  22210. #endif
  22211. - /* Is there some other (target cpu dependent) reason we can't adjust
  22212. - this one? (E.g. relocations involving function addresses on
  22213. - the PA. */
  22214. + /* Is there some other (target cpu dependent) reason we can't adjust
  22215. + this one? (E.g. relocations involving function addresses on
  22216. + the PA. */
  22217. #ifdef tc_fix_adjustable
  22218. - if (! tc_fix_adjustable (fixp))
  22219. - {
  22220. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22221. - goto done;
  22222. - }
  22223. -#endif
  22224. -
  22225. - /* If the section symbol isn't going to be output, the relocs
  22226. - at least should still work. If not, figure out what to do
  22227. - when we run into that case.
  22228. -
  22229. - We refetch the segment when calling section_symbol, rather
  22230. - than using symsec, because S_GET_VALUE may wind up changing
  22231. - the section when it calls resolve_symbol_value. */
  22232. - fixp->fx_offset += S_GET_VALUE (sym);
  22233. - fixp->fx_addsy = section_symbol (S_GET_SEGMENT (sym));
  22234. - symbol_mark_used_in_reloc (fixp->fx_addsy);
  22235. + if (! tc_fix_adjustable (fixp))
  22236. + {
  22237. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22238. + goto done;
  22239. + }
  22240. +#endif
  22241. +
  22242. + /* If the section symbol isn't going to be output, the relocs
  22243. + at least should still work. If not, figure out what to do
  22244. + when we run into that case.
  22245. +
  22246. + We refetch the segment when calling section_symbol, rather
  22247. + than using symsec, because S_GET_VALUE may wind up changing
  22248. + the section when it calls resolve_symbol_value. */
  22249. + fixp->fx_offset += S_GET_VALUE (sym);
  22250. + fixp->fx_addsy = section_symbol (S_GET_SEGMENT (sym));
  22251. + symbol_mark_used_in_reloc (fixp->fx_addsy);
  22252. #ifdef DEBUG5
  22253. - fprintf (stderr, "\nadjusted fixup:\n");
  22254. - print_fixup (fixp);
  22255. + fprintf (stderr, "\nadjusted fixup:\n");
  22256. + print_fixup (fixp);
  22257. #endif
  22258. done:
  22259. - ;
  22260. + ;
  22261. }
  22262. #if 1/*def RELOC_REQUIRES_SYMBOL*/
  22263. else
  22264. {
  22265. - /* There was no symbol required by this relocation. However,
  22266. - BFD doesn't really handle relocations without symbols well.
  22267. - (At least, the COFF support doesn't.) So for now we fake up
  22268. - a local symbol in the absolute section. */
  22269. + /* There was no symbol required by this relocation. However,
  22270. + BFD doesn't really handle relocations without symbols well.
  22271. + (At least, the COFF support doesn't.) So for now we fake up
  22272. + a local symbol in the absolute section. */
  22273. - fixp->fx_addsy = section_symbol (absolute_section);
  22274. -/* fixp->fx_addsy->sy_used_in_reloc = 1; */
  22275. + fixp->fx_addsy = section_symbol (absolute_section);
  22276. +/* fixp->fx_addsy->sy_used_in_reloc = 1; */
  22277. }
  22278. #endif
  22279. @@ -921,62 +921,62 @@ write_relocs (abfd, sec, xxx)
  22280. symbolS *sym;
  22281. if (fixp->fx_done)
  22282. - {
  22283. - n--;
  22284. - continue;
  22285. - }
  22286. + {
  22287. + n--;
  22288. + continue;
  22289. + }
  22290. /* If this is an undefined symbol which was equated to another
  22291. symbol, then use generate the reloc against the latter symbol
  22292. rather than the former. */
  22293. sym = fixp->fx_addsy;
  22294. while (symbol_equated_p (sym)
  22295. - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22296. - {
  22297. - symbolS *n;
  22298. -
  22299. - /* We must avoid looping, as that can occur with a badly
  22300. - written program. */
  22301. - n = symbol_get_value_expression (sym)->X_add_symbol;
  22302. - if (n == sym)
  22303. - break;
  22304. - fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
  22305. - sym = n;
  22306. - }
  22307. + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22308. + {
  22309. + symbolS *n;
  22310. +
  22311. + /* We must avoid looping, as that can occur with a badly
  22312. + written program. */
  22313. + n = symbol_get_value_expression (sym)->X_add_symbol;
  22314. + if (n == sym)
  22315. + break;
  22316. + fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
  22317. + sym = n;
  22318. + }
  22319. fixp->fx_addsy = sym;
  22320. reloc = tc_gen_reloc (sec, fixp);
  22321. if (!reloc)
  22322. - {
  22323. - n--;
  22324. - continue;
  22325. - }
  22326. + {
  22327. + n--;
  22328. + continue;
  22329. + }
  22330. #if 0
  22331. /* This test is triggered inappropriately for the SH. */
  22332. if (fixp->fx_where + fixp->fx_size
  22333. - > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
  22334. - abort ();
  22335. + > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
  22336. + abort ();
  22337. #endif
  22338. s = bfd_install_relocation (stdoutput, reloc,
  22339. - fixp->fx_frag->fr_literal,
  22340. - fixp->fx_frag->fr_address,
  22341. - sec, &err);
  22342. + fixp->fx_frag->fr_literal,
  22343. + fixp->fx_frag->fr_address,
  22344. + sec, &err);
  22345. switch (s)
  22346. - {
  22347. - case bfd_reloc_ok:
  22348. - break;
  22349. - case bfd_reloc_overflow:
  22350. - as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation overflow"));
  22351. - break;
  22352. - case bfd_reloc_outofrange:
  22353. - as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation out of range"));
  22354. - break;
  22355. - default:
  22356. - as_fatal (_("%s:%u: bad return from bfd_install_relocation: %x"),
  22357. - fixp->fx_file, fixp->fx_line, s);
  22358. - }
  22359. + {
  22360. + case bfd_reloc_ok:
  22361. + break;
  22362. + case bfd_reloc_overflow:
  22363. + as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation overflow"));
  22364. + break;
  22365. + case bfd_reloc_outofrange:
  22366. + as_bad_where (fixp->fx_file, fixp->fx_line, _("relocation out of range"));
  22367. + break;
  22368. + default:
  22369. + as_fatal (_("%s:%u: bad return from bfd_install_relocation: %x"),
  22370. + fixp->fx_file, fixp->fx_line, s);
  22371. + }
  22372. relocs[i++] = reloc;
  22373. }
  22374. #else
  22375. @@ -994,50 +994,50 @@ write_relocs (abfd, sec, xxx)
  22376. int j;
  22377. if (fixp->fx_done)
  22378. - {
  22379. - n--;
  22380. - continue;
  22381. - }
  22382. + {
  22383. + n--;
  22384. + continue;
  22385. + }
  22386. /* If this is an undefined symbol which was equated to another
  22387. symbol, then use generate the reloc against the latter symbol
  22388. rather than the former. */
  22389. sym = fixp->fx_addsy;
  22390. while (symbol_equated_p (sym)
  22391. - && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22392. - sym = symbol_get_value_expression (sym)->X_add_symbol;
  22393. + && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
  22394. + sym = symbol_get_value_expression (sym)->X_add_symbol;
  22395. fixp->fx_addsy = sym;
  22396. reloc = tc_gen_reloc (sec, fixp);
  22397. for (j = 0; reloc[j]; j++)
  22398. - {
  22399. + {
  22400. relocs[i++] = reloc[j];
  22401. assert(i <= n);
  22402. - }
  22403. + }
  22404. data = fixp->fx_frag->fr_literal + fixp->fx_where;
  22405. if (fixp->fx_where + fixp->fx_size
  22406. - > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
  22407. - as_bad_where (fixp->fx_file, fixp->fx_line,
  22408. - _("internal error: fixup not contained within frag"));
  22409. + > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
  22410. + as_bad_where (fixp->fx_file, fixp->fx_line,
  22411. + _("internal error: fixup not contained within frag"));
  22412. for (j = 0; reloc[j]; j++)
  22413. {
  22414. - s = bfd_install_relocation (stdoutput, reloc[j],
  22415. - fixp->fx_frag->fr_literal,
  22416. - fixp->fx_frag->fr_address,
  22417. - sec, &err);
  22418. + s = bfd_install_relocation (stdoutput, reloc[j],
  22419. + fixp->fx_frag->fr_literal,
  22420. + fixp->fx_frag->fr_address,
  22421. + sec, &err);
  22422. switch (s)
  22423. - {
  22424. - case bfd_reloc_ok:
  22425. - break;
  22426. - case bfd_reloc_overflow:
  22427. - as_bad_where (fixp->fx_file, fixp->fx_line,
  22428. - _("relocation overflow"));
  22429. - break;
  22430. - default:
  22431. - as_fatal (_("%s:%u: bad return from bfd_install_relocation"),
  22432. - fixp->fx_file, fixp->fx_line);
  22433. - }
  22434. + {
  22435. + case bfd_reloc_ok:
  22436. + break;
  22437. + case bfd_reloc_overflow:
  22438. + as_bad_where (fixp->fx_file, fixp->fx_line,
  22439. + _("relocation overflow"));
  22440. + break;
  22441. + default:
  22442. + as_fatal (_("%s:%u: bad return from bfd_install_relocation"),
  22443. + fixp->fx_file, fixp->fx_line);
  22444. + }
  22445. }
  22446. }
  22447. n = i;
  22448. @@ -1051,13 +1051,13 @@ write_relocs (abfd, sec, xxx)
  22449. nsyms = bfd_get_symcount (stdoutput);
  22450. for (i = 0; i < n; i++)
  22451. if (((*relocs[i]->sym_ptr_ptr)->flags & BSF_SECTION_SYM) == 0)
  22452. - {
  22453. - for (j = 0; j < nsyms; j++)
  22454. - if (sympp[j] == *relocs[i]->sym_ptr_ptr)
  22455. - break;
  22456. - if (j == nsyms)
  22457. - abort ();
  22458. - }
  22459. + {
  22460. + for (j = 0; j < nsyms; j++)
  22461. + if (sympp[j] == *relocs[i]->sym_ptr_ptr)
  22462. + break;
  22463. + if (j == nsyms)
  22464. + abort ();
  22465. + }
  22466. }
  22467. #endif
  22468. @@ -1065,8 +1065,8 @@ write_relocs (abfd, sec, xxx)
  22469. bfd_set_reloc (stdoutput, sec, relocs, n);
  22470. else
  22471. bfd_set_section_flags (abfd, sec,
  22472. - (bfd_get_section_flags (abfd, sec)
  22473. - & (flagword) ~SEC_RELOC));
  22474. + (bfd_get_section_flags (abfd, sec)
  22475. + & (flagword) ~SEC_RELOC));
  22476. #ifdef SET_SECTION_RELOCS
  22477. SET_SECTION_RELOCS (sec, relocs, n);
  22478. @@ -1080,10 +1080,10 @@ write_relocs (abfd, sec, xxx)
  22479. fprintf (stderr, "relocs for sec %s\n", sec->name);
  22480. for (i = 0; i < n; i++)
  22481. {
  22482. - r = relocs[i];
  22483. - s = *r->sym_ptr_ptr;
  22484. - fprintf (stderr, " reloc %2d @%08x off %4x : sym %-10s addend %x\n",
  22485. - i, r, r->address, s->name, r->addend);
  22486. + r = relocs[i];
  22487. + s = *r->sym_ptr_ptr;
  22488. + fprintf (stderr, " reloc %2d @%08x off %4x : sym %-10s addend %x\n",
  22489. + i, r, r->address, s->name, r->addend);
  22490. }
  22491. }
  22492. #endif
  22493. @@ -1115,73 +1115,73 @@ write_contents (abfd, sec, xxx)
  22494. assert (f->fr_type == rs_fill);
  22495. if (f->fr_fix)
  22496. - {
  22497. - x = bfd_set_section_contents (stdoutput, sec,
  22498. - f->fr_literal, (file_ptr) offset,
  22499. - (bfd_size_type) f->fr_fix);
  22500. - if (x == false)
  22501. - {
  22502. - bfd_perror (stdoutput->filename);
  22503. - as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
  22504. - exit (EXIT_FAILURE);
  22505. - }
  22506. - offset += f->fr_fix;
  22507. - }
  22508. + {
  22509. + x = bfd_set_section_contents (stdoutput, sec,
  22510. + f->fr_literal, (file_ptr) offset,
  22511. + (bfd_size_type) f->fr_fix);
  22512. + if (x == false)
  22513. + {
  22514. + bfd_perror (stdoutput->filename);
  22515. + as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
  22516. + exit (EXIT_FAILURE);
  22517. + }
  22518. + offset += f->fr_fix;
  22519. + }
  22520. fill_literal = f->fr_literal + f->fr_fix;
  22521. fill_size = f->fr_var;
  22522. count = f->fr_offset;
  22523. assert (count >= 0);
  22524. if (fill_size && count)
  22525. - {
  22526. - char buf[256];
  22527. - if (fill_size > sizeof(buf))
  22528. - {
  22529. - /* Do it the old way. Can this ever happen? */
  22530. - while (count--)
  22531. - {
  22532. - x = bfd_set_section_contents (stdoutput, sec,
  22533. - fill_literal,
  22534. - (file_ptr) offset,
  22535. - (bfd_size_type) fill_size);
  22536. - if (x == false)
  22537. - {
  22538. - bfd_perror (stdoutput->filename);
  22539. - as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
  22540. - exit (EXIT_FAILURE);
  22541. - }
  22542. - offset += fill_size;
  22543. - }
  22544. - }
  22545. - else
  22546. - {
  22547. - /* Build a buffer full of fill objects and output it as
  22548. - often as necessary. This saves on the overhead of
  22549. - potentially lots of bfd_set_section_contents calls. */
  22550. - int n_per_buf, i;
  22551. - if (fill_size == 1)
  22552. - {
  22553. - n_per_buf = sizeof (buf);
  22554. - memset (buf, *fill_literal, n_per_buf);
  22555. - }
  22556. - else
  22557. - {
  22558. - char *bufp;
  22559. - n_per_buf = sizeof(buf)/fill_size;
  22560. - for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size)
  22561. - memcpy(bufp, fill_literal, fill_size);
  22562. - }
  22563. - for (; count > 0; count -= n_per_buf)
  22564. - {
  22565. - n_per_buf = n_per_buf > count ? count : n_per_buf;
  22566. - x = bfd_set_section_contents (stdoutput, sec,
  22567. - buf, (file_ptr) offset,
  22568. - (bfd_size_type) n_per_buf * fill_size);
  22569. - if (x != true)
  22570. - as_fatal (_("Cannot write to output file."));
  22571. - offset += n_per_buf * fill_size;
  22572. - }
  22573. - }
  22574. - }
  22575. + {
  22576. + char buf[256];
  22577. + if (fill_size > sizeof(buf))
  22578. + {
  22579. + /* Do it the old way. Can this ever happen? */
  22580. + while (count--)
  22581. + {
  22582. + x = bfd_set_section_contents (stdoutput, sec,
  22583. + fill_literal,
  22584. + (file_ptr) offset,
  22585. + (bfd_size_type) fill_size);
  22586. + if (x == false)
  22587. + {
  22588. + bfd_perror (stdoutput->filename);
  22589. + as_perror (_("FATAL: Can't write %s"), stdoutput->filename);
  22590. + exit (EXIT_FAILURE);
  22591. + }
  22592. + offset += fill_size;
  22593. + }
  22594. + }
  22595. + else
  22596. + {
  22597. + /* Build a buffer full of fill objects and output it as
  22598. + often as necessary. This saves on the overhead of
  22599. + potentially lots of bfd_set_section_contents calls. */
  22600. + int n_per_buf, i;
  22601. + if (fill_size == 1)
  22602. + {
  22603. + n_per_buf = sizeof (buf);
  22604. + memset (buf, *fill_literal, n_per_buf);
  22605. + }
  22606. + else
  22607. + {
  22608. + char *bufp;
  22609. + n_per_buf = sizeof(buf)/fill_size;
  22610. + for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size)
  22611. + memcpy(bufp, fill_literal, fill_size);
  22612. + }
  22613. + for (; count > 0; count -= n_per_buf)
  22614. + {
  22615. + n_per_buf = n_per_buf > count ? count : n_per_buf;
  22616. + x = bfd_set_section_contents (stdoutput, sec,
  22617. + buf, (file_ptr) offset,
  22618. + (bfd_size_type) n_per_buf * fill_size);
  22619. + if (x != true)
  22620. + as_fatal (_("Cannot write to output file."));
  22621. + offset += n_per_buf * fill_size;
  22622. + }
  22623. + }
  22624. + }
  22625. }
  22626. }
  22627. #endif
  22628. @@ -1248,21 +1248,21 @@ relax_and_size_all_segments ()
  22629. H_SET_DATA_SIZE (&headers, data_last_frag->fr_address);
  22630. data_last_frag->fr_address = H_GET_DATA_SIZE (&headers);
  22631. - slide = H_GET_TEXT_SIZE (&headers); /* & in file of the data segment. */
  22632. + slide = H_GET_TEXT_SIZE (&headers); /* & in file of the data segment. */
  22633. #ifdef OBJ_BOUT
  22634. #define RoundUp(N,S) (((N)+(S)-1)&-(S))
  22635. /* For b.out: If the data section has a strict alignment
  22636. - requirement, its load address in the .o file will be
  22637. - rounded up from the size of the text section. These
  22638. - two values are *not* the same! Similarly for the bss
  22639. - section.... */
  22640. + requirement, its load address in the .o file will be
  22641. + rounded up from the size of the text section. These
  22642. + two values are *not* the same! Similarly for the bss
  22643. + section.... */
  22644. slide = RoundUp (slide, 1 << section_alignment[SEG_DATA]);
  22645. #endif
  22646. for (fragP = data_frag_root; fragP; fragP = fragP->fr_next)
  22647. - {
  22648. - fragP->fr_address += slide;
  22649. - } /* for each data frag */
  22650. + {
  22651. + fragP->fr_address += slide;
  22652. + } /* for each data frag */
  22653. know (text_last_frag != 0);
  22654. text_last_frag->fr_next = data_frag_root;
  22655. @@ -1285,7 +1285,7 @@ relax_and_size_all_segments ()
  22656. }
  22657. #else /* ! OBJ_BOUT */
  22658. bss_address_frag.fr_address = (H_GET_TEXT_SIZE (&headers) +
  22659. - H_GET_DATA_SIZE (&headers));
  22660. + H_GET_DATA_SIZE (&headers));
  22661. #endif /* ! OBJ_BOUT */
  22662. @@ -1295,14 +1295,14 @@ relax_and_size_all_segments ()
  22663. relax_addressT slide = bss_address_frag.fr_address;
  22664. for (fragP = bss_frag_root; fragP; fragP = fragP->fr_next)
  22665. - {
  22666. - fragP->fr_address += slide;
  22667. - } /* for each bss frag */
  22668. + {
  22669. + fragP->fr_address += slide;
  22670. + } /* for each bss frag */
  22671. }
  22672. if (bss_last_frag)
  22673. H_SET_BSS_SIZE (&headers,
  22674. - bss_last_frag->fr_address - bss_frag_root->fr_address);
  22675. + bss_last_frag->fr_address - bss_frag_root->fr_address);
  22676. else
  22677. H_SET_BSS_SIZE (&headers, 0);
  22678. }
  22679. @@ -1332,13 +1332,13 @@ set_symtab ()
  22680. int i;
  22681. asympp = (asymbol **) bfd_alloc (stdoutput,
  22682. - nsyms * sizeof (asymbol *));
  22683. + nsyms * sizeof (asymbol *));
  22684. symp = symbol_rootP;
  22685. for (i = 0; i < nsyms; i++, symp = symbol_next (symp))
  22686. - {
  22687. - asympp[i] = symbol_get_bfdsym (symp);
  22688. - symbol_mark_written (symp);
  22689. - }
  22690. + {
  22691. + asympp[i] = symbol_get_bfdsym (symp);
  22692. + symbol_mark_written (symp);
  22693. + }
  22694. }
  22695. else
  22696. asympp = 0;
  22697. @@ -1375,14 +1375,14 @@ subsegs_finish ()
  22698. any alignment is meaningless, and, moreover, will look weird
  22699. if we are generating a listing. */
  22700. frag_align (had_errors () ? 0 : SUB_SEGMENT_ALIGN (now_seg),
  22701. - subseg_text_p (now_seg) ? NOP_OPCODE : 0,
  22702. - 0);
  22703. + subseg_text_p (now_seg) ? NOP_OPCODE : 0,
  22704. + 0);
  22705. /* frag_align will have left a new frag.
  22706. - Use this last frag for an empty ".fill".
  22707. + Use this last frag for an empty ".fill".
  22708. - For this segment ...
  22709. - Create a last frag. Do not leave a "being filled in frag". */
  22710. + For this segment ...
  22711. + Create a last frag. Do not leave a "being filled in frag". */
  22712. frag_wane (frag_now);
  22713. frag_now->fr_fix = 0;
  22714. @@ -1396,7 +1396,7 @@ void
  22715. write_object_file ()
  22716. {
  22717. #if ! defined (BFD_ASSEMBLER) || ! defined (WORKING_DOT_WORD)
  22718. - fragS *fragP; /* Track along all frags. */
  22719. + fragS *fragP; /* Track along all frags. */
  22720. #endif
  22721. /* Do we really want to write it? */
  22722. @@ -1408,21 +1408,21 @@ write_object_file ()
  22723. regardless of warnings and errors. */
  22724. if (flag_always_generate_output)
  22725. {
  22726. - if (n_warns || n_errs)
  22727. - as_warn (_("%d error%s, %d warning%s, generating bad object file.\n"),
  22728. - n_errs, n_errs == 1 ? "" : "s",
  22729. - n_warns, n_warns == 1 ? "" : "s");
  22730. + if (n_warns || n_errs)
  22731. + as_warn (_("%d error%s, %d warning%s, generating bad object file.\n"),
  22732. + n_errs, n_errs == 1 ? "" : "s",
  22733. + n_warns, n_warns == 1 ? "" : "s");
  22734. }
  22735. else
  22736. {
  22737. - if (n_errs)
  22738. - as_fatal (_("%d error%s, %d warning%s, no object file generated.\n"),
  22739. - n_errs, n_errs == 1 ? "" : "s",
  22740. - n_warns, n_warns == 1 ? "" : "s");
  22741. + if (n_errs)
  22742. + as_fatal (_("%d error%s, %d warning%s, no object file generated.\n"),
  22743. + n_errs, n_errs == 1 ? "" : "s",
  22744. + n_warns, n_warns == 1 ? "" : "s");
  22745. }
  22746. }
  22747. -#ifdef OBJ_VMS
  22748. +#ifdef OBJ_VMS
  22749. /* Under VMS we try to be compatible with VAX-11 "C". Thus, we call
  22750. a routine to check for the definition of the procedure "_main",
  22751. and if so -- fix it up so that it can be program entry point. */
  22752. @@ -1441,17 +1441,17 @@ write_object_file ()
  22753. seclist = &stdoutput->sections;
  22754. while (seclist && *seclist)
  22755. {
  22756. - sec = *seclist;
  22757. - while (sec == reg_section || sec == expr_section)
  22758. - {
  22759. - sec = sec->next;
  22760. - *seclist = sec;
  22761. - stdoutput->section_count--;
  22762. - if (!sec)
  22763. - break;
  22764. - }
  22765. - if (*seclist)
  22766. - seclist = &(*seclist)->next;
  22767. + sec = *seclist;
  22768. + while (sec == reg_section || sec == expr_section)
  22769. + {
  22770. + sec = sec->next;
  22771. + *seclist = sec;
  22772. + stdoutput->section_count--;
  22773. + if (!sec)
  22774. + break;
  22775. + }
  22776. + if (*seclist)
  22777. + seclist = &(*seclist)->next;
  22778. }
  22779. i = 0;
  22780. bfd_map_over_sections (stdoutput, renumber_sections, &i);
  22781. @@ -1527,7 +1527,7 @@ write_object_file ()
  22782. which may call fix_new. We need to ensure that fix_new adds
  22783. the fixup to the right section. */
  22784. if (fragP == data_frag_root)
  22785. - subseg_change (SEG_DATA, 0);
  22786. + subseg_change (SEG_DATA, 0);
  22787. cvt_frag_to_fill (&headers, SEG_TEXT, fragP);
  22788. @@ -1535,11 +1535,11 @@ write_object_file ()
  22789. #ifndef NDEBUG
  22790. if (!(fragP->fr_next == NULL
  22791. #ifdef OBJ_BOUT
  22792. - || fragP->fr_next == data_frag_root
  22793. + || fragP->fr_next == data_frag_root
  22794. #endif
  22795. - || ((fragP->fr_next->fr_address - fragP->fr_address)
  22796. - == (fragP->fr_fix + fragP->fr_offset * fragP->fr_var))))
  22797. - abort ();
  22798. + || ((fragP->fr_next->fr_address - fragP->fr_address)
  22799. + == (fragP->fr_fix + fragP->fr_offset * fragP->fr_var))))
  22800. + abort ();
  22801. #endif
  22802. }
  22803. #endif /* ! BFD_ASSEMBLER */
  22804. @@ -1552,108 +1552,108 @@ write_object_file ()
  22805. prevP = &broken_words;
  22806. for (lie = broken_words; lie; lie = lie->next_broken_word)
  22807. if (!lie->added)
  22808. - {
  22809. - expressionS exp;
  22810. -
  22811. - subseg_change (lie->seg, lie->subseg);
  22812. - exp.X_op = O_subtract;
  22813. - exp.X_add_symbol = lie->add;
  22814. - exp.X_op_symbol = lie->sub;
  22815. - exp.X_add_number = lie->addnum;
  22816. + {
  22817. + expressionS exp;
  22818. +
  22819. + subseg_change (lie->seg, lie->subseg);
  22820. + exp.X_op = O_subtract;
  22821. + exp.X_add_symbol = lie->add;
  22822. + exp.X_op_symbol = lie->sub;
  22823. + exp.X_add_number = lie->addnum;
  22824. #ifdef BFD_ASSEMBLER
  22825. #ifdef TC_CONS_FIX_NEW
  22826. - TC_CONS_FIX_NEW (lie->frag,
  22827. - lie->word_goes_here - lie->frag->fr_literal,
  22828. - 2, &exp);
  22829. + TC_CONS_FIX_NEW (lie->frag,
  22830. + lie->word_goes_here - lie->frag->fr_literal,
  22831. + 2, &exp);
  22832. #else
  22833. - fix_new_exp (lie->frag,
  22834. - lie->word_goes_here - lie->frag->fr_literal,
  22835. - 2, &exp, 0, BFD_RELOC_16);
  22836. + fix_new_exp (lie->frag,
  22837. + lie->word_goes_here - lie->frag->fr_literal,
  22838. + 2, &exp, 0, BFD_RELOC_16);
  22839. #endif
  22840. #else
  22841. #if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
  22842. - fix_new_exp (lie->frag,
  22843. - lie->word_goes_here - lie->frag->fr_literal,
  22844. - 2, &exp, 0, NO_RELOC);
  22845. + fix_new_exp (lie->frag,
  22846. + lie->word_goes_here - lie->frag->fr_literal,
  22847. + 2, &exp, 0, NO_RELOC);
  22848. #else
  22849. #ifdef TC_NS32K
  22850. - fix_new_ns32k_exp (lie->frag,
  22851. - lie->word_goes_here - lie->frag->fr_literal,
  22852. - 2, &exp, 0, 0, 2, 0, 0);
  22853. + fix_new_ns32k_exp (lie->frag,
  22854. + lie->word_goes_here - lie->frag->fr_literal,
  22855. + 2, &exp, 0, 0, 2, 0, 0);
  22856. #else
  22857. - fix_new_exp (lie->frag,
  22858. - lie->word_goes_here - lie->frag->fr_literal,
  22859. - 2, &exp, 0, 0);
  22860. + fix_new_exp (lie->frag,
  22861. + lie->word_goes_here - lie->frag->fr_literal,
  22862. + 2, &exp, 0, 0);
  22863. #endif /* TC_NS32K */
  22864. #endif /* TC_SPARC|TC_A29K|NEED_FX_R_TYPE */
  22865. #endif /* BFD_ASSEMBLER */
  22866. - *prevP = lie->next_broken_word;
  22867. - }
  22868. + *prevP = lie->next_broken_word;
  22869. + }
  22870. else
  22871. - prevP = &(lie->next_broken_word);
  22872. + prevP = &(lie->next_broken_word);
  22873. for (lie = broken_words; lie;)
  22874. {
  22875. - struct broken_word *untruth;
  22876. - char *table_ptr;
  22877. - addressT table_addr;
  22878. - addressT from_addr, to_addr;
  22879. - int n, m;
  22880. -
  22881. - subseg_change (lie->seg, lie->subseg);
  22882. - fragP = lie->dispfrag;
  22883. -
  22884. - /* Find out how many broken_words go here. */
  22885. - n = 0;
  22886. - for (untruth = lie; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
  22887. - if (untruth->added == 1)
  22888. - n++;
  22889. -
  22890. - table_ptr = lie->dispfrag->fr_opcode;
  22891. - table_addr = lie->dispfrag->fr_address + (table_ptr - lie->dispfrag->fr_literal);
  22892. - /* Create the jump around the long jumps. This is a short
  22893. - jump from table_ptr+0 to table_ptr+n*long_jump_size. */
  22894. - from_addr = table_addr;
  22895. - to_addr = table_addr + md_short_jump_size + n * md_long_jump_size;
  22896. - md_create_short_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
  22897. - table_ptr += md_short_jump_size;
  22898. - table_addr += md_short_jump_size;
  22899. -
  22900. - for (m = 0; lie && lie->dispfrag == fragP; m++, lie = lie->next_broken_word)
  22901. - {
  22902. - if (lie->added == 2)
  22903. - continue;
  22904. - /* Patch the jump table */
  22905. - /* This is the offset from ??? to table_ptr+0 */
  22906. - to_addr = table_addr - S_GET_VALUE (lie->sub);
  22907. + struct broken_word *untruth;
  22908. + char *table_ptr;
  22909. + addressT table_addr;
  22910. + addressT from_addr, to_addr;
  22911. + int n, m;
  22912. +
  22913. + subseg_change (lie->seg, lie->subseg);
  22914. + fragP = lie->dispfrag;
  22915. +
  22916. + /* Find out how many broken_words go here. */
  22917. + n = 0;
  22918. + for (untruth = lie; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
  22919. + if (untruth->added == 1)
  22920. + n++;
  22921. +
  22922. + table_ptr = lie->dispfrag->fr_opcode;
  22923. + table_addr = lie->dispfrag->fr_address + (table_ptr - lie->dispfrag->fr_literal);
  22924. + /* Create the jump around the long jumps. This is a short
  22925. + jump from table_ptr+0 to table_ptr+n*long_jump_size. */
  22926. + from_addr = table_addr;
  22927. + to_addr = table_addr + md_short_jump_size + n * md_long_jump_size;
  22928. + md_create_short_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
  22929. + table_ptr += md_short_jump_size;
  22930. + table_addr += md_short_jump_size;
  22931. +
  22932. + for (m = 0; lie && lie->dispfrag == fragP; m++, lie = lie->next_broken_word)
  22933. + {
  22934. + if (lie->added == 2)
  22935. + continue;
  22936. + /* Patch the jump table */
  22937. + /* This is the offset from ??? to table_ptr+0 */
  22938. + to_addr = table_addr - S_GET_VALUE (lie->sub);
  22939. #ifdef BFD_ASSEMBLER
  22940. - to_addr -= symbol_get_frag (lie->sub)->fr_address;
  22941. -#endif
  22942. - md_number_to_chars (lie->word_goes_here, to_addr, 2);
  22943. - for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
  22944. - {
  22945. - if (untruth->use_jump == lie)
  22946. - md_number_to_chars (untruth->word_goes_here, to_addr, 2);
  22947. - }
  22948. -
  22949. - /* Install the long jump */
  22950. - /* this is a long jump from table_ptr+0 to the final target */
  22951. - from_addr = table_addr;
  22952. - to_addr = S_GET_VALUE (lie->add) + lie->addnum;
  22953. + to_addr -= symbol_get_frag (lie->sub)->fr_address;
  22954. +#endif
  22955. + md_number_to_chars (lie->word_goes_here, to_addr, 2);
  22956. + for (untruth = lie->next_broken_word; untruth && untruth->dispfrag == fragP; untruth = untruth->next_broken_word)
  22957. + {
  22958. + if (untruth->use_jump == lie)
  22959. + md_number_to_chars (untruth->word_goes_here, to_addr, 2);
  22960. + }
  22961. +
  22962. + /* Install the long jump */
  22963. + /* this is a long jump from table_ptr+0 to the final target */
  22964. + from_addr = table_addr;
  22965. + to_addr = S_GET_VALUE (lie->add) + lie->addnum;
  22966. #ifdef BFD_ASSEMBLER
  22967. - to_addr += symbol_get_frag (lie->add)->fr_address;
  22968. + to_addr += symbol_get_frag (lie->add)->fr_address;
  22969. #endif
  22970. - md_create_long_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
  22971. - table_ptr += md_long_jump_size;
  22972. - table_addr += md_long_jump_size;
  22973. - }
  22974. + md_create_long_jump (table_ptr, from_addr, to_addr, lie->dispfrag, lie->add);
  22975. + table_ptr += md_long_jump_size;
  22976. + table_addr += md_long_jump_size;
  22977. + }
  22978. }
  22979. }
  22980. #endif /* not WORKING_DOT_WORD */
  22981. #ifndef BFD_ASSEMBLER
  22982. -#ifndef OBJ_VMS
  22983. - { /* not vms */
  22984. +#ifndef OBJ_VMS
  22985. + { /* not vms */
  22986. char *the_object_file;
  22987. long object_file_size;
  22988. /*
  22989. @@ -1672,7 +1672,7 @@ write_object_file ()
  22990. H_SET_MAGIC_NUMBER (&headers, magic_number_for_object_file);
  22991. H_SET_ENTRY_POINT (&headers, 0);
  22992. - obj_pre_write_hook (&headers); /* extra coff stuff */
  22993. + obj_pre_write_hook (&headers); /* extra coff stuff */
  22994. object_file_size = H_GET_FILE_SIZE (&headers);
  22995. next_object_file_charP = the_object_file = xmalloc (object_file_size);
  22996. @@ -1688,23 +1688,23 @@ write_object_file ()
  22997. */
  22998. for (fragP = text_frag_root; fragP; fragP = fragP->fr_next)
  22999. {
  23000. - register long count;
  23001. - register char *fill_literal;
  23002. - register long fill_size;
  23003. + register long count;
  23004. + register char *fill_literal;
  23005. + register long fill_size;
  23006. - PROGRESS (1);
  23007. - know (fragP->fr_type == rs_fill);
  23008. - append (&next_object_file_charP, fragP->fr_literal, (unsigned long) fragP->fr_fix);
  23009. - fill_literal = fragP->fr_literal + fragP->fr_fix;
  23010. - fill_size = fragP->fr_var;
  23011. - know (fragP->fr_offset >= 0);
  23012. + PROGRESS (1);
  23013. + know (fragP->fr_type == rs_fill);
  23014. + append (&next_object_file_charP, fragP->fr_literal, (unsigned long) fragP->fr_fix);
  23015. + fill_literal = fragP->fr_literal + fragP->fr_fix;
  23016. + fill_size = fragP->fr_var;
  23017. + know (fragP->fr_offset >= 0);
  23018. - for (count = fragP->fr_offset; count; count--)
  23019. - {
  23020. - append (&next_object_file_charP, fill_literal, (unsigned long) fill_size);
  23021. - } /* for each */
  23022. + for (count = fragP->fr_offset; count; count--)
  23023. + {
  23024. + append (&next_object_file_charP, fill_literal, (unsigned long) fill_size);
  23025. + } /* for each */
  23026. - } /* for each code frag. */
  23027. + } /* for each code frag. */
  23028. know ((next_object_file_charP - the_object_file) == (H_GET_HEADER_SIZE (&headers) + H_GET_TEXT_SIZE (&headers) + H_GET_DATA_SIZE (&headers)));
  23029. @@ -1743,8 +1743,8 @@ write_object_file ()
  23030. if (string_byte_count > 0)
  23031. {
  23032. - obj_emit_strings (&next_object_file_charP);
  23033. - } /* only if we have a string table */
  23034. + obj_emit_strings (&next_object_file_charP);
  23035. + } /* only if we have a string table */
  23036. #ifdef BFD_HEADERS
  23037. bfd_seek (stdoutput, 0, 0);
  23038. @@ -1755,15 +1755,15 @@ write_object_file ()
  23039. output_file_append (the_object_file, object_file_size, out_file_name);
  23040. free (the_object_file);
  23041. #endif
  23042. - } /* non vms output */
  23043. + } /* non vms output */
  23044. #else /* OBJ_VMS */
  23045. /*
  23046. - * Now do the VMS-dependent part of writing the object file
  23047. + * Now do the VMS-dependent part of writing the object file
  23048. */
  23049. vms_write_object_file (H_GET_TEXT_SIZE (&headers),
  23050. - H_GET_DATA_SIZE (&headers),
  23051. - H_GET_BSS_SIZE (&headers),
  23052. - text_frag_root, data_frag_root);
  23053. + H_GET_DATA_SIZE (&headers),
  23054. + H_GET_BSS_SIZE (&headers),
  23055. + text_frag_root, data_frag_root);
  23056. #endif /* OBJ_VMS */
  23057. #else /* BFD_ASSEMBLER */
  23058. @@ -1774,7 +1774,7 @@ write_object_file ()
  23059. symbolS *symp;
  23060. for (symp = symbol_rootP; symp; symp = symbol_next (symp))
  23061. - resolve_symbol_value (symp, 1);
  23062. + resolve_symbol_value (symp, 1);
  23063. }
  23064. resolve_local_symbol_values ();
  23065. @@ -1795,98 +1795,107 @@ write_object_file ()
  23066. symbolS *symp;
  23067. for (symp = symbol_rootP; symp; symp = symbol_next (symp))
  23068. - {
  23069. - int punt = 0;
  23070. - const char *name;
  23071. -
  23072. - if (symbol_mri_common_p (symp))
  23073. - {
  23074. - if (S_IS_EXTERNAL (symp))
  23075. - as_bad (_("%s: global symbols not supported in common sections"),
  23076. - S_GET_NAME (symp));
  23077. - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23078. - continue;
  23079. - }
  23080. -
  23081. - name = S_GET_NAME (symp);
  23082. - if (name)
  23083. - {
  23084. - const char *name2 = decode_local_label_name ((char *)S_GET_NAME (symp));
  23085. - /* They only differ if `name' is a fb or dollar local
  23086. - label name. */
  23087. - if (name2 != name && ! S_IS_DEFINED (symp))
  23088. - as_bad (_("local label %s is not defined"), name2);
  23089. - }
  23090. -
  23091. - /* Do it again, because adjust_reloc_syms might introduce
  23092. - more symbols. They'll probably only be section symbols,
  23093. - but they'll still need to have the values computed. */
  23094. - resolve_symbol_value (symp, 1);
  23095. -
  23096. - /* Skip symbols which were equated to undefined or common
  23097. + {
  23098. + int punt = 0;
  23099. + const char *name;
  23100. +
  23101. + if (symbol_mri_common_p (symp))
  23102. + {
  23103. + if (S_IS_EXTERNAL (symp))
  23104. + as_bad (_("%s: global symbols not supported in common sections"),
  23105. + S_GET_NAME (symp));
  23106. + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23107. + continue;
  23108. + }
  23109. +
  23110. + name = S_GET_NAME (symp);
  23111. + if (name)
  23112. + {
  23113. + const char *name2 = decode_local_label_name ((char *)S_GET_NAME (symp));
  23114. + /* They only differ if `name' is a fb or dollar local
  23115. + label name. */
  23116. + if (name2 != name && ! S_IS_DEFINED (symp)){
  23117. + /* add T.Tazaki 2003/01/14 short source name length ==> error : bug fix */
  23118. + /* del T.Tazaki 2003/06/17 >>> */
  23119. +// if( !strncmp( name2,"\"0\" (",5 ) )
  23120. +// {
  23121. +// continue; /* skip */
  23122. +// }
  23123. + /* del T.Tazaki 2003/06/17 <<< */
  23124. + /* add T.Tazaki 2003/01/14 short source name length ==> error : bug fix */
  23125. + as_bad (_("local label %s is not defined"), name2);
  23126. + }
  23127. + }
  23128. +
  23129. + /* Do it again, because adjust_reloc_syms might introduce
  23130. + more symbols. They'll probably only be section symbols,
  23131. + but they'll still need to have the values computed. */
  23132. + resolve_symbol_value (symp, 1);
  23133. +
  23134. + /* Skip symbols which were equated to undefined or common
  23135. symbols. */
  23136. - if (symbol_equated_p (symp)
  23137. - && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
  23138. - {
  23139. - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23140. - continue;
  23141. - }
  23142. -
  23143. - /* So far, common symbols have been treated like undefined symbols.
  23144. - Put them in the common section now. */
  23145. - if (S_IS_DEFINED (symp) == 0
  23146. - && S_GET_VALUE (symp) != 0)
  23147. - S_SET_SEGMENT (symp, bfd_com_section_ptr);
  23148. + if (symbol_equated_p (symp)
  23149. + && (! S_IS_DEFINED (symp) || S_IS_COMMON (symp)))
  23150. + {
  23151. + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23152. + continue;
  23153. + }
  23154. +
  23155. + /* So far, common symbols have been treated like undefined symbols.
  23156. + Put them in the common section now. */
  23157. + if (S_IS_DEFINED (symp) == 0
  23158. + && S_GET_VALUE (symp) != 0)
  23159. + S_SET_SEGMENT (symp, bfd_com_section_ptr);
  23160. #if 0
  23161. - printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
  23162. - S_GET_NAME (symp), symp,
  23163. - S_GET_VALUE (symp),
  23164. - symbol_get_bfdsym (symp)->flags,
  23165. - segment_name (S_GET_SEGMENT (symp)));
  23166. + printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
  23167. + S_GET_NAME (symp), symp,
  23168. + S_GET_VALUE (symp),
  23169. + symbol_get_bfdsym (symp)->flags,
  23170. + segment_name (S_GET_SEGMENT (symp)));
  23171. #endif
  23172. #ifdef obj_frob_symbol
  23173. - obj_frob_symbol (symp, punt);
  23174. + obj_frob_symbol (symp, punt);
  23175. #endif
  23176. #ifdef tc_frob_symbol
  23177. - if (! punt || symbol_used_in_reloc_p (symp))
  23178. - tc_frob_symbol (symp, punt);
  23179. -#endif
  23180. -
  23181. - /* If we don't want to keep this symbol, splice it out of
  23182. - the chain now. If EMIT_SECTION_SYMBOLS is 0, we never
  23183. - want section symbols. Otherwise, we skip local symbols
  23184. - and symbols that the frob_symbol macros told us to punt,
  23185. - but we keep such symbols if they are used in relocs. */
  23186. - if ((! EMIT_SECTION_SYMBOLS
  23187. - && symbol_section_p (symp))
  23188. - /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
  23189. - opposites. Sometimes the former checks flags and the
  23190. - latter examines the name... */
  23191. - || (!S_IS_EXTERN (symp)
  23192. - && (S_IS_LOCAL (symp) || punt)
  23193. - && ! symbol_used_in_reloc_p (symp)))
  23194. - {
  23195. - symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23196. - /* After symbol_remove, symbol_next(symp) still returns
  23197. - the one that came after it in the chain. So we don't
  23198. - need to do any extra cleanup work here. */
  23199. -
  23200. - continue;
  23201. - }
  23202. -
  23203. - /* Make sure we really got a value for the symbol. */
  23204. - if (! symbol_resolved_p (symp))
  23205. - {
  23206. - as_bad (_("can't resolve value for symbol \"%s\""),
  23207. - S_GET_NAME (symp));
  23208. - symbol_mark_resolved (symp);
  23209. - }
  23210. -
  23211. - /* Set the value into the BFD symbol. Up til now the value
  23212. - has only been kept in the gas symbolS struct. */
  23213. - symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
  23214. - }
  23215. + if (! punt || symbol_used_in_reloc_p (symp))
  23216. + tc_frob_symbol (symp, punt);
  23217. +#endif
  23218. +
  23219. + /* If we don't want to keep this symbol, splice it out of
  23220. + the chain now. If EMIT_SECTION_SYMBOLS is 0, we never
  23221. + want section symbols. Otherwise, we skip local symbols
  23222. + and symbols that the frob_symbol macros told us to punt,
  23223. + but we keep such symbols if they are used in relocs. */
  23224. + if ((! EMIT_SECTION_SYMBOLS
  23225. + && symbol_section_p (symp))
  23226. + /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
  23227. + opposites. Sometimes the former checks flags and the
  23228. + latter examines the name... */
  23229. + || (!S_IS_EXTERN (symp)
  23230. + && (S_IS_LOCAL (symp) || punt)
  23231. + && ! symbol_used_in_reloc_p (symp)))
  23232. + {
  23233. + symbol_remove (symp, &symbol_rootP, &symbol_lastP);
  23234. + /* After symbol_remove, symbol_next(symp) still returns
  23235. + the one that came after it in the chain. So we don't
  23236. + need to do any extra cleanup work here. */
  23237. +
  23238. + continue;
  23239. + }
  23240. +
  23241. + /* Make sure we really got a value for the symbol. */
  23242. + if (! symbol_resolved_p (symp))
  23243. + {
  23244. + as_bad (_("can't resolve value for symbol \"%s\""),
  23245. + S_GET_NAME (symp));
  23246. + symbol_mark_resolved (symp);
  23247. + }
  23248. +
  23249. + /* Set the value into the BFD symbol. Up til now the value
  23250. + has only been kept in the gas symbolS struct. */
  23251. + symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
  23252. + }
  23253. }
  23254. PROGRESS (1);
  23255. @@ -1930,7 +1939,7 @@ write_object_file ()
  23256. #endif /* ! BFD */
  23257. /*
  23258. - * relax_segment()
  23259. + * relax_segment()
  23260. *
  23261. * Now we have a segment, not a crowd of sub-segments, we can make fr_address
  23262. * values.
  23263. @@ -1986,30 +1995,30 @@ relax_frag (fragP, stretch)
  23264. #ifndef DIFF_EXPR_OK
  23265. #if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
  23266. know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
  23267. - || (S_GET_SEGMENT (symbolP) == SEG_DATA)
  23268. - || (S_GET_SEGMENT (symbolP) == SEG_BSS)
  23269. - || (S_GET_SEGMENT (symbolP) == SEG_TEXT));
  23270. + || (S_GET_SEGMENT (symbolP) == SEG_DATA)
  23271. + || (S_GET_SEGMENT (symbolP) == SEG_BSS)
  23272. + || (S_GET_SEGMENT (symbolP) == SEG_TEXT));
  23273. #endif
  23274. know (symbolP->sy_frag);
  23275. #endif
  23276. know (!(S_GET_SEGMENT (symbolP) == absolute_section)
  23277. - || symbolP->sy_frag == &zero_address_frag);
  23278. - target += S_GET_VALUE (symbolP) + symbol_get_frag (symbolP)->fr_address;
  23279. + || symbolP->sy_frag == &zero_address_frag);
  23280. + target += S_GET_VALUE (symbolP) + symbol_get_frag (symbolP)->fr_address;
  23281. /* If frag has yet to be reached on this pass,
  23282. - assume it will move by STRETCH just as we did.
  23283. - If this is not so, it will be because some frag
  23284. - between grows, and that will force another pass.
  23285. + assume it will move by STRETCH just as we did.
  23286. + If this is not so, it will be because some frag
  23287. + between grows, and that will force another pass.
  23288. - Beware zero-length frags.
  23289. + Beware zero-length frags.
  23290. - There should be a faster way to do this. */
  23291. + There should be a faster way to do this. */
  23292. if (symbol_get_frag (symbolP)->fr_address >= was_address
  23293. - && is_dnrange (fragP, symbol_get_frag (symbolP)))
  23294. - {
  23295. - target += stretch;
  23296. - }
  23297. + && is_dnrange (fragP, symbol_get_frag (symbolP)))
  23298. + {
  23299. + target += stretch;
  23300. + }
  23301. }
  23302. aim = target - address - fragP->fr_fix;
  23303. @@ -2029,29 +2038,29 @@ relax_frag (fragP, stretch)
  23304. {
  23305. /* Look backwards. */
  23306. for (next_state = this_type->rlx_more; next_state;)
  23307. - if (aim >= this_type->rlx_backward)
  23308. - next_state = 0;
  23309. - else
  23310. - {
  23311. - /* Grow to next state. */
  23312. - this_state = next_state;
  23313. - this_type = table + this_state;
  23314. - next_state = this_type->rlx_more;
  23315. - }
  23316. + if (aim >= this_type->rlx_backward)
  23317. + next_state = 0;
  23318. + else
  23319. + {
  23320. + /* Grow to next state. */
  23321. + this_state = next_state;
  23322. + this_type = table + this_state;
  23323. + next_state = this_type->rlx_more;
  23324. + }
  23325. }
  23326. else
  23327. {
  23328. /* Look forwards. */
  23329. for (next_state = this_type->rlx_more; next_state;)
  23330. - if (aim <= this_type->rlx_forward)
  23331. - next_state = 0;
  23332. - else
  23333. - {
  23334. - /* Grow to next state. */
  23335. - this_state = next_state;
  23336. - this_type = table + this_state;
  23337. - next_state = this_type->rlx_more;
  23338. - }
  23339. + if (aim <= this_type->rlx_forward)
  23340. + next_state = 0;
  23341. + else
  23342. + {
  23343. + /* Grow to next state. */
  23344. + this_state = next_state;
  23345. + this_type = table + this_state;
  23346. + next_state = this_type->rlx_more;
  23347. + }
  23348. }
  23349. growth = this_type->rlx_length - start_type->rlx_length;
  23350. @@ -2066,8 +2075,8 @@ relax_frag (fragP, stretch)
  23351. lowest order bits all 0s, return size of adjustment made. */
  23352. static relax_addressT
  23353. relax_align (address, alignment)
  23354. - register relax_addressT address; /* Address now. */
  23355. - register int alignment; /* Alignment (binary). */
  23356. + register relax_addressT address; /* Address now. */
  23357. + register int alignment; /* Alignment (binary). */
  23358. {
  23359. relax_addressT mask;
  23360. relax_addressT new_address;
  23361. @@ -2105,283 +2114,283 @@ relax_segment (segment_frag_root, segment)
  23362. address += fragP->fr_fix;
  23363. switch (fragP->fr_type)
  23364. - {
  23365. - case rs_fill:
  23366. - address += fragP->fr_offset * fragP->fr_var;
  23367. - break;
  23368. -
  23369. - case rs_align:
  23370. - case rs_align_code:
  23371. - {
  23372. - addressT offset = relax_align (address, (int) fragP->fr_offset);
  23373. -
  23374. - if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype)
  23375. - offset = 0;
  23376. -
  23377. - if (offset % fragP->fr_var != 0)
  23378. - {
  23379. - as_bad (_("alignment padding (%lu bytes) not a multiple of %ld"),
  23380. - (unsigned long) offset, (long) fragP->fr_var);
  23381. - offset -= (offset % fragP->fr_var);
  23382. - }
  23383. -
  23384. - address += offset;
  23385. - }
  23386. - break;
  23387. -
  23388. - case rs_org:
  23389. - case rs_space:
  23390. - /* Assume .org is nugatory. It will grow with 1st relax. */
  23391. - break;
  23392. -
  23393. - case rs_machine_dependent:
  23394. - address += md_estimate_size_before_relax (fragP, segment);
  23395. - break;
  23396. + {
  23397. + case rs_fill:
  23398. + address += fragP->fr_offset * fragP->fr_var;
  23399. + break;
  23400. +
  23401. + case rs_align:
  23402. + case rs_align_code:
  23403. + {
  23404. + addressT offset = relax_align (address, (int) fragP->fr_offset);
  23405. +
  23406. + if (fragP->fr_subtype != 0 && offset > fragP->fr_subtype)
  23407. + offset = 0;
  23408. +
  23409. + if (offset % fragP->fr_var != 0)
  23410. + {
  23411. + as_bad (_("alignment padding (%lu bytes) not a multiple of %ld"),
  23412. + (unsigned long) offset, (long) fragP->fr_var);
  23413. + offset -= (offset % fragP->fr_var);
  23414. + }
  23415. +
  23416. + address += offset;
  23417. + }
  23418. + break;
  23419. +
  23420. + case rs_org:
  23421. + case rs_space:
  23422. + /* Assume .org is nugatory. It will grow with 1st relax. */
  23423. + break;
  23424. +
  23425. + case rs_machine_dependent:
  23426. + address += md_estimate_size_before_relax (fragP, segment);
  23427. + break;
  23428. #ifndef WORKING_DOT_WORD
  23429. - /* Broken words don't concern us yet */
  23430. - case rs_broken_word:
  23431. - break;
  23432. + /* Broken words don't concern us yet */
  23433. + case rs_broken_word:
  23434. + break;
  23435. #endif
  23436. - case rs_leb128:
  23437. - /* Initial guess is always 1; doing otherwise can result in
  23438. - stable solutions that are larger than the minimum. */
  23439. - address += fragP->fr_offset = 1;
  23440. - break;
  23441. + case rs_leb128:
  23442. + /* Initial guess is always 1; doing otherwise can result in
  23443. + stable solutions that are larger than the minimum. */
  23444. + address += fragP->fr_offset = 1;
  23445. + break;
  23446. - case rs_cfa:
  23447. - address += eh_frame_estimate_size_before_relax (fragP);
  23448. - break;
  23449. + case rs_cfa:
  23450. + address += eh_frame_estimate_size_before_relax (fragP);
  23451. + break;
  23452. - default:
  23453. - BAD_CASE (fragP->fr_type);
  23454. - break;
  23455. - } /* switch(fr_type) */
  23456. - } /* for each frag in the segment */
  23457. + default:
  23458. + BAD_CASE (fragP->fr_type);
  23459. + break;
  23460. + } /* switch(fr_type) */
  23461. + } /* for each frag in the segment */
  23462. /* Do relax(). */
  23463. {
  23464. - long stretch; /* May be any size, 0 or negative. */
  23465. + long stretch; /* May be any size, 0 or negative. */
  23466. /* Cumulative number of addresses we have */
  23467. /* relaxed this pass. */
  23468. /* We may have relaxed more than one address. */
  23469. - long stretched; /* Have we stretched on this pass? */
  23470. + long stretched; /* Have we stretched on this pass? */
  23471. /* This is 'cuz stretch may be zero, when, in fact some piece of code
  23472. grew, and another shrank. If a branch instruction doesn't fit anymore,
  23473. we could be scrod. */
  23474. do
  23475. {
  23476. - stretch = stretched = 0;
  23477. - for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
  23478. - {
  23479. - long growth = 0;
  23480. - addressT was_address;
  23481. - offsetT offset;
  23482. - symbolS *symbolP;
  23483. -
  23484. - was_address = fragP->fr_address;
  23485. - address = fragP->fr_address += stretch;
  23486. - symbolP = fragP->fr_symbol;
  23487. - offset = fragP->fr_offset;
  23488. -
  23489. - switch (fragP->fr_type)
  23490. - {
  23491. - case rs_fill: /* .fill never relaxes. */
  23492. - growth = 0;
  23493. - break;
  23494. + stretch = stretched = 0;
  23495. + for (fragP = segment_frag_root; fragP; fragP = fragP->fr_next)
  23496. + {
  23497. + long growth = 0;
  23498. + addressT was_address;
  23499. + offsetT offset;
  23500. + symbolS *symbolP;
  23501. +
  23502. + was_address = fragP->fr_address;
  23503. + address = fragP->fr_address += stretch;
  23504. + symbolP = fragP->fr_symbol;
  23505. + offset = fragP->fr_offset;
  23506. +
  23507. + switch (fragP->fr_type)
  23508. + {
  23509. + case rs_fill: /* .fill never relaxes. */
  23510. + growth = 0;
  23511. + break;
  23512. #ifndef WORKING_DOT_WORD
  23513. - /* JF: This is RMS's idea. I do *NOT* want to be blamed
  23514. - for it I do not want to write it. I do not want to have
  23515. - anything to do with it. This is not the proper way to
  23516. - implement this misfeature. */
  23517. - case rs_broken_word:
  23518. - {
  23519. - struct broken_word *lie;
  23520. - struct broken_word *untruth;
  23521. -
  23522. - /* Yes this is ugly (storing the broken_word pointer
  23523. - in the symbol slot). Still, this whole chunk of
  23524. - code is ugly, and I don't feel like doing anything
  23525. - about it. Think of it as stubbornness in action. */
  23526. - growth = 0;
  23527. - for (lie = (struct broken_word *) (fragP->fr_symbol);
  23528. - lie && lie->dispfrag == fragP;
  23529. - lie = lie->next_broken_word)
  23530. - {
  23531. -
  23532. - if (lie->added)
  23533. - continue;
  23534. -
  23535. - offset = (symbol_get_frag (lie->add)->fr_address
  23536. - + S_GET_VALUE (lie->add)
  23537. - + lie->addnum
  23538. - - (symbol_get_frag (lie->sub)->fr_address
  23539. - + S_GET_VALUE (lie->sub)));
  23540. - if (offset <= -32768 || offset >= 32767)
  23541. - {
  23542. - if (flag_warn_displacement)
  23543. - {
  23544. - char buf[50];
  23545. - sprint_value (buf, (addressT) lie->addnum);
  23546. - as_warn (_(".word %s-%s+%s didn't fit"),
  23547. - S_GET_NAME (lie->add),
  23548. - S_GET_NAME (lie->sub),
  23549. - buf);
  23550. - }
  23551. - lie->added = 1;
  23552. - if (fragP->fr_subtype == 0)
  23553. - {
  23554. - fragP->fr_subtype++;
  23555. - growth += md_short_jump_size;
  23556. - }
  23557. - for (untruth = lie->next_broken_word;
  23558. - untruth && untruth->dispfrag == lie->dispfrag;
  23559. - untruth = untruth->next_broken_word)
  23560. - if ((symbol_get_frag (untruth->add)
  23561. - == symbol_get_frag (lie->add))
  23562. - && (S_GET_VALUE (untruth->add)
  23563. - == S_GET_VALUE (lie->add)))
  23564. - {
  23565. - untruth->added = 2;
  23566. - untruth->use_jump = lie;
  23567. - }
  23568. - growth += md_long_jump_size;
  23569. - }
  23570. - }
  23571. -
  23572. - break;
  23573. - } /* case rs_broken_word */
  23574. -#endif
  23575. - case rs_align:
  23576. - case rs_align_code:
  23577. - {
  23578. - addressT oldoff, newoff;
  23579. -
  23580. - oldoff = relax_align (was_address + fragP->fr_fix,
  23581. - (int) offset);
  23582. - newoff = relax_align (address + fragP->fr_fix,
  23583. - (int) offset);
  23584. -
  23585. - if (fragP->fr_subtype != 0)
  23586. - {
  23587. - if (oldoff > fragP->fr_subtype)
  23588. - oldoff = 0;
  23589. - if (newoff > fragP->fr_subtype)
  23590. - newoff = 0;
  23591. - }
  23592. -
  23593. - growth = newoff - oldoff;
  23594. - }
  23595. - break;
  23596. -
  23597. - case rs_org:
  23598. - {
  23599. - long target = offset;
  23600. - long after;
  23601. -
  23602. - if (symbolP)
  23603. - {
  23604. + /* JF: This is RMS's idea. I do *NOT* want to be blamed
  23605. + for it I do not want to write it. I do not want to have
  23606. + anything to do with it. This is not the proper way to
  23607. + implement this misfeature. */
  23608. + case rs_broken_word:
  23609. + {
  23610. + struct broken_word *lie;
  23611. + struct broken_word *untruth;
  23612. +
  23613. + /* Yes this is ugly (storing the broken_word pointer
  23614. + in the symbol slot). Still, this whole chunk of
  23615. + code is ugly, and I don't feel like doing anything
  23616. + about it. Think of it as stubbornness in action. */
  23617. + growth = 0;
  23618. + for (lie = (struct broken_word *) (fragP->fr_symbol);
  23619. + lie && lie->dispfrag == fragP;
  23620. + lie = lie->next_broken_word)
  23621. + {
  23622. +
  23623. + if (lie->added)
  23624. + continue;
  23625. +
  23626. + offset = (symbol_get_frag (lie->add)->fr_address
  23627. + + S_GET_VALUE (lie->add)
  23628. + + lie->addnum
  23629. + - (symbol_get_frag (lie->sub)->fr_address
  23630. + + S_GET_VALUE (lie->sub)));
  23631. + if (offset <= -32768 || offset >= 32767)
  23632. + {
  23633. + if (flag_warn_displacement)
  23634. + {
  23635. + char buf[50];
  23636. + sprint_value (buf, (addressT) lie->addnum);
  23637. + as_warn (_(".word %s-%s+%s didn't fit"),
  23638. + S_GET_NAME (lie->add),
  23639. + S_GET_NAME (lie->sub),
  23640. + buf);
  23641. + }
  23642. + lie->added = 1;
  23643. + if (fragP->fr_subtype == 0)
  23644. + {
  23645. + fragP->fr_subtype++;
  23646. + growth += md_short_jump_size;
  23647. + }
  23648. + for (untruth = lie->next_broken_word;
  23649. + untruth && untruth->dispfrag == lie->dispfrag;
  23650. + untruth = untruth->next_broken_word)
  23651. + if ((symbol_get_frag (untruth->add)
  23652. + == symbol_get_frag (lie->add))
  23653. + && (S_GET_VALUE (untruth->add)
  23654. + == S_GET_VALUE (lie->add)))
  23655. + {
  23656. + untruth->added = 2;
  23657. + untruth->use_jump = lie;
  23658. + }
  23659. + growth += md_long_jump_size;
  23660. + }
  23661. + }
  23662. +
  23663. + break;
  23664. + } /* case rs_broken_word */
  23665. +#endif
  23666. + case rs_align:
  23667. + case rs_align_code:
  23668. + {
  23669. + addressT oldoff, newoff;
  23670. +
  23671. + oldoff = relax_align (was_address + fragP->fr_fix,
  23672. + (int) offset);
  23673. + newoff = relax_align (address + fragP->fr_fix,
  23674. + (int) offset);
  23675. +
  23676. + if (fragP->fr_subtype != 0)
  23677. + {
  23678. + if (oldoff > fragP->fr_subtype)
  23679. + oldoff = 0;
  23680. + if (newoff > fragP->fr_subtype)
  23681. + newoff = 0;
  23682. + }
  23683. +
  23684. + growth = newoff - oldoff;
  23685. + }
  23686. + break;
  23687. +
  23688. + case rs_org:
  23689. + {
  23690. + long target = offset;
  23691. + long after;
  23692. +
  23693. + if (symbolP)
  23694. + {
  23695. #if !defined (MANY_SEGMENTS) && !defined (BFD_ASSEMBLER)
  23696. - know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
  23697. - || (S_GET_SEGMENT (symbolP) == SEG_DATA)
  23698. - || (S_GET_SEGMENT (symbolP) == SEG_TEXT)
  23699. - || S_GET_SEGMENT (symbolP) == SEG_BSS);
  23700. - know (symbolP->sy_frag);
  23701. - know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
  23702. - || (symbolP->sy_frag == &zero_address_frag));
  23703. -#endif
  23704. - target += (S_GET_VALUE (symbolP)
  23705. - + symbol_get_frag (symbolP)->fr_address);
  23706. - } /* if we have a symbol */
  23707. -
  23708. - know (fragP->fr_next);
  23709. - after = fragP->fr_next->fr_address;
  23710. - growth = target - after;
  23711. - if (growth < 0)
  23712. - {
  23713. - /* Growth may be negative, but variable part of frag
  23714. - cannot have fewer than 0 chars. That is, we can't
  23715. - .org backwards. */
  23716. - as_bad_where (fragP->fr_file, fragP->fr_line,
  23717. - _("attempt to .org backwards ignored"));
  23718. -
  23719. - /* We've issued an error message. Change the
  23720. + know ((S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
  23721. + || (S_GET_SEGMENT (symbolP) == SEG_DATA)
  23722. + || (S_GET_SEGMENT (symbolP) == SEG_TEXT)
  23723. + || S_GET_SEGMENT (symbolP) == SEG_BSS);
  23724. + know (symbolP->sy_frag);
  23725. + know (!(S_GET_SEGMENT (symbolP) == SEG_ABSOLUTE)
  23726. + || (symbolP->sy_frag == &zero_address_frag));
  23727. +#endif
  23728. + target += (S_GET_VALUE (symbolP)
  23729. + + symbol_get_frag (symbolP)->fr_address);
  23730. + } /* if we have a symbol */
  23731. +
  23732. + know (fragP->fr_next);
  23733. + after = fragP->fr_next->fr_address;
  23734. + growth = target - after;
  23735. + if (growth < 0)
  23736. + {
  23737. + /* Growth may be negative, but variable part of frag
  23738. + cannot have fewer than 0 chars. That is, we can't
  23739. + .org backwards. */
  23740. + as_bad_where (fragP->fr_file, fragP->fr_line,
  23741. + _("attempt to .org backwards ignored"));
  23742. +
  23743. + /* We've issued an error message. Change the
  23744. frag to avoid cascading errors. */
  23745. - fragP->fr_type = rs_align;
  23746. - fragP->fr_subtype = 0;
  23747. - fragP->fr_offset = 0;
  23748. - fragP->fr_fix = after - address;
  23749. - growth = stretch;
  23750. - }
  23751. -
  23752. - growth -= stretch; /* This is an absolute growth factor */
  23753. - break;
  23754. - }
  23755. -
  23756. - case rs_space:
  23757. - if (symbolP)
  23758. - {
  23759. - growth = S_GET_VALUE (symbolP);
  23760. - if (symbol_get_frag (symbolP) != &zero_address_frag
  23761. - || S_IS_COMMON (symbolP)
  23762. - || ! S_IS_DEFINED (symbolP))
  23763. - as_bad_where (fragP->fr_file, fragP->fr_line,
  23764. - _(".space specifies non-absolute value"));
  23765. - fragP->fr_symbol = 0;
  23766. - if (growth < 0)
  23767. - {
  23768. - as_warn (_(".space or .fill with negative value, ignored"));
  23769. - growth = 0;
  23770. - }
  23771. - }
  23772. - else
  23773. - growth = 0;
  23774. - break;
  23775. -
  23776. - case rs_machine_dependent:
  23777. + fragP->fr_type = rs_align;
  23778. + fragP->fr_subtype = 0;
  23779. + fragP->fr_offset = 0;
  23780. + fragP->fr_fix = after - address;
  23781. + growth = stretch;
  23782. + }
  23783. +
  23784. + growth -= stretch; /* This is an absolute growth factor */
  23785. + break;
  23786. + }
  23787. +
  23788. + case rs_space:
  23789. + if (symbolP)
  23790. + {
  23791. + growth = S_GET_VALUE (symbolP);
  23792. + if (symbol_get_frag (symbolP) != &zero_address_frag
  23793. + || S_IS_COMMON (symbolP)
  23794. + || ! S_IS_DEFINED (symbolP))
  23795. + as_bad_where (fragP->fr_file, fragP->fr_line,
  23796. + _(".space specifies non-absolute value"));
  23797. + fragP->fr_symbol = 0;
  23798. + if (growth < 0)
  23799. + {
  23800. + as_warn (_(".space or .fill with negative value, ignored"));
  23801. + growth = 0;
  23802. + }
  23803. + }
  23804. + else
  23805. + growth = 0;
  23806. + break;
  23807. +
  23808. + case rs_machine_dependent:
  23809. #ifdef md_relax_frag
  23810. - growth = md_relax_frag (fragP, stretch);
  23811. + growth = md_relax_frag (fragP, stretch);
  23812. #else
  23813. #ifdef TC_GENERIC_RELAX_TABLE
  23814. - /* The default way to relax a frag is to look through
  23815. - TC_GENERIC_RELAX_TABLE. */
  23816. - growth = relax_frag (fragP, stretch);
  23817. + /* The default way to relax a frag is to look through
  23818. + TC_GENERIC_RELAX_TABLE. */
  23819. + growth = relax_frag (fragP, stretch);
  23820. #endif /* TC_GENERIC_RELAX_TABLE */
  23821. #endif
  23822. - break;
  23823. -
  23824. - case rs_leb128:
  23825. - {
  23826. - valueT value;
  23827. - int size;
  23828. -
  23829. - value = resolve_symbol_value (fragP->fr_symbol, 0);
  23830. - size = sizeof_leb128 (value, fragP->fr_subtype);
  23831. - growth = size - fragP->fr_offset;
  23832. - fragP->fr_offset = size;
  23833. - }
  23834. - break;
  23835. -
  23836. - case rs_cfa:
  23837. - growth = eh_frame_relax_frag (fragP);
  23838. - break;
  23839. -
  23840. - default:
  23841. - BAD_CASE (fragP->fr_type);
  23842. - break;
  23843. - }
  23844. - if (growth)
  23845. - {
  23846. - stretch += growth;
  23847. - stretched++;
  23848. - }
  23849. - } /* For each frag in the segment. */
  23850. + break;
  23851. +
  23852. + case rs_leb128:
  23853. + {
  23854. + valueT value;
  23855. + int size;
  23856. +
  23857. + value = resolve_symbol_value (fragP->fr_symbol, 0);
  23858. + size = sizeof_leb128 (value, fragP->fr_subtype);
  23859. + growth = size - fragP->fr_offset;
  23860. + fragP->fr_offset = size;
  23861. + }
  23862. + break;
  23863. +
  23864. + case rs_cfa:
  23865. + growth = eh_frame_relax_frag (fragP);
  23866. + break;
  23867. +
  23868. + default:
  23869. + BAD_CASE (fragP->fr_type);
  23870. + break;
  23871. + }
  23872. + if (growth)
  23873. + {
  23874. + stretch += growth;
  23875. + stretched++;
  23876. + }
  23877. + } /* For each frag in the segment. */
  23878. }
  23879. - while (stretched); /* Until nothing further to relax. */
  23880. - } /* do_relax */
  23881. + while (stretched); /* Until nothing further to relax. */
  23882. + } /* do_relax */
  23883. /*
  23884. * We now have valid fr_address'es for each frag.
  23885. @@ -2391,7 +2400,7 @@ relax_segment (segment_frag_root, segment)
  23886. * All fr_address's are correct, relative to their own segment.
  23887. * We have made all the fixS we will ever make.
  23888. */
  23889. -} /* relax_segment() */
  23890. +} /* relax_segment() */
  23891. #if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
  23892. @@ -2413,7 +2422,7 @@ relax_segment (segment_frag_root, segment)
  23893. static long
  23894. fixup_segment (fixP, this_segment_type)
  23895. register fixS *fixP;
  23896. - segT this_segment_type; /* N_TYPE bits for segment. */
  23897. + segT this_segment_type; /* N_TYPE bits for segment. */
  23898. {
  23899. long seg_reloc_count = 0;
  23900. symbolS *add_symbolP;
  23901. @@ -2436,7 +2445,7 @@ fixup_segment (fixP, this_segment_type)
  23902. if (linkrelax)
  23903. {
  23904. for (; fixP; fixP = fixP->fx_next)
  23905. - seg_reloc_count++;
  23906. + seg_reloc_count++;
  23907. TC_ADJUST_RELOC_COUNT (fixP, seg_reloc_count);
  23908. return seg_reloc_count;
  23909. }
  23910. @@ -2465,307 +2474,307 @@ fixup_segment (fixP, this_segment_type)
  23911. plt = fixP->fx_plt;
  23912. if (add_symbolP != NULL
  23913. - && symbol_mri_common_p (add_symbolP))
  23914. - {
  23915. - know (add_symbolP->sy_value.X_op == O_symbol);
  23916. - add_number += S_GET_VALUE (add_symbolP);
  23917. - fixP->fx_offset = add_number;
  23918. - add_symbolP = fixP->fx_addsy =
  23919. - symbol_get_value_expression (add_symbolP)->X_add_symbol;
  23920. - }
  23921. + && symbol_mri_common_p (add_symbolP))
  23922. + {
  23923. + know (add_symbolP->sy_value.X_op == O_symbol);
  23924. + add_number += S_GET_VALUE (add_symbolP);
  23925. + fixP->fx_offset = add_number;
  23926. + add_symbolP = fixP->fx_addsy =
  23927. + symbol_get_value_expression (add_symbolP)->X_add_symbol;
  23928. + }
  23929. if (add_symbolP)
  23930. - add_symbol_segment = S_GET_SEGMENT (add_symbolP);
  23931. + add_symbol_segment = S_GET_SEGMENT (add_symbolP);
  23932. if (sub_symbolP)
  23933. - {
  23934. - resolve_symbol_value (sub_symbolP, 1);
  23935. - if (add_symbolP == NULL || add_symbol_segment == absolute_section)
  23936. - {
  23937. - if (add_symbolP != NULL)
  23938. - {
  23939. - add_number += S_GET_VALUE (add_symbolP);
  23940. - add_symbolP = NULL;
  23941. - fixP->fx_addsy = NULL;
  23942. - }
  23943. -
  23944. - /* It's just -sym */
  23945. - if (S_GET_SEGMENT (sub_symbolP) == absolute_section)
  23946. - {
  23947. - add_number -= S_GET_VALUE (sub_symbolP);
  23948. - fixP->fx_subsy = NULL;
  23949. - }
  23950. - else if (pcrel
  23951. - && S_GET_SEGMENT (sub_symbolP) == this_segment_type)
  23952. - {
  23953. - /* Should try converting to a constant. */
  23954. - goto bad_sub_reloc;
  23955. - }
  23956. - else
  23957. - bad_sub_reloc:
  23958. - as_bad_where (fixP->fx_file, fixP->fx_line,
  23959. - _("Negative of non-absolute symbol %s"),
  23960. - S_GET_NAME (sub_symbolP));
  23961. - }
  23962. - else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment
  23963. - && SEG_NORMAL (add_symbol_segment))
  23964. - {
  23965. - /* Difference of 2 symbols from same segment.
  23966. - Can't make difference of 2 undefineds: 'value' means
  23967. - something different for N_UNDF. */
  23968. + {
  23969. + resolve_symbol_value (sub_symbolP, 1);
  23970. + if (add_symbolP == NULL || add_symbol_segment == absolute_section)
  23971. + {
  23972. + if (add_symbolP != NULL)
  23973. + {
  23974. + add_number += S_GET_VALUE (add_symbolP);
  23975. + add_symbolP = NULL;
  23976. + fixP->fx_addsy = NULL;
  23977. + }
  23978. +
  23979. + /* It's just -sym */
  23980. + if (S_GET_SEGMENT (sub_symbolP) == absolute_section)
  23981. + {
  23982. + add_number -= S_GET_VALUE (sub_symbolP);
  23983. + fixP->fx_subsy = NULL;
  23984. + }
  23985. + else if (pcrel
  23986. + && S_GET_SEGMENT (sub_symbolP) == this_segment_type)
  23987. + {
  23988. + /* Should try converting to a constant. */
  23989. + goto bad_sub_reloc;
  23990. + }
  23991. + else
  23992. + bad_sub_reloc:
  23993. + as_bad_where (fixP->fx_file, fixP->fx_line,
  23994. + _("Negative of non-absolute symbol %s"),
  23995. + S_GET_NAME (sub_symbolP));
  23996. + }
  23997. + else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment
  23998. + && SEG_NORMAL (add_symbol_segment))
  23999. + {
  24000. + /* Difference of 2 symbols from same segment.
  24001. + Can't make difference of 2 undefineds: 'value' means
  24002. + something different for N_UNDF. */
  24003. #ifdef TC_I960
  24004. - /* Makes no sense to use the difference of 2 arbitrary symbols
  24005. - as the target of a call instruction. */
  24006. - if (fixP->fx_tcbit)
  24007. - as_bad_where (fixP->fx_file, fixP->fx_line,
  24008. - _("callj to difference of 2 symbols"));
  24009. + /* Makes no sense to use the difference of 2 arbitrary symbols
  24010. + as the target of a call instruction. */
  24011. + if (fixP->fx_tcbit)
  24012. + as_bad_where (fixP->fx_file, fixP->fx_line,
  24013. + _("callj to difference of 2 symbols"));
  24014. #endif /* TC_I960 */
  24015. - add_number += S_GET_VALUE (add_symbolP) -
  24016. - S_GET_VALUE (sub_symbolP);
  24017. -
  24018. - add_symbolP = NULL;
  24019. - pcrel = 0; /* No further pcrel processing. */
  24020. -
  24021. - /* Let the target machine make the final determination
  24022. - as to whether or not a relocation will be needed to
  24023. - handle this fixup. */
  24024. - if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
  24025. - {
  24026. - fixP->fx_pcrel = 0;
  24027. - fixP->fx_addsy = NULL;
  24028. - fixP->fx_subsy = NULL;
  24029. - }
  24030. - }
  24031. - else
  24032. - {
  24033. - /* Different segments in subtraction. */
  24034. - know (!(S_IS_EXTERNAL (sub_symbolP)
  24035. - && (S_GET_SEGMENT (sub_symbolP) == absolute_section)));
  24036. -
  24037. - if ((S_GET_SEGMENT (sub_symbolP) == absolute_section))
  24038. - add_number -= S_GET_VALUE (sub_symbolP);
  24039. + add_number += S_GET_VALUE (add_symbolP) -
  24040. + S_GET_VALUE (sub_symbolP);
  24041. +
  24042. + add_symbolP = NULL;
  24043. + pcrel = 0; /* No further pcrel processing. */
  24044. +
  24045. + /* Let the target machine make the final determination
  24046. + as to whether or not a relocation will be needed to
  24047. + handle this fixup. */
  24048. + if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
  24049. + {
  24050. + fixP->fx_pcrel = 0;
  24051. + fixP->fx_addsy = NULL;
  24052. + fixP->fx_subsy = NULL;
  24053. + }
  24054. + }
  24055. + else
  24056. + {
  24057. + /* Different segments in subtraction. */
  24058. + know (!(S_IS_EXTERNAL (sub_symbolP)
  24059. + && (S_GET_SEGMENT (sub_symbolP) == absolute_section)));
  24060. +
  24061. + if ((S_GET_SEGMENT (sub_symbolP) == absolute_section))
  24062. + add_number -= S_GET_VALUE (sub_symbolP);
  24063. #ifdef DIFF_EXPR_OK
  24064. - else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type
  24065. + else if (S_GET_SEGMENT (sub_symbolP) == this_segment_type
  24066. #if 0 /* Do this even if it's already described as pc-relative. For example,
  24067. - on the m68k, an operand of "pc@(foo-.-2)" should address "foo" in a
  24068. - pc-relative mode. */
  24069. - && pcrel
  24070. -#endif
  24071. - )
  24072. - {
  24073. - /* Make it pc-relative. */
  24074. - add_number += (MD_PCREL_FROM_SECTION (fixP, this_segment_type)
  24075. - - S_GET_VALUE (sub_symbolP));
  24076. - pcrel = 1;
  24077. - fixP->fx_pcrel = 1;
  24078. - sub_symbolP = 0;
  24079. - fixP->fx_subsy = 0;
  24080. - }
  24081. + on the m68k, an operand of "pc@(foo-.-2)" should address "foo" in a
  24082. + pc-relative mode. */
  24083. + && pcrel
  24084. +#endif
  24085. + )
  24086. + {
  24087. + /* Make it pc-relative. */
  24088. + add_number += (MD_PCREL_FROM_SECTION (fixP, this_segment_type)
  24089. + - S_GET_VALUE (sub_symbolP));
  24090. + pcrel = 1;
  24091. + fixP->fx_pcrel = 1;
  24092. + sub_symbolP = 0;
  24093. + fixP->fx_subsy = 0;
  24094. + }
  24095. #endif
  24096. #ifdef UNDEFINED_DIFFERENCE_OK
  24097. - /* The PA needs this for PIC code generation. We basically
  24098. - don't want to do anything if we have the difference of two
  24099. - symbols at this point. */
  24100. - else if (1)
  24101. - {
  24102. - /* Leave it alone. */
  24103. - }
  24104. + /* The PA needs this for PIC code generation. We basically
  24105. + don't want to do anything if we have the difference of two
  24106. + symbols at this point. */
  24107. + else if (1)
  24108. + {
  24109. + /* Leave it alone. */
  24110. + }
  24111. #endif
  24112. #ifdef BFD_ASSEMBLER
  24113. - else if (fixP->fx_r_type == BFD_RELOC_GPREL32
  24114. - || fixP->fx_r_type == BFD_RELOC_GPREL16)
  24115. - {
  24116. - /* Leave it alone. */
  24117. - }
  24118. -#endif
  24119. - else
  24120. - {
  24121. - char buf[50];
  24122. - sprint_value (buf, fragP->fr_address + where);
  24123. - as_bad_where (fixP->fx_file, fixP->fx_line,
  24124. - _("Subtraction of two symbols in different sections \"%s\" {%s section} - \"%s\" {%s section} at file address %s."),
  24125. - S_GET_NAME (add_symbolP),
  24126. - segment_name (S_GET_SEGMENT (add_symbolP)),
  24127. - S_GET_NAME (sub_symbolP),
  24128. - segment_name (S_GET_SEGMENT (sub_symbolP)),
  24129. - buf);
  24130. - }
  24131. - }
  24132. - }
  24133. + else if (fixP->fx_r_type == BFD_RELOC_GPREL32
  24134. + || fixP->fx_r_type == BFD_RELOC_GPREL16)
  24135. + {
  24136. + /* Leave it alone. */
  24137. + }
  24138. +#endif
  24139. + else
  24140. + {
  24141. + char buf[50];
  24142. + sprint_value (buf, fragP->fr_address + where);
  24143. + as_bad_where (fixP->fx_file, fixP->fx_line,
  24144. + _("Subtraction of two symbols in different sections \"%s\" {%s section} - \"%s\" {%s section} at file address %s."),
  24145. + S_GET_NAME (add_symbolP),
  24146. + segment_name (S_GET_SEGMENT (add_symbolP)),
  24147. + S_GET_NAME (sub_symbolP),
  24148. + segment_name (S_GET_SEGMENT (sub_symbolP)),
  24149. + buf);
  24150. + }
  24151. + }
  24152. + }
  24153. if (add_symbolP)
  24154. - {
  24155. - if (add_symbol_segment == this_segment_type && pcrel && !plt
  24156. - && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
  24157. - {
  24158. - /*
  24159. - * This fixup was made when the symbol's segment was
  24160. - * SEG_UNKNOWN, but it is now in the local segment.
  24161. - * So we know how to do the address without relocation.
  24162. - */
  24163. + {
  24164. + if (add_symbol_segment == this_segment_type && pcrel && !plt
  24165. + && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
  24166. + {
  24167. + /*
  24168. + * This fixup was made when the symbol's segment was
  24169. + * SEG_UNKNOWN, but it is now in the local segment.
  24170. + * So we know how to do the address without relocation.
  24171. + */
  24172. #ifdef TC_I960
  24173. - /* reloc_callj() may replace a 'call' with a 'calls' or a
  24174. - 'bal', in which cases it modifies *fixP as appropriate.
  24175. - In the case of a 'calls', no further work is required,
  24176. - and *fixP has been set up to make the rest of the code
  24177. - below a no-op. */
  24178. - reloc_callj (fixP);
  24179. + /* reloc_callj() may replace a 'call' with a 'calls' or a
  24180. + 'bal', in which cases it modifies *fixP as appropriate.
  24181. + In the case of a 'calls', no further work is required,
  24182. + and *fixP has been set up to make the rest of the code
  24183. + below a no-op. */
  24184. + reloc_callj (fixP);
  24185. #endif /* TC_I960 */
  24186. - add_number += S_GET_VALUE (add_symbolP);
  24187. - add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
  24188. - pcrel = 0; /* Lie. Don't want further pcrel processing. */
  24189. -
  24190. - /* Let the target machine make the final determination
  24191. - as to whether or not a relocation will be needed to
  24192. - handle this fixup. */
  24193. - if (!TC_FORCE_RELOCATION (fixP))
  24194. - {
  24195. - fixP->fx_pcrel = 0;
  24196. - fixP->fx_addsy = NULL;
  24197. - }
  24198. - }
  24199. - else
  24200. - {
  24201. - if (add_symbol_segment == absolute_section
  24202. - && ! pcrel)
  24203. - {
  24204. + add_number += S_GET_VALUE (add_symbolP);
  24205. + add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
  24206. + pcrel = 0; /* Lie. Don't want further pcrel processing. */
  24207. +
  24208. + /* Let the target machine make the final determination
  24209. + as to whether or not a relocation will be needed to
  24210. + handle this fixup. */
  24211. + if (!TC_FORCE_RELOCATION (fixP))
  24212. + {
  24213. + fixP->fx_pcrel = 0;
  24214. + fixP->fx_addsy = NULL;
  24215. + }
  24216. + }
  24217. + else
  24218. + {
  24219. + if (add_symbol_segment == absolute_section
  24220. + && ! pcrel)
  24221. + {
  24222. #ifdef TC_I960
  24223. - /* See comment about reloc_callj() above. */
  24224. - reloc_callj (fixP);
  24225. + /* See comment about reloc_callj() above. */
  24226. + reloc_callj (fixP);
  24227. #endif /* TC_I960 */
  24228. - add_number += S_GET_VALUE (add_symbolP);
  24229. -
  24230. - /* Let the target machine make the final determination
  24231. - as to whether or not a relocation will be needed to
  24232. - handle this fixup. */
  24233. -
  24234. - if (!TC_FORCE_RELOCATION (fixP))
  24235. - {
  24236. - fixP->fx_addsy = NULL;
  24237. - add_symbolP = NULL;
  24238. - }
  24239. - }
  24240. - else if (add_symbol_segment == undefined_section
  24241. + add_number += S_GET_VALUE (add_symbolP);
  24242. +
  24243. + /* Let the target machine make the final determination
  24244. + as to whether or not a relocation will be needed to
  24245. + handle this fixup. */
  24246. +
  24247. + if (!TC_FORCE_RELOCATION (fixP))
  24248. + {
  24249. + fixP->fx_addsy = NULL;
  24250. + add_symbolP = NULL;
  24251. + }
  24252. + }
  24253. + else if (add_symbol_segment == undefined_section
  24254. #ifdef BFD_ASSEMBLER
  24255. - || bfd_is_com_section (add_symbol_segment)
  24256. + || bfd_is_com_section (add_symbol_segment)
  24257. #endif
  24258. - )
  24259. - {
  24260. + )
  24261. + {
  24262. #ifdef TC_I960
  24263. - if ((int) fixP->fx_bit_fixP == 13)
  24264. - {
  24265. - /* This is a COBR instruction. They have only a
  24266. - * 13-bit displacement and are only to be used
  24267. - * for local branches: flag as error, don't generate
  24268. - * relocation.
  24269. - */
  24270. - as_bad_where (fixP->fx_file, fixP->fx_line,
  24271. - _("can't use COBR format with external label"));
  24272. - fixP->fx_addsy = NULL;
  24273. - fixP->fx_done = 1;
  24274. - continue;
  24275. - } /* COBR */
  24276. + if ((int) fixP->fx_bit_fixP == 13)
  24277. + {
  24278. + /* This is a COBR instruction. They have only a
  24279. + * 13-bit displacement and are only to be used
  24280. + * for local branches: flag as error, don't generate
  24281. + * relocation.
  24282. + */
  24283. + as_bad_where (fixP->fx_file, fixP->fx_line,
  24284. + _("can't use COBR format with external label"));
  24285. + fixP->fx_addsy = NULL;
  24286. + fixP->fx_done = 1;
  24287. + continue;
  24288. + } /* COBR */
  24289. #endif /* TC_I960 */
  24290. #ifdef OBJ_COFF
  24291. #ifdef TE_I386AIX
  24292. - if (S_IS_COMMON (add_symbolP))
  24293. - add_number += S_GET_VALUE (add_symbolP);
  24294. + if (S_IS_COMMON (add_symbolP))
  24295. + add_number += S_GET_VALUE (add_symbolP);
  24296. #endif /* TE_I386AIX */
  24297. #endif /* OBJ_COFF */
  24298. - ++seg_reloc_count;
  24299. - }
  24300. - else
  24301. - {
  24302. - seg_reloc_count++;
  24303. + ++seg_reloc_count;
  24304. + }
  24305. + else
  24306. + {
  24307. + seg_reloc_count++;
  24308. #if !(defined (TC_V850) && defined (OBJ_ELF))
  24309. #if !(defined (TC_M68K) && defined (OBJ_ELF))
  24310. #if !(defined (TC_ARM) && defined (OBJ_ELF))
  24311. #if !(defined (TC_I960) && defined (OBJ_ELF))
  24312. #if !defined (TC_I386) || !(defined (OBJ_ELF) || defined (OBJ_COFF)) || defined (TE_PE)
  24313. - add_number += S_GET_VALUE (add_symbolP);
  24314. + add_number += S_GET_VALUE (add_symbolP);
  24315. #endif
  24316. #endif
  24317. #endif
  24318. #endif
  24319. #endif
  24320. - }
  24321. - }
  24322. - }
  24323. + }
  24324. + }
  24325. + }
  24326. if (pcrel)
  24327. - {
  24328. - add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
  24329. - if (add_symbolP == 0)
  24330. - {
  24331. + {
  24332. + add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
  24333. + if (add_symbolP == 0)
  24334. + {
  24335. #ifndef BFD_ASSEMBLER
  24336. - fixP->fx_addsy = &abs_symbol;
  24337. + fixP->fx_addsy = &abs_symbol;
  24338. #else
  24339. - fixP->fx_addsy = section_symbol (absolute_section);
  24340. + fixP->fx_addsy = section_symbol (absolute_section);
  24341. #endif
  24342. - symbol_mark_used_in_reloc (fixP->fx_addsy);
  24343. - ++seg_reloc_count;
  24344. - }
  24345. - }
  24346. + symbol_mark_used_in_reloc (fixP->fx_addsy);
  24347. + ++seg_reloc_count;
  24348. + }
  24349. + }
  24350. if (!fixP->fx_done)
  24351. - {
  24352. + {
  24353. #ifdef MD_APPLY_FIX3
  24354. - md_apply_fix3 (fixP, &add_number, this_segment_type);
  24355. + md_apply_fix3 (fixP, &add_number, this_segment_type);
  24356. #else
  24357. #ifdef BFD_ASSEMBLER
  24358. - md_apply_fix (fixP, &add_number);
  24359. + md_apply_fix (fixP, &add_number);
  24360. #else
  24361. - md_apply_fix (fixP, add_number);
  24362. + md_apply_fix (fixP, add_number);
  24363. #endif
  24364. #endif
  24365. #ifndef TC_HANDLES_FX_DONE
  24366. - /* If the tc-* files haven't been converted, assume it's handling
  24367. - it the old way, where a null fx_addsy means that the fix has
  24368. - been applied completely, and no further work is needed. */
  24369. - if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
  24370. - fixP->fx_done = 1;
  24371. + /* If the tc-* files haven't been converted, assume it's handling
  24372. + it the old way, where a null fx_addsy means that the fix has
  24373. + been applied completely, and no further work is needed. */
  24374. + if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
  24375. + fixP->fx_done = 1;
  24376. #endif
  24377. - }
  24378. + }
  24379. if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
  24380. - {
  24381. - if ((size_t) size < sizeof (valueT))
  24382. - {
  24383. - valueT mask;
  24384. -
  24385. - mask = 0;
  24386. - mask--; /* set all bits to one */
  24387. - mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
  24388. - if ((add_number & mask) != 0 && (add_number & mask) != mask)
  24389. - {
  24390. - char buf[50], buf2[50];
  24391. - sprint_value (buf, fragP->fr_address + where);
  24392. - if (add_number > 1000)
  24393. - sprint_value (buf2, add_number);
  24394. - else
  24395. - sprintf (buf2, "%ld", (long) add_number);
  24396. - as_bad_where (fixP->fx_file, fixP->fx_line,
  24397. - _("Value of %s too large for field of %d bytes at %s"),
  24398. - buf2, size, buf);
  24399. - } /* generic error checking */
  24400. - }
  24401. + {
  24402. + if ((size_t) size < sizeof (valueT))
  24403. + {
  24404. + valueT mask;
  24405. +
  24406. + mask = 0;
  24407. + mask--; /* set all bits to one */
  24408. + mask <<= size * 8 - (fixP->fx_signed ? 1 : 0);
  24409. + if ((add_number & mask) != 0 && (add_number & mask) != mask)
  24410. + {
  24411. + char buf[50], buf2[50];
  24412. + sprint_value (buf, fragP->fr_address + where);
  24413. + if (add_number > 1000)
  24414. + sprint_value (buf2, add_number);
  24415. + else
  24416. + sprintf (buf2, "%ld", (long) add_number);
  24417. + as_bad_where (fixP->fx_file, fixP->fx_line,
  24418. + _("Value of %s too large for field of %d bytes at %s"),
  24419. + buf2, size, buf);
  24420. + } /* generic error checking */
  24421. + }
  24422. #ifdef WARN_SIGNED_OVERFLOW_WORD
  24423. - /* Warn if a .word value is too large when treated as a signed
  24424. - number. We already know it is not too negative. This is to
  24425. - catch over-large switches generated by gcc on the 68k. */
  24426. - if (!flag_signed_overflow_ok
  24427. - && size == 2
  24428. - && add_number > 0x7fff)
  24429. - as_bad_where (fixP->fx_file, fixP->fx_line,
  24430. - _("Signed .word overflow; switch may be too large; %ld at 0x%lx"),
  24431. - (long) add_number,
  24432. - (unsigned long) (fragP->fr_address + where));
  24433. -#endif
  24434. - } /* not a bit fix */
  24435. + /* Warn if a .word value is too large when treated as a signed
  24436. + number. We already know it is not too negative. This is to
  24437. + catch over-large switches generated by gcc on the 68k. */
  24438. + if (!flag_signed_overflow_ok
  24439. + && size == 2
  24440. + && add_number > 0x7fff)
  24441. + as_bad_where (fixP->fx_file, fixP->fx_line,
  24442. + _("Signed .word overflow; switch may be too large; %ld at 0x%lx"),
  24443. + (long) add_number,
  24444. + (unsigned long) (fragP->fr_address + where));
  24445. +#endif
  24446. + } /* not a bit fix */
  24447. #ifdef TC_VALIDATE_FIX
  24448. skip: ATTRIBUTE_UNUSED_LABEL
  24449. @@ -2775,7 +2784,7 @@ fixup_segment (fixP, this_segment_type)
  24450. fprintf (stderr, "result:\n");
  24451. print_fixup (fixP);
  24452. #endif
  24453. - } /* For each fixS in this segment. */
  24454. + } /* For each fixS in this segment. */
  24455. TC_ADJUST_RELOC_COUNT (fixP, seg_reloc_count);
  24456. return seg_reloc_count;
  24457. @@ -2846,11 +2855,11 @@ print_fixup (fixp)
  24458. if (fixp->fx_done)
  24459. fprintf (stderr, " done");
  24460. fprintf (stderr, "\n size=%d frag=%lx where=%ld offset=%lx addnumber=%lx",
  24461. - fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
  24462. - (long) fixp->fx_offset, (long) fixp->fx_addnumber);
  24463. + fixp->fx_size, (long) fixp->fx_frag, (long) fixp->fx_where,
  24464. + (long) fixp->fx_offset, (long) fixp->fx_addnumber);
  24465. #ifdef BFD_ASSEMBLER
  24466. fprintf (stderr, "\n %s (%d)", bfd_get_reloc_code_name (fixp->fx_r_type),
  24467. - fixp->fx_r_type);
  24468. + fixp->fx_r_type);
  24469. #else
  24470. #ifdef NEED_FX_R_TYPE
  24471. fprintf (stderr, " r_type=%d", fixp->fx_r_type);
  24472. diff --git a/include/dis-asm.h b/include/dis-asm.h
  24473. index 6e6c04b..6ca65a7 100644
  24474. --- a/include/dis-asm.h
  24475. +++ b/include/dis-asm.h
  24476. @@ -196,6 +196,10 @@ extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*));
  24477. extern int print_insn_pj PARAMS ((bfd_vma, disassemble_info*));
  24478. extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*));
  24479. +/* 追加 2001.1.15 ide */
  24480. +extern int print_insn_c33 PARAMS ((bfd_vma, disassemble_info*));
  24481. +
  24482. +
  24483. extern void print_arm_disassembler_options PARAMS ((FILE *));
  24484. extern void parse_arm_disassembler_option PARAMS ((char *));
  24485. extern int get_arm_regname_num_options PARAMS ((void));
  24486. diff --git a/include/elf/c33.h b/include/elf/c33.h
  24487. new file mode 100644
  24488. index 0000000..ccb410f
  24489. --- /dev/null
  24490. +++ b/include/elf/c33.h
  24491. @@ -0,0 +1,128 @@
  24492. +/* C33 ELF support for BFD.
  24493. + Copyright (C) 1997,2001 Free Software Foundation, Inc.
  24494. + Created by Michael Meissner, Cygnus Support <meissner@cygnus.com>
  24495. +
  24496. +This file is part of BFD, the Binary File Descriptor library.
  24497. +
  24498. +This program is free software; you can redistribute it and/or modify
  24499. +it under the terms of the GNU General Public License as published by
  24500. +the Free Software Foundation; either version 2 of the License, or
  24501. +(at your option) any later version.
  24502. +
  24503. +This program is distributed in the hope that it will be useful,
  24504. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  24505. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24506. +GNU General Public License for more details.
  24507. +
  24508. +You should have received a copy of the GNU General Public License
  24509. +along with this program; if not, write to the Free Software
  24510. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  24511. +
  24512. +/* This file holds definitions specific to the MIPS ELF ABI. Note
  24513. + that most of this is not actually implemented by BFD. */
  24514. +
  24515. +#ifndef _ELF_C33_H
  24516. +#define _ELF_C33_H
  24517. +
  24518. +/* Processor specific flags for the ELF header e_flags field. */
  24519. +#if 0 /* c33 */
  24520. +/* これらはbinutils\readelf.cで使用している */
  24521. +/* get_machine_flags()でELFヘッダのe_flagsによって、アーキテクチャの文字列を */
  24522. +/* 設定している。c33の場合はどうしたらいいか? */
  24523. +
  24524. +/* Four bit C33 architecture field. */
  24525. +#define EF_V850_ARCH 0xf0000000
  24526. +
  24527. +/* v850 code. */
  24528. +#define E_V850_ARCH 0x00000000
  24529. +
  24530. +/* v850e code. */
  24531. +#define E_V850E_ARCH 0x10000000
  24532. +
  24533. +/* v850ea code. */
  24534. +#define E_V850EA_ARCH 0x20000000
  24535. +#endif /* c33 */
  24536. +
  24537. +
  24538. +/* Flags for the st_other field */
  24539. +#define V850_OTHER_SDA 0x01 /* symbol had SDA relocations */
  24540. +#define V850_OTHER_ZDA 0x02 /* symbol had ZDA relocations */
  24541. +#define V850_OTHER_TDA 0x04 /* symbol had TDA relocations */
  24542. +#define V850_OTHER_TDA_BYTE 0x08 /* symbol had TDA byte relocations */
  24543. +#define V850_OTHER_ERROR 0x80 /* symbol had an error reported */
  24544. +
  24545. +/* C33 relocations */
  24546. +#include "elf/reloc-macros.h"
  24547. +
  24548. +START_RELOC_NUMBERS (c33_reloc_type)
  24549. + RELOC_NUMBER (R_C33_NONE, 0)
  24550. + RELOC_NUMBER (R_C33_32, 1)
  24551. + RELOC_NUMBER (R_C33_16, 2)
  24552. + RELOC_NUMBER (R_C33_8, 3)
  24553. + RELOC_NUMBER (R_C33_AH, 4)
  24554. + RELOC_NUMBER (R_C33_AL, 5)
  24555. + RELOC_NUMBER (R_C33_RH, 6)
  24556. + RELOC_NUMBER (R_C33_RM, 7)
  24557. + RELOC_NUMBER (R_C33_RL, 8)
  24558. + RELOC_NUMBER (R_C33_H, 9)
  24559. + RELOC_NUMBER (R_C33_M, 10)
  24560. + RELOC_NUMBER (R_C33_L, 11)
  24561. + RELOC_NUMBER (R_C33_DH, 12) /* add tazaki 2002.01.11 */
  24562. + RELOC_NUMBER (R_C33_DL, 13) /* add tazaki 2002.01.11 */
  24563. + RELOC_NUMBER (R_C33_GL, 14) /* add tazaki 2002.01.11 */
  24564. + RELOC_NUMBER (R_C33_SH, 15) /* add tazaki 2002.01.11 */
  24565. + RELOC_NUMBER (R_C33_SL, 16) /* add tazaki 2002.01.11 */
  24566. + RELOC_NUMBER (R_C33_TH, 17) /* add tazaki 2002.01.11 */
  24567. + RELOC_NUMBER (R_C33_TL, 18) /* add tazaki 2002.01.11 */
  24568. + RELOC_NUMBER (R_C33_ZH, 19) /* add tazaki 2002.01.11 */
  24569. + RELOC_NUMBER (R_C33_ZL, 20) /* add tazaki 2002.01.11 */
  24570. + RELOC_NUMBER (R_C33_DPH,21) /* add tazaki 2002.01.11 */
  24571. + RELOC_NUMBER (R_C33_DPM,22) /* add tazaki 2002.01.11 */
  24572. + RELOC_NUMBER (R_C33_DPL,23) /* add tazaki 2002.01.11 */
  24573. + RELOC_NUMBER (R_C33_LOOP,24) /* add tazaki 2002.03.05 */
  24574. + RELOC_NUMBER (R_C33_JP, 25) /* add tazaki 2002.04.22 */
  24575. + RELOC_NUMBER (R_C33_S_RH, 26) /* add tazaki 2002.05.02 */
  24576. + RELOC_NUMBER (R_C33_S_RM, 27) /* add tazaki 2002.05.02 */
  24577. + RELOC_NUMBER (R_C33_S_RL, 28) /* add tazaki 2002.05.02 */
  24578. + RELOC_NUMBER (R_C33_PUSHN_R0,29) /* add tazaki 2004/08/19 */
  24579. + RELOC_NUMBER (R_C33_PUSHN_R1,30) /* add tazaki 2004/08/19 */
  24580. + RELOC_NUMBER (R_C33_PUSH_R1,31) /* add tazaki 2004/08/19 */
  24581. +
  24582. + EMPTY_RELOC (R_C33_max)
  24583. +END_RELOC_NUMBERS
  24584. +
  24585. +
  24586. +/* Processor specific section indices. These sections do not actually
  24587. + exist. Symbols with a st_shndx field corresponding to one of these
  24588. + values have a special meaning. */
  24589. +
  24590. +/* Small data area common symbol. */
  24591. +#define SHN_C33_COMM 0xff00
  24592. +#define SHN_C33_GCOMM 0xff01
  24593. +#define SHN_C33_SCOMM 0xff02
  24594. +#define SHN_C33_TCOMM 0xff03
  24595. +#define SHN_C33_ZCOMM 0xff04
  24596. +#define SHN_C33_GBSS 0xff05
  24597. +#define SHN_C33_SBSS 0xff06
  24598. +#define SHN_C33_TBSS 0xff07
  24599. +#define SHN_C33_ZBSS 0xff08
  24600. +
  24601. +
  24602. +/* Processor specific section types. */
  24603. +
  24604. +/* Section contains the .scommon data. */
  24605. +#define SHT_C33_COMM 0x70000000
  24606. +#define SHT_C33_GCOMM 0x70000001
  24607. +#define SHT_C33_SCOMM 0x70000002
  24608. +#define SHT_C33_TCOMM 0x70000003
  24609. +#define SHT_C33_ZCOMM 0x70000004
  24610. +#define SHT_C33_GBSS 0x70000005
  24611. +#define SHT_C33_SBSS 0x70000006
  24612. +#define SHT_C33_TBSS 0x70000007
  24613. +#define SHT_C33_ZBSS 0x70000008
  24614. +
  24615. +
  24616. +
  24617. +#endif /* _ELF_C33_H */
  24618. +
  24619. +
  24620. diff --git a/include/elf/common.h b/include/elf/common.h
  24621. index b290853..5b8c585 100644
  24622. --- a/include/elf/common.h
  24623. +++ b/include/elf/common.h
  24624. @@ -202,6 +202,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  24625. Written in the absense of an ABI. */
  24626. #define EM_AVR 0x1057
  24627. +/* C33 magic number */
  24628. +#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor */
  24629. +
  24630. +/* C17 magic number */
  24631. +#define EM_SE_C17 139 /* C17 Family of Seiko Epson processor */
  24632. +
  24633. /* See the above comment before you add a new EM_* value here. */
  24634. /* Values for e_version */
  24635. diff --git a/include/opcode/c33.h b/include/opcode/c33.h
  24636. new file mode 100644
  24637. index 0000000..6d48650
  24638. --- /dev/null
  24639. +++ b/include/opcode/c33.h
  24640. @@ -0,0 +1,205 @@
  24641. +/* c33.h -- Header file for EPSON C33 opcode table
  24642. + Copyright 1996 Free Software Foundation, Inc.
  24643. + Written by J.T. Conklin, Cygnus Support
  24644. +
  24645. +This file is part of GDB, GAS, and the GNU binutils.
  24646. +
  24647. +GDB, GAS, and the GNU binutils are free software; you can redistribute
  24648. +them and/or modify them under the terms of the GNU General Public
  24649. +License as published by the Free Software Foundation; either version
  24650. +1, or (at your option) any later version.
  24651. +
  24652. +GDB, GAS, and the GNU binutils are distributed in the hope that they
  24653. +will be useful, but WITHOUT ANY WARRANTY; without even the implied
  24654. +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  24655. +the GNU General Public License for more details.
  24656. +
  24657. +You should have received a copy of the GNU General Public License
  24658. +along with this file; see the file COPYING. If not, write to the Free
  24659. +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  24660. +
  24661. +#ifndef V850_H
  24662. +#define V850_H
  24663. +
  24664. +/* The opcode table is an array of struct c33_opcode. */
  24665. +
  24666. +struct c33_opcode
  24667. +{
  24668. + /* The opcode name. */
  24669. + const char *name;
  24670. +
  24671. + /* The opcode itself. Those bits which will be filled in with
  24672. + operands are zeroes. */
  24673. + unsigned long opcode;
  24674. +
  24675. + /* The opcode mask. This is used by the disassembler. This is a
  24676. + mask containing ones indicating those bits which must match the
  24677. + opcode field, and zeroes indicating those bits which need not
  24678. + match (and are presumably filled in by operands). */
  24679. + unsigned long mask;
  24680. +
  24681. + /* An array of operand codes. Each code is an index into the
  24682. + operand table. They appear in the order which the operands must
  24683. + appear in assembly code, and are terminated by a zero. */
  24684. + unsigned char operands[8];
  24685. +
  24686. + /* Which (if any) operand is a memory operand. */
  24687. + unsigned int memop;
  24688. +
  24689. + /* special flag */
  24690. + /* 0: special process none */
  24691. + /* 1: [sp+imm32] byte (1byte) */
  24692. + /* 2: [sp+imm32] half word (2byte) */
  24693. + /* 4: [sp+imm32] word(4byte) */
  24694. + /* 5:shift/lotate */
  24695. + unsigned int specialFlag;
  24696. +};
  24697. +
  24698. +#if 0 /* c33 */
  24699. +/* Values for the processors field in the c33_opcode structure. */
  24700. +#define PROCESSOR_V850 (1 << 0) /* Just the V850. */
  24701. +#define PROCESSOR_ALL -1 /* Any processor. */
  24702. +#define PROCESSOR_V850E (1 << 1) /* Just the V850E. */
  24703. +#define PROCESSOR_NOT_V850 (~ PROCESSOR_V850) /* Any processor except the V850. */
  24704. +#define PROCESSOR_V850EA (1 << 2) /* Just the V850EA. */
  24705. +#endif /* c33 */
  24706. +
  24707. +/* The table itself is sorted by major opcode number, and is otherwise
  24708. + in the order in which the disassembler should consider
  24709. + instructions. */
  24710. +extern const struct c33_opcode c33_opcodes[];
  24711. +
  24712. +/* add tazaki 2001.11.07 */
  24713. +extern int g_iAdvance;
  24714. +extern const struct c33_opcode c33_advance_opcodes[];
  24715. +/* add tazaki 2001.09.19 */
  24716. +extern const struct c33_opcode c33_ext_opcodes[];
  24717. +/* add tazaki 2001.09.19 */
  24718. +extern const int c33_num_opcodes;
  24719. +
  24720. +/* add T.Tazaki 2003/11/18 >>> */
  24721. +extern int g_iPE;
  24722. +extern const struct c33_opcode c33_pe_opcodes[];
  24723. +/* add T.Tazaki 2003/11/18 <<< */
  24724. +
  24725. +/* add T.Tazaki 2004/07/30 >>> */
  24726. +extern int g_iMedda32;
  24727. +extern const struct c33_opcode c33_opcodes32[];
  24728. +extern const struct c33_opcode c33_advance_opcodes32[];
  24729. +extern const struct c33_opcode c33_pe_opcodes32[];
  24730. +/* add T.Tazaki 2004/07/30 <<< */
  24731. +
  24732. +
  24733. +
  24734. +/* The operands table is an array of struct c33_operand. */
  24735. +
  24736. +struct c33_operand
  24737. +{
  24738. + /* The number of bits in the operand. */
  24739. + /* If this value is -1 then the operand's bits are in a discontinous distribution in the instruction. */
  24740. + int bits;
  24741. +
  24742. + /* (bits >= 0): How far the operand is left shifted in the instruction. */
  24743. + /* (bits == -1): Bit mask of the bits in the operand. */
  24744. + int shift;
  24745. +
  24746. + /* Insertion function. This is used by the assembler. To insert an
  24747. + operand value into an instruction, check this field.
  24748. +
  24749. + If it is NULL, execute
  24750. + i |= (op & ((1 << o->bits) - 1)) << o->shift;
  24751. + (i is the instruction which we are filling in, o is a pointer to
  24752. + this structure, and op is the opcode value; this assumes twos
  24753. + complement arithmetic).
  24754. +
  24755. + If this field is not NULL, then simply call it with the
  24756. + instruction and the operand value. It will return the new value
  24757. + of the instruction. If the ERRMSG argument is not NULL, then if
  24758. + the operand value is illegal, *ERRMSG will be set to a warning
  24759. + string (the operand will be inserted in any case). If the
  24760. + operand value is legal, *ERRMSG will be unchanged (most operands
  24761. + can accept any value). */
  24762. + unsigned long (* insert) PARAMS ((unsigned long instruction, long op,
  24763. + const char ** errmsg));
  24764. +
  24765. + /* Extraction function. This is used by the disassembler. To
  24766. + extract this operand type from an instruction, check this field.
  24767. +
  24768. + If it is NULL, compute
  24769. + op = o->bits == -1 ? ((i) & o->shift) : ((i) >> o->shift) & ((1 << o->bits) - 1);
  24770. + if (o->flags & V850_OPERAND_SIGNED)
  24771. + op = (op << (32 - o->bits)) >> (32 - o->bits);
  24772. + (i is the instruction, o is a pointer to this structure, and op
  24773. + is the result; this assumes twos complement arithmetic).
  24774. +
  24775. + If this field is not NULL, then simply call it with the
  24776. + instruction value. It will return the value of the operand. If
  24777. + the INVALID argument is not NULL, *INVALID will be set to
  24778. + non-zero if this operand type can not actually be extracted from
  24779. + this operand (i.e., the instruction does not match). If the
  24780. + operand is valid, *INVALID will not be changed. */
  24781. + unsigned long (* extract) PARAMS ((unsigned long instruction, int * invalid));
  24782. +
  24783. + /* One bit syntax flags. */
  24784. + int flags;
  24785. +
  24786. + /* 有効範囲 imm6/sign8/imm13/imm26など
  24787. + 例えば、xld.w [symbol+imm26]の有効範囲は26bit
  24788. + sld.w [symbol+imm13]の有効範囲は13bitとなる
  24789. + */
  24790. + int range;
  24791. +};
  24792. +
  24793. +/* Elements in the table are retrieved by indexing with values from
  24794. + the operands field of the c33_opcodes table. */
  24795. +
  24796. +extern const struct c33_operand c33_operands[];
  24797. +
  24798. +/* Values defined for the flags field of a struct c33_operand. */
  24799. +
  24800. +/* This operand names a general purpose register */
  24801. +#define C33_OPERAND_REG 0x01
  24802. +#define C33_OPERAND_SREG 0x02 /* special registers */
  24803. +#define C33_OPERAND_IMM 0x04
  24804. +#define C33_OPERAND_SIGNED 0x08
  24805. +#define C33_OPERAND_MEM 0x10 /* [symbol+imm32] */
  24806. +#define C33_OPERAND_SPMEM 0x20 /* [%sp+imm6] */
  24807. +#define C33_OPERAND_REGINC 0x40 /* [%rb]+ */
  24808. +#define C33_OPERAND_SP 0x80
  24809. +#define C33_OPERAND_LABEL 0x100 /* label+imm32 */
  24810. +#define C33_OPERAND_RB 0x200 /* [%rb] , [%rb+imm]*/
  24811. +#define C33_OPERAND_SYMBOL 0x400 /* symbol+imm32 */
  24812. +#define C33_OPERAND_PC 0x800 /* jp sign8(8:1) sign(0) = 0 */
  24813. +/* >>> add tazaki 2002.06.19 */
  24814. +#define C33_OPERAND_OFFSET_SYMBOL 0x1000 /* ext doff_hi(symbol),doff_li(symbol), etc... */
  24815. +#define C33_OPERAND_01 0x2000 /* Advanced Inst : class0 bit5,4 = ( 0,1 ) */
  24816. +#define C33_OPERAND_OP3_01 0x4000 /* Advanced Inst : class5 bit7,6 = ( 0,1 ) */
  24817. +#define C33_OPERAND_OP3_10 0x8000 /* Advanced Inst : class5 bit7,6 = ( 1,0 ) */
  24818. +#define C33_OPERAND_DPMEM 0x0003 /* Advanced Inst : [%dp+imm6] */
  24819. +#define C33_OPERAND_DP 0x0070 /* Advanced Inst : %dp */
  24820. +#define C33_OPERAND_DP_SYMBOL 0xc000 /* Advanced Inst : [symbol+imm] */
  24821. +#define C33_OPERAND_DPSYMBOL6 0x3000 /* Advanced Inst : [%dp+dpoff_l(symbol)] */
  24822. +#define C33_OPERAND_DPSYMBOL6_2 0x1800 /* Advanced Inst : [%dp+dpoff_l(symbol)] */
  24823. +#define C33_OPERAND_COND 0x1400 /* Advanced Inst : ext cond */
  24824. +#define C33_OPERAND_OP_SHIFT 0x1200 /* Advanced Inst : ext OP,imm2 | ext %rb,OP,imm2 */
  24825. +#define C33_OPERAND_LD_SREG 0x10000 /* Advanced Inst : ld.w %sd,%rs */
  24826. +#define C33_OPERAND_PUSHS_SREG 0x20000 /* special registers : pushs , pops */
  24827. +/* <<< add tazaki 2002.06.19 */
  24828. +
  24829. +/* add T.Tazaki 2004/07/23 >>> */
  24830. +#define C33_XLDB_RD 0x40000 /* xld.b %rd,[symbol+imm] */
  24831. +#define C33_XLDB_WR 0x80000 /* xld.b [symbol+imm],%rs */
  24832. +#define C33_XLDH_RD 0x100000 /* xld.h %rd,[symbol+imm] */
  24833. +#define C33_XLDH_WR 0x200000 /* xld.h [symbol+imm],%rs */
  24834. +#define C33_XLDW_RD 0x400000 /* xld.w %rd,[symbol+imm] */
  24835. +#define C33_XLDW_WR 0x800000 /* xld.w [symbol+imm],%rs */
  24836. +#define C33_XLDUB_RD 0x1000000 /* xld.ub %rd,[symbol+imm] */
  24837. +#define C33_XLDUH_RD 0x2000000 /* xld.uh %rd, [symbol+imm] */
  24838. +#define C33_XBTST 0x4000000 /* xbtst [symbol+imm],imm3 */
  24839. +#define C33_XBCLR 0x8000000 /* xbclr [symbol+imm],imm3 */
  24840. +#define C33_XBSET 0x10000000 /* xbset [symbol+imm],imm3 */
  24841. +#define C33_XBNOT 0x20000000 /* xbnot [symbol+imm],imm3 */
  24842. +#define C33_OPERAND_26 0x40000000 /* [%rb+imm26] */
  24843. +/* add T.Tazaki 2004/07/23 <<< */
  24844. +
  24845. +#endif /* C33 */
  24846. diff --git a/ld/Makefile.am b/ld/Makefile.am
  24847. index 0abc9b5..be1fd41 100644
  24848. --- a/ld/Makefile.am
  24849. +++ b/ld/Makefile.am
  24850. @@ -678,6 +678,9 @@ evsta.c: $(srcdir)/emulparams/vsta.sh \
  24851. ev850.c: $(srcdir)/emulparams/v850.sh \
  24852. $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS}
  24853. ${GENSCRIPTS} v850 "$(tdir_v850)"
  24854. +ec33.c: $(srcdir)/emulparams/c33.sh \
  24855. + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/c33.sc ${GEN_DEPENDS}
  24856. + ${GENSCRIPTS} c33 "$(tdir_c33)"
  24857. ew65.c: $(srcdir)/emulparams/w65.sh \
  24858. $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
  24859. ${GENSCRIPTS} w65 "$(tdir_w65)"
  24860. diff --git a/ld/Makefile.in b/ld/Makefile.in
  24861. index 0fa39ae..5651574 100644
  24862. --- a/ld/Makefile.in
  24863. +++ b/ld/Makefile.in
  24864. @@ -1377,6 +1377,9 @@ evsta.c: $(srcdir)/emulparams/vsta.sh \
  24865. ev850.c: $(srcdir)/emulparams/v850.sh \
  24866. $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/v850.sc ${GEN_DEPENDS}
  24867. ${GENSCRIPTS} v850 "$(tdir_v850)"
  24868. +ec33.c: $(srcdir)/emulparams/c33.sh \
  24869. + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/c33.sc ${GEN_DEPENDS}
  24870. + ${GENSCRIPTS} c33 "$(tdir_c33)"
  24871. ew65.c: $(srcdir)/emulparams/w65.sh \
  24872. $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
  24873. ${GENSCRIPTS} w65 "$(tdir_w65)"
  24874. diff --git a/ld/configure.tgt b/ld/configure.tgt
  24875. index c22eee7..89eee7d 100644
  24876. --- a/ld/configure.tgt
  24877. +++ b/ld/configure.tgt
  24878. @@ -287,6 +287,7 @@ rs6000-*-aix*) targ_emul=aixrs6 ;;
  24879. tic30-*-*aout*) targ_emul=tic30aout ;;
  24880. tic30-*-*coff*) targ_emul=tic30coff ;;
  24881. tic80-*-*) targ_emul=tic80coff ;;
  24882. +c33-*-*) targ_emul=c33 ;;
  24883. v850-*-*) targ_emul=v850 ;;
  24884. v850e-*-*) targ_emul=v850 ;;
  24885. v850ea-*-*) targ_emul=v850 ;;
  24886. diff --git a/ld/emulparams/c33.sh b/ld/emulparams/c33.sh
  24887. new file mode 100644
  24888. index 0000000..fe0146e
  24889. --- /dev/null
  24890. +++ b/ld/emulparams/c33.sh
  24891. @@ -0,0 +1,10 @@
  24892. +MACHINE=
  24893. +SCRIPT_NAME=c33
  24894. +OUTPUT_FORMAT="elf32-c33"
  24895. +TEXT_START_ADDR=0xc00000
  24896. +SDATA_START_ADDR="ALIGN (4)"
  24897. +ARCH=c33
  24898. +MAXPAGESIZE=256
  24899. +ENTRY=_start
  24900. +EMBEDDED=yes
  24901. +TEMPLATE_NAME=c33
  24902. diff --git a/ld/emultempl/c33.em b/ld/emultempl/c33.em
  24903. new file mode 100644
  24904. index 0000000..6635e09
  24905. --- /dev/null
  24906. +++ b/ld/emultempl/c33.em
  24907. @@ -0,0 +1,128 @@
  24908. +# This shell script emits a C file. -*- C -*-
  24909. +# It does some substitutions.
  24910. +cat >e${EMULATION_NAME}.c <<EOF
  24911. +/* This file is is generated by a shell script. DO NOT EDIT! */
  24912. +
  24913. +/* emulate the original gld for the given ${EMULATION_NAME}
  24914. + Copyright (C) 1991, 93, 94, 95, 96, 1999 Free Software Foundation, Inc.
  24915. + Written by Steve Chamberlain steve@cygnus.com
  24916. +
  24917. +This file is part of GLD, the Gnu Linker.
  24918. +
  24919. +This program is free software; you can redistribute it and/or modify
  24920. +it under the terms of the GNU General Public License as published by
  24921. +the Free Software Foundation; either version 2 of the License, or
  24922. +(at your option) any later version.
  24923. +
  24924. +This program is distributed in the hope that it will be useful,
  24925. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  24926. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24927. +GNU General Public License for more details.
  24928. +
  24929. +You should have received a copy of the GNU General Public License
  24930. +along with this program; if not, write to the Free Software
  24931. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  24932. +
  24933. +#define TARGET_IS_${EMULATION_NAME}
  24934. +
  24935. +#include "bfd.h"
  24936. +#include "sysdep.h"
  24937. +#include "bfdlink.h"
  24938. +
  24939. +#include "ld.h"
  24940. +#include "ldmain.h"
  24941. +#include "ldemul.h"
  24942. +#include "ldfile.h"
  24943. +#include "ldmisc.h"
  24944. +
  24945. +static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
  24946. +static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
  24947. +
  24948. +static void
  24949. +gld${EMULATION_NAME}_before_parse()
  24950. +{
  24951. +#ifndef TARGET_ /* I.e., if not generic. */
  24952. + ldfile_set_output_arch ("`echo ${ARCH}`");
  24953. +#endif /* not TARGET_ */
  24954. +}
  24955. +
  24956. +static char *
  24957. +gld${EMULATION_NAME}_get_script(isfile)
  24958. + int *isfile;
  24959. +EOF
  24960. +
  24961. +if test -n "$COMPILE_IN"
  24962. +then
  24963. +# Scripts compiled in.
  24964. +
  24965. +# sed commands to quote an ld script as a C string.
  24966. +sc="-f stringify.sed"
  24967. +
  24968. +cat >>e${EMULATION_NAME}.c <<EOF
  24969. +{
  24970. + *isfile = 0;
  24971. +
  24972. + if (link_info.relocateable == true && config.build_constructors == true)
  24973. + return
  24974. +EOF
  24975. +sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
  24976. +echo ' ; else if (link_info.relocateable == true) return' >> e${EMULATION_NAME}.c
  24977. +sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
  24978. +echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
  24979. +sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
  24980. +echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
  24981. +sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
  24982. +echo ' ; else return' >> e${EMULATION_NAME}.c
  24983. +sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
  24984. +echo '; }' >> e${EMULATION_NAME}.c
  24985. +
  24986. +else
  24987. +# Scripts read from the filesystem.
  24988. +
  24989. +cat >>e${EMULATION_NAME}.c <<EOF
  24990. +{
  24991. + *isfile = 1;
  24992. +
  24993. + if (link_info.relocateable == true && config.build_constructors == true)
  24994. + return "ldscripts/${EMULATION_NAME}.xu";
  24995. + else if (link_info.relocateable == true)
  24996. + return "ldscripts/${EMULATION_NAME}.xr";
  24997. + else if (!config.text_read_only)
  24998. + return "ldscripts/${EMULATION_NAME}.xbn";
  24999. + else if (!config.magic_demand_paged)
  25000. + return "ldscripts/${EMULATION_NAME}.xn";
  25001. + else
  25002. + return "ldscripts/${EMULATION_NAME}.x";
  25003. +}
  25004. +EOF
  25005. +
  25006. +fi
  25007. +
  25008. +cat >>e${EMULATION_NAME}.c <<EOF
  25009. +
  25010. +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
  25011. +{
  25012. + gld${EMULATION_NAME}_before_parse,
  25013. + syslib_default,
  25014. + hll_default,
  25015. + after_parse_default,
  25016. + after_open_default,
  25017. + after_allocation_default,
  25018. + set_output_arch_default,
  25019. + ldemul_default_target,
  25020. + before_allocation_default,
  25021. + gld${EMULATION_NAME}_get_script,
  25022. + "${EMULATION_NAME}",
  25023. + "${OUTPUT_FORMAT}",
  25024. + NULL, /* finish */
  25025. + NULL, /* create output section statements */
  25026. + NULL, /* open dynamic archive */
  25027. + NULL, /* place orphan */
  25028. + NULL, /* set symbols */
  25029. + NULL, /* parse args */
  25030. + NULL, /* unrecognized file */
  25031. + NULL, /* list options */
  25032. + NULL, /* recognized file */
  25033. + NULL /* find_potential_libraries */
  25034. +};
  25035. +EOF
  25036. diff --git a/ld/ldlang.c b/ld/ldlang.c
  25037. index 8f0c607..79ca963 100644
  25038. --- a/ld/ldlang.c
  25039. +++ b/ld/ldlang.c
  25040. @@ -42,8 +42,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  25041. /* FORWARDS */
  25042. static lang_statement_union_type *new_statement PARAMS ((enum statement_enum,
  25043. - size_t,
  25044. - lang_statement_list_type*));
  25045. + size_t,
  25046. + lang_statement_list_type*));
  25047. /* LOCALS */
  25048. @@ -65,29 +65,29 @@ static struct lang_phdr *lang_phdr_list;
  25049. static void lang_for_each_statement_worker
  25050. PARAMS ((void (*func) (lang_statement_union_type *),
  25051. - lang_statement_union_type *s));
  25052. + lang_statement_union_type *s));
  25053. static lang_input_statement_type *new_afile
  25054. PARAMS ((const char *name, lang_input_file_enum_type file_type,
  25055. - const char *target, boolean add_to_list));
  25056. + const char *target, boolean add_to_list));
  25057. static void init_os PARAMS ((lang_output_section_statement_type *s));
  25058. static void exp_init_os PARAMS ((etree_type *));
  25059. static void section_already_linked PARAMS ((bfd *, asection *, PTR));
  25060. static struct bfd_hash_entry *already_linked_newfunc
  25061. PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
  25062. - const char *string));
  25063. + const char *string));
  25064. static void already_linked_table_init PARAMS ((void));
  25065. static void already_linked_table_free PARAMS ((void));
  25066. static boolean wildcardp PARAMS ((const char *));
  25067. static lang_statement_union_type *wild_sort
  25068. PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
  25069. - asection *));
  25070. + asection *));
  25071. static lang_input_statement_type *lookup_name PARAMS ((const char *name));
  25072. static void load_symbols PARAMS ((lang_input_statement_type *entry,
  25073. - lang_statement_list_type *));
  25074. + lang_statement_list_type *));
  25075. static void wild PARAMS ((lang_wild_statement_type *s,
  25076. - const char *section, const char *file,
  25077. - const char *target,
  25078. - lang_output_section_statement_type *output));
  25079. + const char *section, const char *file,
  25080. + const char *target,
  25081. + lang_output_section_statement_type *output));
  25082. static bfd *open_output PARAMS ((const char *name));
  25083. static void ldlang_open_output PARAMS ((lang_statement_union_type *statement));
  25084. static void open_input_bfds
  25085. @@ -96,15 +96,17 @@ static void lang_reasonable_defaults PARAMS ((void));
  25086. static void lang_place_undefineds PARAMS ((void));
  25087. static void map_input_to_output_sections
  25088. PARAMS ((lang_statement_union_type *s,
  25089. - const char *target,
  25090. - lang_output_section_statement_type *output_section_statement));
  25091. + const char *target,
  25092. + lang_output_section_statement_type *output_section_statement));
  25093. static void print_output_section_statement
  25094. PARAMS ((lang_output_section_statement_type *output_section_statement));
  25095. static void print_assignment
  25096. PARAMS ((lang_assignment_statement_type *assignment,
  25097. - lang_output_section_statement_type *output_section));
  25098. + lang_output_section_statement_type *output_section));
  25099. static void print_input_statement PARAMS ((lang_input_statement_type *statm));
  25100. static boolean print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR));
  25101. +static boolean c33_print_one_symbol PARAMS ((struct bfd_link_hash_entry *, PTR));
  25102. +static void c33_bfd_hash_traverse PARAMS ((struct bfd_hash_table *, boolean (*) (struct bfd_hash_entry *, PTR), PTR));
  25103. static void print_input_section PARAMS ((lang_input_section_type *in));
  25104. static void print_fill_statement PARAMS ((lang_fill_statement_type *fill));
  25105. static void print_data_statement PARAMS ((lang_data_statement_type *data));
  25106. @@ -113,22 +115,22 @@ static void print_reloc_statement PARAMS ((lang_reloc_statement_type *reloc));
  25107. static void print_padding_statement PARAMS ((lang_padding_statement_type *s));
  25108. static void print_wild_statement
  25109. PARAMS ((lang_wild_statement_type *w,
  25110. - lang_output_section_statement_type *os));
  25111. + lang_output_section_statement_type *os));
  25112. static void print_group
  25113. PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *));
  25114. static void print_statement PARAMS ((lang_statement_union_type *s,
  25115. - lang_output_section_statement_type *os));
  25116. + lang_output_section_statement_type *os));
  25117. static void print_statement_list PARAMS ((lang_statement_union_type *s,
  25118. - lang_output_section_statement_type *os));
  25119. + lang_output_section_statement_type *os));
  25120. static void print_statements PARAMS ((void));
  25121. static bfd_vma insert_pad PARAMS ((lang_statement_union_type **this_ptr,
  25122. - fill_type fill, unsigned int power,
  25123. - asection *output_section_statement,
  25124. - bfd_vma dot));
  25125. + fill_type fill, unsigned int power,
  25126. + asection *output_section_statement,
  25127. + bfd_vma dot));
  25128. static bfd_vma size_input_section
  25129. PARAMS ((lang_statement_union_type **this_ptr,
  25130. - lang_output_section_statement_type *output_section_statement,
  25131. - fill_type fill, bfd_vma dot, boolean relax));
  25132. + lang_output_section_statement_type *output_section_statement,
  25133. + fill_type fill, bfd_vma dot, boolean relax));
  25134. static void lang_finish PARAMS ((void));
  25135. static void ignore_bfd_errors PARAMS ((const char *, ...));
  25136. static void lang_check PARAMS ((void));
  25137. @@ -147,14 +149,14 @@ static void lang_do_version_exports_section PARAMS ((void));
  25138. static void lang_check_section_addresses PARAMS ((void));
  25139. typedef void (*callback_t) PARAMS ((lang_wild_statement_type *,
  25140. - asection *, lang_input_statement_type *,
  25141. - void *));
  25142. + asection *, lang_input_statement_type *,
  25143. + void *));
  25144. static void walk_wild_section
  25145. PARAMS ((lang_wild_statement_type *, const char *,
  25146. - lang_input_statement_type *, callback_t, void *));
  25147. + lang_input_statement_type *, callback_t, void *));
  25148. static void walk_wild_file
  25149. PARAMS ((lang_wild_statement_type *, const char *,
  25150. - lang_input_statement_type *, callback_t, void *));
  25151. + lang_input_statement_type *, callback_t, void *));
  25152. static int get_target PARAMS ((const bfd_target *, void *));
  25153. static void stricpy PARAMS ((char *, char *));
  25154. @@ -162,7 +164,7 @@ static void strcut PARAMS ((char *, char *));
  25155. static int name_compare PARAMS ((char *, char *));
  25156. static int closest_target_match PARAMS ((const bfd_target *, void *));
  25157. static char * get_first_input_target PARAMS ((void));
  25158. -
  25159. +
  25160. /* EXPORTS */
  25161. lang_output_section_statement_type *abs_output_section;
  25162. lang_statement_list_type lang_output_section_statement;
  25163. @@ -218,16 +220,16 @@ walk_wild_section (ptr, section, file, callback, data)
  25164. struct name_list *list_tmp;
  25165. for (list_tmp = ptr->exclude_filename_list; list_tmp; list_tmp = list_tmp->next)
  25166. {
  25167. - boolean match;
  25168. + boolean match;
  25169. - if (wildcardp (list_tmp->name))
  25170. - match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
  25171. - else
  25172. - match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
  25173. + if (wildcardp (list_tmp->name))
  25174. + match = fnmatch (list_tmp->name, file->filename, 0) == 0 ? true : false;
  25175. + else
  25176. + match = strcmp (list_tmp->name, file->filename) == 0 ? true : false;
  25177. - if (match)
  25178. - return;
  25179. - }
  25180. + if (match)
  25181. + return;
  25182. + }
  25183. }
  25184. if (file->just_syms_flag == false)
  25185. @@ -236,30 +238,30 @@ walk_wild_section (ptr, section, file, callback, data)
  25186. boolean wildcard;
  25187. if (section == NULL)
  25188. - wildcard = false;
  25189. + wildcard = false;
  25190. else
  25191. - wildcard = wildcardp (section);
  25192. + wildcard = wildcardp (section);
  25193. for (s = file->the_bfd->sections; s != NULL; s = s->next)
  25194. - {
  25195. - boolean match;
  25196. + {
  25197. + boolean match;
  25198. - if (section == NULL)
  25199. - match = true;
  25200. - else
  25201. - {
  25202. - const char *name;
  25203. + if (section == NULL)
  25204. + match = true;
  25205. + else
  25206. + {
  25207. + const char *name;
  25208. - name = bfd_get_section_name (file->the_bfd, s);
  25209. - if (wildcard)
  25210. - match = fnmatch (section, name, 0) == 0 ? true : false;
  25211. - else
  25212. - match = strcmp (section, name) == 0 ? true : false;
  25213. - }
  25214. + name = bfd_get_section_name (file->the_bfd, s);
  25215. + if (wildcard)
  25216. + match = fnmatch (section, name, 0) == 0 ? true : false;
  25217. + else
  25218. + match = strcmp (section, name) == 0 ? true : false;
  25219. + }
  25220. - if (match)
  25221. - (*callback) (ptr, s, file, data);
  25222. - }
  25223. + if (match)
  25224. + (*callback) (ptr, s, file, data);
  25225. + }
  25226. }
  25227. }
  25228. @@ -281,24 +283,24 @@ walk_wild_file (s, section, f, callback, data)
  25229. bfd *member;
  25230. /* This is an archive file. We must map each member of the
  25231. - archive separately. */
  25232. + archive separately. */
  25233. member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
  25234. while (member != NULL)
  25235. - {
  25236. - /* When lookup_name is called, it will call the add_symbols
  25237. - entry point for the archive. For each element of the
  25238. - archive which is included, BFD will call ldlang_add_file,
  25239. - which will set the usrdata field of the member to the
  25240. - lang_input_statement. */
  25241. - if (member->usrdata != NULL)
  25242. - {
  25243. - walk_wild_section (s, section,
  25244. - (lang_input_statement_type *) member->usrdata,
  25245. - callback, data);
  25246. - }
  25247. + {
  25248. + /* When lookup_name is called, it will call the add_symbols
  25249. + entry point for the archive. For each element of the
  25250. + archive which is included, BFD will call ldlang_add_file,
  25251. + which will set the usrdata field of the member to the
  25252. + lang_input_statement. */
  25253. + if (member->usrdata != NULL)
  25254. + {
  25255. + walk_wild_section (s, section,
  25256. + (lang_input_statement_type *) member->usrdata,
  25257. + callback, data);
  25258. + }
  25259. - member = bfd_openr_next_archived_file (f->the_bfd, member);
  25260. - }
  25261. + member = bfd_openr_next_archived_file (f->the_bfd, member);
  25262. + }
  25263. }
  25264. }
  25265. @@ -314,17 +316,17 @@ walk_wild (s, section, file, callback, data)
  25266. {
  25267. /* Perform the iteration over all files in the list. */
  25268. LANG_FOR_EACH_INPUT_STATEMENT (f)
  25269. - {
  25270. - walk_wild_file (s, section, f, callback, data);
  25271. - }
  25272. + {
  25273. + walk_wild_file (s, section, f, callback, data);
  25274. + }
  25275. }
  25276. else if (wildcardp (file))
  25277. {
  25278. LANG_FOR_EACH_INPUT_STATEMENT (f)
  25279. - {
  25280. - if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
  25281. - walk_wild_file (s, section, f, callback, data);
  25282. - }
  25283. + {
  25284. + if (fnmatch (file, f->filename, FNM_FILE_NAME) == 0)
  25285. + walk_wild_file (s, section, f, callback, data);
  25286. + }
  25287. }
  25288. else
  25289. {
  25290. @@ -351,40 +353,40 @@ lang_for_each_statement_worker (func, s)
  25291. func (s);
  25292. switch (s->header.type)
  25293. - {
  25294. - case lang_constructors_statement_enum:
  25295. - lang_for_each_statement_worker (func, constructor_list.head);
  25296. - break;
  25297. - case lang_output_section_statement_enum:
  25298. - lang_for_each_statement_worker
  25299. - (func,
  25300. - s->output_section_statement.children.head);
  25301. - break;
  25302. - case lang_wild_statement_enum:
  25303. - lang_for_each_statement_worker
  25304. - (func,
  25305. - s->wild_statement.children.head);
  25306. - break;
  25307. - case lang_group_statement_enum:
  25308. - lang_for_each_statement_worker (func,
  25309. - s->group_statement.children.head);
  25310. - break;
  25311. - case lang_data_statement_enum:
  25312. - case lang_reloc_statement_enum:
  25313. - case lang_object_symbols_statement_enum:
  25314. - case lang_output_statement_enum:
  25315. - case lang_target_statement_enum:
  25316. - case lang_input_section_enum:
  25317. - case lang_input_statement_enum:
  25318. - case lang_assignment_statement_enum:
  25319. - case lang_padding_statement_enum:
  25320. - case lang_address_statement_enum:
  25321. - case lang_fill_statement_enum:
  25322. - break;
  25323. - default:
  25324. - FAIL ();
  25325. - break;
  25326. - }
  25327. + {
  25328. + case lang_constructors_statement_enum:
  25329. + lang_for_each_statement_worker (func, constructor_list.head);
  25330. + break;
  25331. + case lang_output_section_statement_enum:
  25332. + lang_for_each_statement_worker
  25333. + (func,
  25334. + s->output_section_statement.children.head);
  25335. + break;
  25336. + case lang_wild_statement_enum:
  25337. + lang_for_each_statement_worker
  25338. + (func,
  25339. + s->wild_statement.children.head);
  25340. + break;
  25341. + case lang_group_statement_enum:
  25342. + lang_for_each_statement_worker (func,
  25343. + s->group_statement.children.head);
  25344. + break;
  25345. + case lang_data_statement_enum:
  25346. + case lang_reloc_statement_enum:
  25347. + case lang_object_symbols_statement_enum:
  25348. + case lang_output_statement_enum:
  25349. + case lang_target_statement_enum:
  25350. + case lang_input_section_enum:
  25351. + case lang_input_statement_enum:
  25352. + case lang_assignment_statement_enum:
  25353. + case lang_padding_statement_enum:
  25354. + case lang_address_statement_enum:
  25355. + case lang_fill_statement_enum:
  25356. + break;
  25357. + default:
  25358. + FAIL ();
  25359. + break;
  25360. + }
  25361. }
  25362. }
  25363. @@ -393,7 +395,7 @@ lang_for_each_statement (func)
  25364. void (*func) PARAMS ((lang_statement_union_type *));
  25365. {
  25366. lang_for_each_statement_worker (func,
  25367. - statement_list.head);
  25368. + statement_list.head);
  25369. }
  25370. /*----------------------------------------------------------------------*/
  25371. @@ -452,7 +454,7 @@ new_afile (name, file_type, target, add_to_list)
  25372. else
  25373. {
  25374. p = ((lang_input_statement_type *)
  25375. - stat_alloc (sizeof (lang_input_statement_type)));
  25376. + stat_alloc (sizeof (lang_input_statement_type)));
  25377. p->header.next = NULL;
  25378. }
  25379. @@ -520,8 +522,8 @@ new_afile (name, file_type, target, add_to_list)
  25380. p->whole_archive = whole_archive;
  25381. p->loaded = false;
  25382. lang_statement_append (&input_file_chain,
  25383. - (lang_statement_union_type *) p,
  25384. - &p->next_real_file);
  25385. + (lang_statement_union_type *) p,
  25386. + &p->next_real_file);
  25387. return p;
  25388. }
  25389. @@ -549,8 +551,8 @@ lang_init ()
  25390. lang_list_init (&lang_output_section_statement);
  25391. lang_list_init (&file_chain);
  25392. first_file = lang_add_input_file ((char *) NULL,
  25393. - lang_input_file_is_marker_enum,
  25394. - (char *) NULL);
  25395. + lang_input_file_is_marker_enum,
  25396. + (char *) NULL);
  25397. abs_output_section = lang_output_section_statement_lookup (BFD_ABS_SECTION_NAME);
  25398. abs_output_section->bfd_section = bfd_abs_section_ptr;
  25399. @@ -582,9 +584,9 @@ lang_memory_region_lookup (name)
  25400. p = p->next)
  25401. {
  25402. if (strcmp (p->name, name) == 0)
  25403. - {
  25404. - return p;
  25405. - }
  25406. + {
  25407. + return p;
  25408. + }
  25409. }
  25410. #if 0
  25411. @@ -597,9 +599,9 @@ lang_memory_region_lookup (name)
  25412. if (strcmp (name, "*default*") == 0)
  25413. {
  25414. if (lang_memory_region_list != (lang_memory_region_type *) NULL)
  25415. - {
  25416. - return lang_memory_region_list;
  25417. - }
  25418. + {
  25419. + return lang_memory_region_list;
  25420. + }
  25421. }
  25422. #endif
  25423. @@ -641,10 +643,10 @@ lang_memory_default (section)
  25424. p = p->next)
  25425. {
  25426. if ((p->flags & sec_flags) != 0
  25427. - && (p->not_flags & sec_flags) == 0)
  25428. - {
  25429. - return p;
  25430. - }
  25431. + && (p->not_flags & sec_flags) == 0)
  25432. + {
  25433. + return p;
  25434. + }
  25435. }
  25436. return lang_memory_region_lookup ("*default*");
  25437. }
  25438. @@ -662,9 +664,9 @@ lang_output_section_find (name)
  25439. {
  25440. lookup = &u->output_section_statement;
  25441. if (strcmp (name, lookup->name) == 0)
  25442. - {
  25443. - return lookup;
  25444. - }
  25445. + {
  25446. + return lookup;
  25447. + }
  25448. }
  25449. return (lang_output_section_statement_type *) NULL;
  25450. }
  25451. @@ -680,7 +682,7 @@ lang_output_section_statement_lookup (name)
  25452. {
  25453. lookup = (lang_output_section_statement_type *)
  25454. - new_stat (lang_output_section_statement, stat_ptr);
  25455. + new_stat (lang_output_section_statement, stat_ptr);
  25456. lookup->region = (lang_memory_region_type *) NULL;
  25457. lookup->lma_region = (lang_memory_region_type *) NULL;
  25458. lookup->fill = 0;
  25459. @@ -702,8 +704,8 @@ lang_output_section_statement_lookup (name)
  25460. lookup->phdrs = NULL;
  25461. lang_statement_append (&lang_output_section_statement,
  25462. - (lang_statement_union_type *) lookup,
  25463. - &lookup->next);
  25464. + (lang_statement_union_type *) lookup,
  25465. + &lookup->next);
  25466. }
  25467. return lookup;
  25468. }
  25469. @@ -728,6 +730,7 @@ lang_map_flags (flag)
  25470. minfo ("l");
  25471. }
  25472. +
  25473. void
  25474. lang_map ()
  25475. {
  25476. @@ -735,7 +738,7 @@ lang_map ()
  25477. minfo (_("\nMemory Configuration\n\n"));
  25478. fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
  25479. - _("Name"), _("Origin"), _("Length"), _("Attributes"));
  25480. + _("Name"), _("Origin"), _("Length"), _("Attributes"));
  25481. for (m = lang_memory_region_list;
  25482. m != (lang_memory_region_type *) NULL;
  25483. @@ -750,35 +753,34 @@ lang_map ()
  25484. minfo ("0x%s ", buf);
  25485. len = strlen (buf);
  25486. while (len < 16)
  25487. - {
  25488. - print_space ();
  25489. - ++len;
  25490. - }
  25491. + {
  25492. + print_space ();
  25493. + ++len;
  25494. + }
  25495. minfo ("0x%V", m->length);
  25496. if (m->flags || m->not_flags)
  25497. - {
  25498. + {
  25499. #ifndef BFD64
  25500. - minfo (" ");
  25501. + minfo (" ");
  25502. #endif
  25503. - if (m->flags)
  25504. - {
  25505. - print_space ();
  25506. - lang_map_flags (m->flags);
  25507. - }
  25508. + if (m->flags)
  25509. + {
  25510. + print_space ();
  25511. + lang_map_flags (m->flags);
  25512. + }
  25513. - if (m->not_flags)
  25514. - {
  25515. - minfo (" !");
  25516. - lang_map_flags (m->not_flags);
  25517. - }
  25518. - }
  25519. + if (m->not_flags)
  25520. + {
  25521. + minfo (" !");
  25522. + lang_map_flags (m->not_flags);
  25523. + }
  25524. + }
  25525. print_nl ();
  25526. }
  25527. fprintf (config.map_file, _("\nLinker script and memory map\n\n"));
  25528. -
  25529. print_statements ();
  25530. }
  25531. @@ -797,7 +799,7 @@ init_os (s)
  25532. einfo (_("%P%F: Illegal use of `%s' section"), DISCARD_SECTION_NAME);
  25533. new = ((section_userdata_type *)
  25534. - stat_alloc (sizeof (section_userdata_type)));
  25535. + stat_alloc (sizeof (section_userdata_type)));
  25536. s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
  25537. if (s->bfd_section == (asection *) NULL)
  25538. @@ -805,7 +807,7 @@ init_os (s)
  25539. if (s->bfd_section == (asection *) NULL)
  25540. {
  25541. einfo (_("%P%F: output format %s cannot represent section called %s\n"),
  25542. - output_bfd->xvec->name, s->name);
  25543. + output_bfd->xvec->name, s->name);
  25544. }
  25545. s->bfd_section->output_section = s->bfd_section;
  25546. @@ -850,18 +852,18 @@ exp_init_os (exp)
  25547. case etree_name:
  25548. switch (exp->type.node_code)
  25549. - {
  25550. - case ADDR:
  25551. - case LOADADDR:
  25552. - case SIZEOF:
  25553. - {
  25554. - lang_output_section_statement_type *os;
  25555. -
  25556. - os = lang_output_section_find (exp->name.name);
  25557. - if (os != NULL && os->bfd_section == NULL)
  25558. - init_os (os);
  25559. - }
  25560. - }
  25561. + {
  25562. + case ADDR:
  25563. + case LOADADDR:
  25564. + case SIZEOF:
  25565. + {
  25566. + lang_output_section_statement_type *os;
  25567. +
  25568. + os = lang_output_section_find (exp->name.name);
  25569. + if (os != NULL && os->bfd_section == NULL)
  25570. + init_os (os);
  25571. + }
  25572. + }
  25573. break;
  25574. default:
  25575. @@ -952,54 +954,54 @@ section_already_linked (abfd, sec, data)
  25576. for (l = already_linked_list->entry; l != NULL; l = l->next)
  25577. {
  25578. if (sec->comdat == NULL
  25579. - || l->sec->comdat == NULL
  25580. - || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
  25581. - {
  25582. - /* The section has already been linked. See if we should
  25583. + || l->sec->comdat == NULL
  25584. + || strcmp (sec->comdat->name, l->sec->comdat->name) == 0)
  25585. + {
  25586. + /* The section has already been linked. See if we should
  25587. issue a warning. */
  25588. - switch (flags & SEC_LINK_DUPLICATES)
  25589. - {
  25590. - default:
  25591. - abort ();
  25592. -
  25593. - case SEC_LINK_DUPLICATES_DISCARD:
  25594. - break;
  25595. -
  25596. - case SEC_LINK_DUPLICATES_ONE_ONLY:
  25597. - if (sec->comdat == NULL)
  25598. - einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
  25599. - abfd, name);
  25600. - else
  25601. - einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
  25602. - abfd, name, sec->comdat->name);
  25603. - break;
  25604. -
  25605. - case SEC_LINK_DUPLICATES_SAME_CONTENTS:
  25606. - /* FIXME: We should really dig out the contents of both
  25607. + switch (flags & SEC_LINK_DUPLICATES)
  25608. + {
  25609. + default:
  25610. + abort ();
  25611. +
  25612. + case SEC_LINK_DUPLICATES_DISCARD:
  25613. + break;
  25614. +
  25615. + case SEC_LINK_DUPLICATES_ONE_ONLY:
  25616. + if (sec->comdat == NULL)
  25617. + einfo (_("%P: %B: warning: ignoring duplicate section `%s'\n"),
  25618. + abfd, name);
  25619. + else
  25620. + einfo (_("%P: %B: warning: ignoring duplicate `%s' section symbol `%s'\n"),
  25621. + abfd, name, sec->comdat->name);
  25622. + break;
  25623. +
  25624. + case SEC_LINK_DUPLICATES_SAME_CONTENTS:
  25625. + /* FIXME: We should really dig out the contents of both
  25626. sections and memcmp them. The COFF/PE spec says that
  25627. the Microsoft linker does not implement this
  25628. correctly, so I'm not going to bother doing it
  25629. either. */
  25630. - /* Fall through. */
  25631. - case SEC_LINK_DUPLICATES_SAME_SIZE:
  25632. - if (bfd_section_size (abfd, sec)
  25633. - != bfd_section_size (l->sec->owner, l->sec))
  25634. - einfo (_("%P: %B: warning: duplicate section `%s' has different size\n"),
  25635. - abfd, name);
  25636. - break;
  25637. - }
  25638. + /* Fall through. */
  25639. + case SEC_LINK_DUPLICATES_SAME_SIZE:
  25640. + if (bfd_section_size (abfd, sec)
  25641. + != bfd_section_size (l->sec->owner, l->sec))
  25642. + einfo (_("%P: %B: warning: duplicate section `%s' has different size\n"),
  25643. + abfd, name);
  25644. + break;
  25645. + }
  25646. - /* Set the output_section field so that wild_doit does not
  25647. - create a lang_input_section structure for this section.
  25648. - Since there might be a symbol in the section being
  25649. - discarded, we must retain a pointer to the section which
  25650. - we are really going to use. */
  25651. - sec->output_section = bfd_abs_section_ptr;
  25652. - if (sec->comdat != NULL)
  25653. - sec->comdat->sec = l->sec;
  25654. + /* Set the output_section field so that wild_doit does not
  25655. + create a lang_input_section structure for this section.
  25656. + Since there might be a symbol in the section being
  25657. + discarded, we must retain a pointer to the section which
  25658. + we are really going to use. */
  25659. + sec->output_section = bfd_abs_section_ptr;
  25660. + if (sec->comdat != NULL)
  25661. + sec->comdat->sec = l->sec;
  25662. - return;
  25663. - }
  25664. + return;
  25665. + }
  25666. }
  25667. /* This is the first section with this name. Record it. Allocate
  25668. @@ -1034,8 +1036,8 @@ static void
  25669. already_linked_table_init ()
  25670. {
  25671. if (! bfd_hash_table_init_n (&already_linked_table,
  25672. - already_linked_newfunc,
  25673. - 42))
  25674. + already_linked_newfunc,
  25675. + 42))
  25676. einfo (_("%P%F: Failed to create hash table\n"));
  25677. }
  25678. @@ -1065,8 +1067,8 @@ wildcardp (pattern)
  25679. for (s = pattern; *s != '\0'; ++s)
  25680. if (*s == '?'
  25681. - || *s == '*'
  25682. - || *s == '[')
  25683. + || *s == '*'
  25684. + || *s == '[')
  25685. return true;
  25686. return false;
  25687. }
  25688. @@ -1109,10 +1111,10 @@ wild_doit (ptr, section, output, file)
  25689. if (discard)
  25690. {
  25691. if (section->output_section == NULL)
  25692. - {
  25693. - /* This prevents future calls from assigning this section. */
  25694. - section->output_section = bfd_abs_section_ptr;
  25695. - }
  25696. + {
  25697. + /* This prevents future calls from assigning this section. */
  25698. + section->output_section = bfd_abs_section_ptr;
  25699. + }
  25700. return;
  25701. }
  25702. @@ -1123,12 +1125,12 @@ wild_doit (ptr, section, output, file)
  25703. flagword flags;
  25704. if (output->bfd_section == NULL)
  25705. - {
  25706. - init_os (output);
  25707. - first = true;
  25708. - }
  25709. + {
  25710. + init_os (output);
  25711. + first = true;
  25712. + }
  25713. else
  25714. - first = false;
  25715. + first = false;
  25716. /* Add a section reference to the list */
  25717. new = new_stat (lang_input_section, ptr);
  25718. @@ -1140,62 +1142,62 @@ wild_doit (ptr, section, output, file)
  25719. flags = section->flags;
  25720. /* We don't copy the SEC_NEVER_LOAD flag from an input section
  25721. - to an output section, because we want to be able to include a
  25722. - SEC_NEVER_LOAD section in the middle of an otherwise loaded
  25723. - section (I don't know why we want to do this, but we do).
  25724. - build_link_order in ldwrite.c handles this case by turning
  25725. - the embedded SEC_NEVER_LOAD section into a fill. */
  25726. + to an output section, because we want to be able to include a
  25727. + SEC_NEVER_LOAD section in the middle of an otherwise loaded
  25728. + section (I don't know why we want to do this, but we do).
  25729. + build_link_order in ldwrite.c handles this case by turning
  25730. + the embedded SEC_NEVER_LOAD section into a fill. */
  25731. flags &= ~ SEC_NEVER_LOAD;
  25732. /* If final link, don't copy the SEC_LINK_ONCE flags, they've
  25733. - already been processed. One reason to do this is that on pe
  25734. - format targets, .text$foo sections go into .text and it's odd
  25735. - to see .text with SEC_LINK_ONCE set. */
  25736. + already been processed. One reason to do this is that on pe
  25737. + format targets, .text$foo sections go into .text and it's odd
  25738. + to see .text with SEC_LINK_ONCE set. */
  25739. if (! link_info.relocateable)
  25740. - flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES);
  25741. + flags &= ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES);
  25742. /* If this is not the first input section, and the SEC_READONLY
  25743. flag is not currently set, then don't set it just because the
  25744. input section has it set. */
  25745. if (! first && (section->output_section->flags & SEC_READONLY) == 0)
  25746. - flags &= ~ SEC_READONLY;
  25747. + flags &= ~ SEC_READONLY;
  25748. section->output_section->flags |= flags;
  25749. /* If SEC_READONLY is not set in the input section, then clear
  25750. it from the output section. */
  25751. if ((section->flags & SEC_READONLY) == 0)
  25752. - section->output_section->flags &= ~SEC_READONLY;
  25753. + section->output_section->flags &= ~SEC_READONLY;
  25754. switch (output->sectype)
  25755. - {
  25756. - case normal_section:
  25757. - break;
  25758. - case dsect_section:
  25759. - case copy_section:
  25760. - case info_section:
  25761. - case overlay_section:
  25762. - output->bfd_section->flags &= ~SEC_ALLOC;
  25763. - break;
  25764. - case noload_section:
  25765. - output->bfd_section->flags &= ~SEC_LOAD;
  25766. - output->bfd_section->flags |= SEC_NEVER_LOAD;
  25767. - break;
  25768. - }
  25769. + {
  25770. + case normal_section:
  25771. + break;
  25772. + case dsect_section:
  25773. + case copy_section:
  25774. + case info_section:
  25775. + case overlay_section:
  25776. + output->bfd_section->flags &= ~SEC_ALLOC;
  25777. + break;
  25778. + case noload_section:
  25779. + output->bfd_section->flags &= ~SEC_LOAD;
  25780. + output->bfd_section->flags |= SEC_NEVER_LOAD;
  25781. + break;
  25782. + }
  25783. /* Copy over SEC_SMALL_DATA. */
  25784. if (section->flags & SEC_SMALL_DATA)
  25785. - section->output_section->flags |= SEC_SMALL_DATA;
  25786. + section->output_section->flags |= SEC_SMALL_DATA;
  25787. if (section->alignment_power > output->bfd_section->alignment_power)
  25788. - output->bfd_section->alignment_power = section->alignment_power;
  25789. + output->bfd_section->alignment_power = section->alignment_power;
  25790. /* If supplied an aligment, then force it. */
  25791. if (output->section_alignment != -1)
  25792. - output->bfd_section->alignment_power = output->section_alignment;
  25793. + output->bfd_section->alignment_power = output->section_alignment;
  25794. }
  25795. }
  25796. @@ -1222,79 +1224,79 @@ wild_sort (wild, file, section)
  25797. lang_input_section_type *ls;
  25798. if (l->header.type != lang_input_section_enum)
  25799. - continue;
  25800. + continue;
  25801. ls = &l->input_section;
  25802. /* Sorting by filename takes precedence over sorting by section
  25803. name. */
  25804. if (wild->filenames_sorted)
  25805. - {
  25806. - const char *fn, *ln;
  25807. - boolean fa, la;
  25808. - int i;
  25809. + {
  25810. + const char *fn, *ln;
  25811. + boolean fa, la;
  25812. + int i;
  25813. - /* The PE support for the .idata section as generated by
  25814. + /* The PE support for the .idata section as generated by
  25815. dlltool assumes that files will be sorted by the name of
  25816. the archive and then the name of the file within the
  25817. archive. */
  25818. - if (file->the_bfd != NULL
  25819. - && bfd_my_archive (file->the_bfd) != NULL)
  25820. - {
  25821. - fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
  25822. - fa = true;
  25823. - }
  25824. - else
  25825. - {
  25826. - fn = file->filename;
  25827. - fa = false;
  25828. - }
  25829. + if (file->the_bfd != NULL
  25830. + && bfd_my_archive (file->the_bfd) != NULL)
  25831. + {
  25832. + fn = bfd_get_filename (bfd_my_archive (file->the_bfd));
  25833. + fa = true;
  25834. + }
  25835. + else
  25836. + {
  25837. + fn = file->filename;
  25838. + fa = false;
  25839. + }
  25840. - if (ls->ifile->the_bfd != NULL
  25841. - && bfd_my_archive (ls->ifile->the_bfd) != NULL)
  25842. - {
  25843. - ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
  25844. - la = true;
  25845. - }
  25846. - else
  25847. - {
  25848. - ln = ls->ifile->filename;
  25849. - la = false;
  25850. - }
  25851. + if (ls->ifile->the_bfd != NULL
  25852. + && bfd_my_archive (ls->ifile->the_bfd) != NULL)
  25853. + {
  25854. + ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
  25855. + la = true;
  25856. + }
  25857. + else
  25858. + {
  25859. + ln = ls->ifile->filename;
  25860. + la = false;
  25861. + }
  25862. - i = strcmp (fn, ln);
  25863. - if (i > 0)
  25864. - continue;
  25865. - else if (i < 0)
  25866. - break;
  25867. + i = strcmp (fn, ln);
  25868. + if (i > 0)
  25869. + continue;
  25870. + else if (i < 0)
  25871. + break;
  25872. - if (fa || la)
  25873. - {
  25874. - if (fa)
  25875. - fn = file->filename;
  25876. - if (la)
  25877. - ln = ls->ifile->filename;
  25878. -
  25879. - i = strcmp (fn, ln);
  25880. - if (i > 0)
  25881. - continue;
  25882. - else if (i < 0)
  25883. - break;
  25884. - }
  25885. - }
  25886. + if (fa || la)
  25887. + {
  25888. + if (fa)
  25889. + fn = file->filename;
  25890. + if (la)
  25891. + ln = ls->ifile->filename;
  25892. +
  25893. + i = strcmp (fn, ln);
  25894. + if (i > 0)
  25895. + continue;
  25896. + else if (i < 0)
  25897. + break;
  25898. + }
  25899. + }
  25900. /* Here either the files are not sorted by name, or we are
  25901. looking at the sections for this file. */
  25902. if (wild->sections_sorted)
  25903. - {
  25904. - if (strcmp (section_name,
  25905. - bfd_get_section_name (ls->ifile->the_bfd,
  25906. - ls->section))
  25907. - < 0)
  25908. - break;
  25909. - }
  25910. + {
  25911. + if (strcmp (section_name,
  25912. + bfd_get_section_name (ls->ifile->the_bfd,
  25913. + ls->section))
  25914. + < 0)
  25915. + break;
  25916. + }
  25917. }
  25918. return l;
  25919. @@ -1326,8 +1328,8 @@ output_section_callback (ptr, section, file, output)
  25920. if (before == NULL)
  25921. wild_doit (&ptr->children, section,
  25922. - (lang_output_section_statement_type *) output,
  25923. - file);
  25924. + (lang_output_section_statement_type *) output,
  25925. + file);
  25926. else
  25927. {
  25928. lang_statement_list_type list;
  25929. @@ -1335,23 +1337,23 @@ output_section_callback (ptr, section, file, output)
  25930. lang_list_init (&list);
  25931. wild_doit (&list, section,
  25932. - (lang_output_section_statement_type *) output,
  25933. - file);
  25934. + (lang_output_section_statement_type *) output,
  25935. + file);
  25936. /* If we are discarding the section, LIST.HEAD will
  25937. - be NULL. */
  25938. + be NULL. */
  25939. if (list.head != NULL)
  25940. - {
  25941. - ASSERT (list.head->next == NULL);
  25942. -
  25943. - for (pp = &ptr->children.head;
  25944. - *pp != before;
  25945. - pp = &(*pp)->next)
  25946. - ASSERT (*pp != NULL);
  25947. -
  25948. - list.head->next = *pp;
  25949. - *pp = list.head;
  25950. - }
  25951. + {
  25952. + ASSERT (list.head->next == NULL);
  25953. +
  25954. + for (pp = &ptr->children.head;
  25955. + *pp != before;
  25956. + pp = &(*pp)->next)
  25957. + ASSERT (*pp != NULL);
  25958. +
  25959. + list.head->next = *pp;
  25960. + *pp = list.head;
  25961. + }
  25962. }
  25963. }
  25964. @@ -1370,16 +1372,16 @@ lookup_name (name)
  25965. search = (lang_input_statement_type *) search->next_real_file)
  25966. {
  25967. if (search->filename == (char *) NULL && name == (char *) NULL)
  25968. - return search;
  25969. + return search;
  25970. if (search->filename != (char *) NULL
  25971. - && name != (char *) NULL
  25972. - && strcmp (search->filename, name) == 0)
  25973. - break;
  25974. + && name != (char *) NULL
  25975. + && strcmp (search->filename, name) == 0)
  25976. + break;
  25977. }
  25978. if (search == (lang_input_statement_type *) NULL)
  25979. search = new_afile (name, lang_input_file_is_file_enum, default_target,
  25980. - false);
  25981. + false);
  25982. /* If we have already added this file, or this file is not real
  25983. (FIXME: can that ever actually happen?) or the name is NULL
  25984. @@ -1416,18 +1418,18 @@ load_symbols (entry, place)
  25985. err = bfd_get_error ();
  25986. if (err == bfd_error_file_ambiguously_recognized)
  25987. - {
  25988. - char **p;
  25989. -
  25990. - einfo (_("%B: file not recognized: %E\n"), entry->the_bfd);
  25991. - einfo (_("%B: matching formats:"), entry->the_bfd);
  25992. - for (p = matching; *p != NULL; p++)
  25993. - einfo (" %s", *p);
  25994. - einfo ("%F\n");
  25995. - }
  25996. + {
  25997. + char **p;
  25998. +
  25999. + einfo (_("%B: file not recognized: %E\n"), entry->the_bfd);
  26000. + einfo (_("%B: matching formats:"), entry->the_bfd);
  26001. + for (p = matching; *p != NULL; p++)
  26002. + einfo (" %s", *p);
  26003. + einfo ("%F\n");
  26004. + }
  26005. else if (err != bfd_error_file_not_recognized
  26006. - || place == NULL)
  26007. - einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
  26008. + || place == NULL)
  26009. + einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd);
  26010. bfd_close (entry->the_bfd);
  26011. entry->the_bfd = NULL;
  26012. @@ -1435,7 +1437,7 @@ load_symbols (entry, place)
  26013. /* See if the emulation has some special knowledge. */
  26014. if (ldemul_unrecognized_file (entry))
  26015. - return;
  26016. + return;
  26017. /* Try to interpret the file as a linker script. */
  26018. @@ -1469,32 +1471,32 @@ load_symbols (entry, place)
  26019. case bfd_object:
  26020. ldlang_add_file (entry);
  26021. if (trace_files || trace_file_tries)
  26022. - info_msg ("%I\n", entry);
  26023. + info_msg ("%I\n", entry);
  26024. break;
  26025. case bfd_archive:
  26026. if (entry->whole_archive)
  26027. - {
  26028. - bfd *member = bfd_openr_next_archived_file (entry->the_bfd,
  26029. - (bfd *) NULL);
  26030. - while (member != NULL)
  26031. - {
  26032. - if (! bfd_check_format (member, bfd_object))
  26033. - einfo (_("%F%B: object %B in archive is not object\n"),
  26034. - entry->the_bfd, member);
  26035. - if (! ((*link_info.callbacks->add_archive_element)
  26036. - (&link_info, member, "--whole-archive")))
  26037. - abort ();
  26038. - if (! bfd_link_add_symbols (member, &link_info))
  26039. - einfo (_("%F%B: could not read symbols: %E\n"), member);
  26040. - member = bfd_openr_next_archived_file (entry->the_bfd,
  26041. - member);
  26042. - }
  26043. + {
  26044. + bfd *member = bfd_openr_next_archived_file (entry->the_bfd,
  26045. + (bfd *) NULL);
  26046. + while (member != NULL)
  26047. + {
  26048. + if (! bfd_check_format (member, bfd_object))
  26049. + einfo (_("%F%B: object %B in archive is not object\n"),
  26050. + entry->the_bfd, member);
  26051. + if (! ((*link_info.callbacks->add_archive_element)
  26052. + (&link_info, member, "--whole-archive")))
  26053. + abort ();
  26054. + if (! bfd_link_add_symbols (member, &link_info))
  26055. + einfo (_("%F%B: could not read symbols: %E\n"), member);
  26056. + member = bfd_openr_next_archived_file (entry->the_bfd,
  26057. + member);
  26058. + }
  26059. - entry->loaded = true;
  26060. + entry->loaded = true;
  26061. - return;
  26062. - }
  26063. + return;
  26064. + }
  26065. }
  26066. if (! bfd_link_add_symbols (entry->the_bfd, &link_info))
  26067. @@ -1552,7 +1554,7 @@ stricpy (dest, src)
  26068. while ((c = * src ++) != 0)
  26069. {
  26070. if (isupper ((unsigned char) c))
  26071. - c = tolower (c);
  26072. + c = tolower (c);
  26073. * dest ++ = c;
  26074. }
  26075. @@ -1574,7 +1576,7 @@ strcut (haystack, needle)
  26076. char * src;
  26077. for (src = haystack + strlen (needle); * src;)
  26078. - * haystack ++ = * src ++;
  26079. + * haystack ++ = * src ++;
  26080. * haystack = 0;
  26081. }
  26082. @@ -1610,8 +1612,8 @@ name_compare (first, second)
  26083. for (result = 0; copy1 [result] == copy2 [result]; result ++)
  26084. if (copy1 [result] == 0)
  26085. {
  26086. - result *= 10;
  26087. - break;
  26088. + result *= 10;
  26089. + break;
  26090. }
  26091. free (copy1);
  26092. @@ -1668,19 +1670,19 @@ get_first_input_target ()
  26093. LANG_FOR_EACH_INPUT_STATEMENT (s)
  26094. {
  26095. if (s->header.type == lang_input_statement_enum
  26096. - && s->real)
  26097. - {
  26098. - ldfile_open_file (s);
  26099. -
  26100. - if (s->the_bfd != NULL
  26101. - && bfd_check_format (s->the_bfd, bfd_object))
  26102. - {
  26103. - target = bfd_get_target (s->the_bfd);
  26104. -
  26105. - if (target != NULL)
  26106. - break;
  26107. - }
  26108. - }
  26109. + && s->real)
  26110. + {
  26111. + ldfile_open_file (s);
  26112. +
  26113. + if (s->the_bfd != NULL
  26114. + && bfd_check_format (s->the_bfd, bfd_object))
  26115. + {
  26116. + target = bfd_get_target (s->the_bfd);
  26117. +
  26118. + if (target != NULL)
  26119. + break;
  26120. + }
  26121. + }
  26122. }
  26123. return target;
  26124. @@ -1699,17 +1701,17 @@ open_output (name)
  26125. {
  26126. /* No - has the current target been set to something other than the default ? */
  26127. if (current_target != default_target)
  26128. - output_target = current_target;
  26129. + output_target = current_target;
  26130. /* No - can we determine the format of the first input file ? */
  26131. else
  26132. - {
  26133. - output_target = get_first_input_target ();
  26134. + {
  26135. + output_target = get_first_input_target ();
  26136. - /* Failed - use the default output target. */
  26137. - if (output_target == NULL)
  26138. - output_target = default_target;
  26139. - }
  26140. + /* Failed - use the default output target. */
  26141. + if (output_target == NULL)
  26142. + output_target = default_target;
  26143. + }
  26144. }
  26145. /* Has the user requested a particular endianness on the command line ? */
  26146. @@ -1722,33 +1724,33 @@ open_output (name)
  26147. target = bfd_search_for_target (get_target, (void *) output_target);
  26148. if (command_line.endian == ENDIAN_BIG)
  26149. - desired_endian = BFD_ENDIAN_BIG;
  26150. + desired_endian = BFD_ENDIAN_BIG;
  26151. else
  26152. - desired_endian = BFD_ENDIAN_LITTLE;
  26153. + desired_endian = BFD_ENDIAN_LITTLE;
  26154. /* See if the target has the wrong endianness. This should not happen
  26155. - if the linker script has provided big and little endian alternatives,
  26156. - but some scrips don't do this. */
  26157. + if the linker script has provided big and little endian alternatives,
  26158. + but some scrips don't do this. */
  26159. if (target->byteorder != desired_endian)
  26160. - {
  26161. - /* If it does, then see if the target provides
  26162. - an alternative with the correct endianness. */
  26163. - if (target->alternative_target != NULL
  26164. - && (target->alternative_target->byteorder == desired_endian))
  26165. - output_target = target->alternative_target->name;
  26166. - else
  26167. - {
  26168. - /* Try to find a target as similar as possible to the default
  26169. - target, but which has the desired endian characteristic. */
  26170. - (void) bfd_search_for_target (closest_target_match, (void *) target);
  26171. -
  26172. - /* Oh dear - we could not find any targets that satisfy our requirements. */
  26173. - if (winner == NULL)
  26174. - einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
  26175. - else
  26176. - output_target = winner->name;
  26177. - }
  26178. - }
  26179. + {
  26180. + /* If it does, then see if the target provides
  26181. + an alternative with the correct endianness. */
  26182. + if (target->alternative_target != NULL
  26183. + && (target->alternative_target->byteorder == desired_endian))
  26184. + output_target = target->alternative_target->name;
  26185. + else
  26186. + {
  26187. + /* Try to find a target as similar as possible to the default
  26188. + target, but which has the desired endian characteristic. */
  26189. + (void) bfd_search_for_target (closest_target_match, (void *) target);
  26190. +
  26191. + /* Oh dear - we could not find any targets that satisfy our requirements. */
  26192. + if (winner == NULL)
  26193. + einfo (_("%P: warning: could not find any targets that match endianness requirement\n"));
  26194. + else
  26195. + output_target = winner->name;
  26196. + }
  26197. + }
  26198. }
  26199. output = bfd_openw (name, output_target);
  26200. @@ -1756,7 +1758,7 @@ open_output (name)
  26201. if (output == (bfd *) NULL)
  26202. {
  26203. if (bfd_get_error () == bfd_error_invalid_target)
  26204. - einfo (_("%P%F: target %s not found\n"), output_target);
  26205. + einfo (_("%P%F: target %s not found\n"), output_target);
  26206. einfo (_("%P%F: cannot open output file %s: %E\n"), name);
  26207. }
  26208. @@ -1768,8 +1770,8 @@ open_output (name)
  26209. if (! bfd_set_format (output, bfd_object))
  26210. einfo (_("%P%F:%s: can not make object file: %E\n"), name);
  26211. if (! bfd_set_arch_mach (output,
  26212. - ldfile_output_architecture,
  26213. - ldfile_output_machine))
  26214. + ldfile_output_architecture,
  26215. + ldfile_output_machine))
  26216. einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
  26217. link_info.hash = bfd_link_hash_table_create (output);
  26218. @@ -1791,17 +1793,17 @@ ldlang_open_output (statement)
  26219. output_bfd = open_output (statement->output_statement.name);
  26220. ldemul_set_output_arch ();
  26221. if (config.magic_demand_paged && !link_info.relocateable)
  26222. - output_bfd->flags |= D_PAGED;
  26223. + output_bfd->flags |= D_PAGED;
  26224. else
  26225. - output_bfd->flags &= ~D_PAGED;
  26226. + output_bfd->flags &= ~D_PAGED;
  26227. if (config.text_read_only)
  26228. - output_bfd->flags |= WP_TEXT;
  26229. + output_bfd->flags |= WP_TEXT;
  26230. else
  26231. - output_bfd->flags &= ~WP_TEXT;
  26232. + output_bfd->flags &= ~WP_TEXT;
  26233. if (link_info.traditional_format)
  26234. - output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
  26235. + output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
  26236. else
  26237. - output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
  26238. + output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
  26239. break;
  26240. case lang_target_statement_enum:
  26241. @@ -1822,69 +1824,69 @@ open_input_bfds (s, force)
  26242. for (; s != (lang_statement_union_type *) NULL; s = s->next)
  26243. {
  26244. switch (s->header.type)
  26245. - {
  26246. - case lang_constructors_statement_enum:
  26247. - open_input_bfds (constructor_list.head, force);
  26248. - break;
  26249. - case lang_output_section_statement_enum:
  26250. - open_input_bfds (s->output_section_statement.children.head, force);
  26251. - break;
  26252. - case lang_wild_statement_enum:
  26253. - /* Maybe we should load the file's symbols */
  26254. - if (s->wild_statement.filename
  26255. - && ! wildcardp (s->wild_statement.filename))
  26256. - (void) lookup_name (s->wild_statement.filename);
  26257. - open_input_bfds (s->wild_statement.children.head, force);
  26258. - break;
  26259. - case lang_group_statement_enum:
  26260. - {
  26261. - struct bfd_link_hash_entry *undefs;
  26262. -
  26263. - /* We must continually search the entries in the group
  26264. + {
  26265. + case lang_constructors_statement_enum:
  26266. + open_input_bfds (constructor_list.head, force);
  26267. + break;
  26268. + case lang_output_section_statement_enum:
  26269. + open_input_bfds (s->output_section_statement.children.head, force);
  26270. + break;
  26271. + case lang_wild_statement_enum:
  26272. + /* Maybe we should load the file's symbols */
  26273. + if (s->wild_statement.filename
  26274. + && ! wildcardp (s->wild_statement.filename))
  26275. + (void) lookup_name (s->wild_statement.filename);
  26276. + open_input_bfds (s->wild_statement.children.head, force);
  26277. + break;
  26278. + case lang_group_statement_enum:
  26279. + {
  26280. + struct bfd_link_hash_entry *undefs;
  26281. +
  26282. + /* We must continually search the entries in the group
  26283. until no new symbols are added to the list of undefined
  26284. symbols. */
  26285. - do
  26286. - {
  26287. - undefs = link_info.hash->undefs_tail;
  26288. - open_input_bfds (s->group_statement.children.head, true);
  26289. - }
  26290. - while (undefs != link_info.hash->undefs_tail);
  26291. - }
  26292. - break;
  26293. - case lang_target_statement_enum:
  26294. - current_target = s->target_statement.target;
  26295. - break;
  26296. - case lang_input_statement_enum:
  26297. - if (s->input_statement.real)
  26298. - {
  26299. - lang_statement_list_type add;
  26300. + do
  26301. + {
  26302. + undefs = link_info.hash->undefs_tail;
  26303. + open_input_bfds (s->group_statement.children.head, true);
  26304. + }
  26305. + while (undefs != link_info.hash->undefs_tail);
  26306. + }
  26307. + break;
  26308. + case lang_target_statement_enum:
  26309. + current_target = s->target_statement.target;
  26310. + break;
  26311. + case lang_input_statement_enum:
  26312. + if (s->input_statement.real)
  26313. + {
  26314. + lang_statement_list_type add;
  26315. - s->input_statement.target = current_target;
  26316. + s->input_statement.target = current_target;
  26317. - /* If we are being called from within a group, and this
  26318. + /* If we are being called from within a group, and this
  26319. is an archive which has already been searched, then
  26320. force it to be researched. */
  26321. - if (force
  26322. - && s->input_statement.loaded
  26323. - && bfd_check_format (s->input_statement.the_bfd,
  26324. - bfd_archive))
  26325. - s->input_statement.loaded = false;
  26326. + if (force
  26327. + && s->input_statement.loaded
  26328. + && bfd_check_format (s->input_statement.the_bfd,
  26329. + bfd_archive))
  26330. + s->input_statement.loaded = false;
  26331. - lang_list_init (&add);
  26332. + lang_list_init (&add);
  26333. - load_symbols (&s->input_statement, &add);
  26334. + load_symbols (&s->input_statement, &add);
  26335. - if (add.head != NULL)
  26336. - {
  26337. - *add.tail = s->next;
  26338. - s->next = add.head;
  26339. - }
  26340. - }
  26341. - break;
  26342. - default:
  26343. - break;
  26344. - }
  26345. + if (add.head != NULL)
  26346. + {
  26347. + *add.tail = s->next;
  26348. + s->next = add.head;
  26349. + }
  26350. + }
  26351. + break;
  26352. + default:
  26353. + break;
  26354. + }
  26355. }
  26356. }
  26357. @@ -1905,7 +1907,7 @@ lang_reasonable_defaults ()
  26358. {
  26359. lang_wild_statement_type *new =
  26360. new_stat (lang_wild_statement,
  26361. - &default_common_section->children);
  26362. + &default_common_section->children);
  26363. new->section_name = "COMMON";
  26364. new->filename = (char *) NULL;
  26365. @@ -1958,13 +1960,13 @@ lang_place_undefineds ()
  26366. h = bfd_link_hash_lookup (link_info.hash, ptr->name, true, false, true);
  26367. if (h == (struct bfd_link_hash_entry *) NULL)
  26368. - einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
  26369. + einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
  26370. if (h->type == bfd_link_hash_new)
  26371. - {
  26372. - h->type = bfd_link_hash_undefined;
  26373. - h->u.undef.abfd = NULL;
  26374. - bfd_link_add_undef (link_info.hash, h);
  26375. - }
  26376. + {
  26377. + h->type = bfd_link_hash_undefined;
  26378. + h->u.undef.abfd = NULL;
  26379. + bfd_link_add_undef (link_info.hash, h);
  26380. + }
  26381. }
  26382. }
  26383. @@ -1978,71 +1980,71 @@ map_input_to_output_sections (s, target, output_section_statement)
  26384. for (; s != (lang_statement_union_type *) NULL; s = s->next)
  26385. {
  26386. switch (s->header.type)
  26387. - {
  26388. -
  26389. -
  26390. - case lang_wild_statement_enum:
  26391. - wild (&s->wild_statement, s->wild_statement.section_name,
  26392. - s->wild_statement.filename, target,
  26393. - output_section_statement);
  26394. -
  26395. - break;
  26396. - case lang_constructors_statement_enum:
  26397. - map_input_to_output_sections (constructor_list.head,
  26398. - target,
  26399. - output_section_statement);
  26400. - break;
  26401. - case lang_output_section_statement_enum:
  26402. - map_input_to_output_sections (s->output_section_statement.children.head,
  26403. - target,
  26404. - &s->output_section_statement);
  26405. - break;
  26406. - case lang_output_statement_enum:
  26407. - break;
  26408. - case lang_target_statement_enum:
  26409. - target = s->target_statement.target;
  26410. - break;
  26411. - case lang_group_statement_enum:
  26412. - map_input_to_output_sections (s->group_statement.children.head,
  26413. - target,
  26414. - output_section_statement);
  26415. - break;
  26416. - case lang_fill_statement_enum:
  26417. - case lang_input_section_enum:
  26418. - case lang_object_symbols_statement_enum:
  26419. - case lang_data_statement_enum:
  26420. - case lang_reloc_statement_enum:
  26421. - case lang_padding_statement_enum:
  26422. - case lang_input_statement_enum:
  26423. - if (output_section_statement != NULL
  26424. - && output_section_statement->bfd_section == NULL)
  26425. - init_os (output_section_statement);
  26426. - break;
  26427. - case lang_assignment_statement_enum:
  26428. - if (output_section_statement != NULL
  26429. - && output_section_statement->bfd_section == NULL)
  26430. - init_os (output_section_statement);
  26431. -
  26432. - /* Make sure that any sections mentioned in the assignment
  26433. + {
  26434. +
  26435. +
  26436. + case lang_wild_statement_enum:
  26437. + wild (&s->wild_statement, s->wild_statement.section_name,
  26438. + s->wild_statement.filename, target,
  26439. + output_section_statement);
  26440. +
  26441. + break;
  26442. + case lang_constructors_statement_enum:
  26443. + map_input_to_output_sections (constructor_list.head,
  26444. + target,
  26445. + output_section_statement);
  26446. + break;
  26447. + case lang_output_section_statement_enum:
  26448. + map_input_to_output_sections (s->output_section_statement.children.head,
  26449. + target,
  26450. + &s->output_section_statement);
  26451. + break;
  26452. + case lang_output_statement_enum:
  26453. + break;
  26454. + case lang_target_statement_enum:
  26455. + target = s->target_statement.target;
  26456. + break;
  26457. + case lang_group_statement_enum:
  26458. + map_input_to_output_sections (s->group_statement.children.head,
  26459. + target,
  26460. + output_section_statement);
  26461. + break;
  26462. + case lang_fill_statement_enum:
  26463. + case lang_input_section_enum:
  26464. + case lang_object_symbols_statement_enum:
  26465. + case lang_data_statement_enum:
  26466. + case lang_reloc_statement_enum:
  26467. + case lang_padding_statement_enum:
  26468. + case lang_input_statement_enum:
  26469. + if (output_section_statement != NULL
  26470. + && output_section_statement->bfd_section == NULL)
  26471. + init_os (output_section_statement);
  26472. + break;
  26473. + case lang_assignment_statement_enum:
  26474. + if (output_section_statement != NULL
  26475. + && output_section_statement->bfd_section == NULL)
  26476. + init_os (output_section_statement);
  26477. +
  26478. + /* Make sure that any sections mentioned in the assignment
  26479. are initialized. */
  26480. - exp_init_os (s->assignment_statement.exp);
  26481. - break;
  26482. - case lang_afile_asection_pair_statement_enum:
  26483. - FAIL ();
  26484. - break;
  26485. - case lang_address_statement_enum:
  26486. - /* Mark the specified section with the supplied address */
  26487. - {
  26488. - lang_output_section_statement_type *os =
  26489. - lang_output_section_statement_lookup
  26490. - (s->address_statement.section_name);
  26491. -
  26492. - if (os->bfd_section == NULL)
  26493. - init_os (os);
  26494. - os->addr_tree = s->address_statement.address;
  26495. - }
  26496. - break;
  26497. - }
  26498. + exp_init_os (s->assignment_statement.exp);
  26499. + break;
  26500. + case lang_afile_asection_pair_statement_enum:
  26501. + FAIL ();
  26502. + break;
  26503. + case lang_address_statement_enum:
  26504. + /* Mark the specified section with the supplied address */
  26505. + {
  26506. + lang_output_section_statement_type *os =
  26507. + lang_output_section_statement_lookup
  26508. + (s->address_statement.section_name);
  26509. +
  26510. + if (os->bfd_section == NULL)
  26511. + init_os (os);
  26512. + os->addr_tree = s->address_statement.address;
  26513. + }
  26514. + break;
  26515. + }
  26516. }
  26517. }
  26518. @@ -2055,41 +2057,50 @@ print_output_section_statement (output_section_statement)
  26519. if (output_section_statement != abs_output_section)
  26520. {
  26521. +
  26522. +/* add D.Fujimoto 2006/06/12 >>> display message for debugging sections */
  26523. + if (strncmp (output_section_statement->name, ".stab", sizeof(".stab") - 1) == 0 ||
  26524. + strncmp (output_section_statement->name, ".comment", sizeof(".comment") - 1) == 0) {
  26525. + minfo("\n*** Section %s will not be loaded to the target ***\n", output_section_statement->name);
  26526. + }
  26527. +/* add D.Fujimoto 2006/06/12 <<< display message for debugging sections */
  26528. +
  26529. minfo ("\n%s", output_section_statement->name);
  26530. if (section != NULL)
  26531. - {
  26532. - print_dot = section->vma;
  26533. + {
  26534. + print_dot = section->vma;
  26535. - len = strlen (output_section_statement->name);
  26536. - if (len >= SECTION_NAME_MAP_LENGTH - 1)
  26537. - {
  26538. - print_nl ();
  26539. - len = 0;
  26540. - }
  26541. - while (len < SECTION_NAME_MAP_LENGTH)
  26542. - {
  26543. - print_space ();
  26544. - ++len;
  26545. - }
  26546. + len = strlen (output_section_statement->name);
  26547. + if (len >= SECTION_NAME_MAP_LENGTH - 1)
  26548. + {
  26549. + print_nl ();
  26550. + len = 0;
  26551. + }
  26552. + while (len < SECTION_NAME_MAP_LENGTH)
  26553. + {
  26554. + print_space ();
  26555. + ++len;
  26556. + }
  26557. - minfo ("0x%V %W", section->vma, section->_raw_size);
  26558. + minfo ("0x%V %W", section->vma, section->_raw_size);
  26559. - if (output_section_statement->load_base != NULL)
  26560. - {
  26561. - bfd_vma addr;
  26562. - addr = exp_get_abs_int (output_section_statement->load_base, 0,
  26563. - "load base", lang_final_phase_enum);
  26564. - minfo (_(" load address 0x%V"), addr);
  26565. - }
  26566. - }
  26567. + if (output_section_statement->load_base != NULL)
  26568. + {
  26569. + bfd_vma addr;
  26570. +
  26571. + addr = exp_get_abs_int (output_section_statement->load_base, 0,
  26572. + "load base", lang_final_phase_enum);
  26573. + minfo (_(" load address 0x%V"), addr);
  26574. + }
  26575. + }
  26576. print_nl ();
  26577. }
  26578. print_statement_list (output_section_statement->children.head,
  26579. - output_section_statement);
  26580. + output_section_statement);
  26581. }
  26582. static void
  26583. @@ -2104,7 +2115,7 @@ print_assignment (assignment, output_section)
  26584. print_space ();
  26585. result = exp_fold_tree (assignment->exp->assign.src, output_section,
  26586. - lang_final_phase_enum, print_dot, &print_dot);
  26587. + lang_final_phase_enum, print_dot, &print_dot);
  26588. if (result.valid_p)
  26589. minfo ("0x%V", result.value + result.section->bfd_section->vma);
  26590. else
  26591. @@ -2149,11 +2160,11 @@ print_one_symbol (hash_entry, ptr)
  26592. int i;
  26593. for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
  26594. - print_space ();
  26595. + print_space ();
  26596. minfo ("0x%V ",
  26597. - (hash_entry->u.def.value
  26598. - + hash_entry->u.def.section->output_offset
  26599. - + hash_entry->u.def.section->output_section->vma));
  26600. + (hash_entry->u.def.value
  26601. + + hash_entry->u.def.section->output_offset
  26602. + + hash_entry->u.def.section->output_section->vma));
  26603. minfo (" %T\n", hash_entry->root.string);
  26604. }
  26605. @@ -2170,7 +2181,7 @@ print_input_section (in)
  26606. asection *i = in->section;
  26607. bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
  26608. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26609. - ldfile_output_machine);
  26610. + ldfile_output_machine);
  26611. if (size != 0)
  26612. {
  26613. print_space ();
  26614. @@ -2178,49 +2189,162 @@ print_input_section (in)
  26615. minfo ("%s", i->name);
  26616. if (i->output_section != NULL)
  26617. - {
  26618. - int len;
  26619. + {
  26620. + int len;
  26621. - len = 1 + strlen (i->name);
  26622. - if (len >= SECTION_NAME_MAP_LENGTH - 1)
  26623. - {
  26624. - print_nl ();
  26625. - len = 0;
  26626. - }
  26627. - while (len < SECTION_NAME_MAP_LENGTH)
  26628. - {
  26629. - print_space ();
  26630. - ++len;
  26631. - }
  26632. + len = 1 + strlen (i->name);
  26633. + if (len >= SECTION_NAME_MAP_LENGTH - 1)
  26634. + {
  26635. + print_nl ();
  26636. + len = 0;
  26637. + }
  26638. + while (len < SECTION_NAME_MAP_LENGTH)
  26639. + {
  26640. + print_space ();
  26641. + ++len;
  26642. + }
  26643. - minfo ("0x%V %W %B\n",
  26644. - i->output_section->vma + i->output_offset, size / opb,
  26645. - i->owner);
  26646. + minfo ("0x%V %W %B\n",
  26647. + i->output_section->vma + i->output_offset, size / opb,
  26648. + i->owner);
  26649. - if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
  26650. - {
  26651. - len = SECTION_NAME_MAP_LENGTH + 3;
  26652. +
  26653. + if (i->_cooked_size != 0 && i->_cooked_size != i->_raw_size)
  26654. + {
  26655. + len = SECTION_NAME_MAP_LENGTH + 3;
  26656. #ifdef BFD64
  26657. - len += 16;
  26658. + len += 16;
  26659. #else
  26660. - len += 8;
  26661. + len += 8;
  26662. #endif
  26663. - while (len > 0)
  26664. + while (len > 0)
  26665. + {
  26666. + print_space ();
  26667. + --len;
  26668. + }
  26669. +
  26670. + minfo (_("%W (size before relaxing)\n"), i->_raw_size);
  26671. + }
  26672. +
  26673. +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 >>> */
  26674. +
  26675. +/* del
  26676. + bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
  26677. +*/
  26678. + c33_bfd_hash_traverse (&link_info.hash->table,
  26679. + ((boolean (*) PARAMS ((struct bfd_hash_entry *, PTR)))
  26680. + c33_print_one_symbol),
  26681. + (PTR) i);
  26682. +
  26683. +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 <<< */
  26684. +
  26685. +
  26686. + print_dot = i->output_section->vma + i->output_offset + size / opb;
  26687. + }
  26688. + }
  26689. +}
  26690. +
  26691. +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 >>> */
  26692. +
  26693. +#define C33_SYMBOL_MAX 3000
  26694. +
  26695. +static int c33_iSymbolIndex = 0;
  26696. +static unsigned long c33_ulSymbolAddr[C33_SYMBOL_MAX + 10];
  26697. +static char c33_szSymbol[C33_SYMBOL_MAX + 10][300];
  26698. +static unsigned long c33_ulSymbolAddr2[C33_SYMBOL_MAX + 10];
  26699. +static char c33_szSymbol2[C33_SYMBOL_MAX + 10][300];
  26700. +
  26701. +static void
  26702. +c33_bfd_hash_traverse (table, func, info)
  26703. + struct bfd_hash_table *table;
  26704. + boolean (*func) PARAMS ((struct bfd_hash_entry *, PTR));
  26705. + PTR info;
  26706. +{
  26707. + unsigned int i;
  26708. + unsigned int j;
  26709. + unsigned int k;
  26710. + int iMinIndex = 0;
  26711. + unsigned long ulMinAddr = 0;
  26712. +
  26713. + c33_iSymbolIndex = 0; /* initialize output symbol index */
  26714. +
  26715. + for (i = 0; i < table->size; i++)
  26716. + {
  26717. + struct bfd_hash_entry *p;
  26718. +
  26719. + for (p = table->table[i]; p != NULL; p = p->next)
  26720. {
  26721. - print_space ();
  26722. - --len;
  26723. + if (! (*func) (p, info)) /* c33_print_one_symbol() */
  26724. + return;
  26725. }
  26726. + }
  26727. - minfo (_("%W (size before relaxing)\n"), i->_raw_size);
  26728. - }
  26729. + /* sort symbol address */
  26730. +
  26731. + for( j = 0; j < c33_iSymbolIndex; ++j )
  26732. + {
  26733. + iMinIndex = 0;
  26734. + ulMinAddr = c33_ulSymbolAddr[ iMinIndex ];
  26735. +
  26736. + for( k = 0; k < c33_iSymbolIndex; ++k )
  26737. + {
  26738. + if( ulMinAddr > c33_ulSymbolAddr[ k ] )
  26739. + {
  26740. + ulMinAddr = c33_ulSymbolAddr[ k ];
  26741. + iMinIndex = k;
  26742. + }
  26743. + }
  26744. + c33_ulSymbolAddr2[ j ] = c33_ulSymbolAddr[ iMinIndex ];
  26745. + strcpy( c33_szSymbol2[ j ], c33_szSymbol[ iMinIndex ] );
  26746. +
  26747. + c33_ulSymbolAddr[ iMinIndex ] = 0xffffffff; /* max set */
  26748. + }
  26749. - bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
  26750. + /* symbol output */
  26751. +
  26752. + for( j = 0; j < c33_iSymbolIndex; ++j )
  26753. + {
  26754. + for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
  26755. + print_space ();
  26756. + minfo ("0x%V ", c33_ulSymbolAddr2[ j ] );
  26757. + minfo (" %T\n", c33_szSymbol2[ j ] );
  26758. - print_dot = i->output_section->vma + i->output_offset + size / opb;
  26759. }
  26760. - }
  26761. +
  26762. }
  26763. +
  26764. +static boolean
  26765. +c33_print_one_symbol (hash_entry, ptr)
  26766. + struct bfd_link_hash_entry *hash_entry;
  26767. + PTR ptr;
  26768. +{
  26769. + asection *sec = (asection *) ptr;
  26770. +
  26771. + if ((hash_entry->type == bfd_link_hash_defined
  26772. + || hash_entry->type == bfd_link_hash_defweak)
  26773. + && sec == hash_entry->u.def.section)
  26774. + {
  26775. +
  26776. + /* set symbol address and symbol name to dim. */
  26777. + if( c33_iSymbolIndex < C33_SYMBOL_MAX )
  26778. + {
  26779. +
  26780. +
  26781. + c33_ulSymbolAddr[ c33_iSymbolIndex ] = (hash_entry->u.def.value
  26782. + + hash_entry->u.def.section->output_offset
  26783. + + hash_entry->u.def.section->output_section->vma);
  26784. + strcpy( c33_szSymbol[ c33_iSymbolIndex ],hash_entry->root.string );
  26785. +
  26786. + ++c33_iSymbolIndex;
  26787. +
  26788. + }
  26789. + }
  26790. + return true;
  26791. +}
  26792. +
  26793. +/* output symbol for sequential of address : change T.Tazaki 2005/06/16 <<< */
  26794. +
  26795. static void
  26796. print_fill_statement (fill)
  26797. lang_fill_statement_type * fill;
  26798. @@ -2237,7 +2361,7 @@ print_data_statement (data)
  26799. bfd_size_type size;
  26800. const char *name;
  26801. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26802. - ldfile_output_machine);
  26803. + ldfile_output_machine);
  26804. for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
  26805. print_space ();
  26806. @@ -2308,7 +2432,7 @@ print_reloc_statement (reloc)
  26807. bfd_vma addr;
  26808. bfd_size_type size;
  26809. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26810. - ldfile_output_machine);
  26811. + ldfile_output_machine);
  26812. for (i = 0; i < SECTION_NAME_MAP_LENGTH; i++)
  26813. print_space ();
  26814. @@ -2340,7 +2464,7 @@ print_padding_statement (s)
  26815. int len;
  26816. bfd_vma addr;
  26817. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26818. - ldfile_output_machine);
  26819. + ldfile_output_machine);
  26820. minfo (" *fill*");
  26821. @@ -2439,6 +2563,8 @@ print_statement (s, os)
  26822. lang_statement_union_type *s;
  26823. lang_output_section_statement_type *os;
  26824. {
  26825. +
  26826. +
  26827. switch (s->header.type)
  26828. {
  26829. default:
  26830. @@ -2447,13 +2573,13 @@ print_statement (s, os)
  26831. break;
  26832. case lang_constructors_statement_enum:
  26833. if (constructor_list.head != NULL)
  26834. - {
  26835. - if (constructors_sorted)
  26836. - minfo (" SORT (CONSTRUCTORS)\n");
  26837. - else
  26838. - minfo (" CONSTRUCTORS\n");
  26839. - print_statement_list (constructor_list.head, os);
  26840. - }
  26841. + {
  26842. + if (constructors_sorted)
  26843. + minfo (" SORT (CONSTRUCTORS)\n");
  26844. + else
  26845. + minfo (" CONSTRUCTORS\n");
  26846. + print_statement_list (constructor_list.head, os);
  26847. + }
  26848. break;
  26849. case lang_wild_statement_enum:
  26850. print_wild_statement (&s->wild_statement, os);
  26851. @@ -2491,7 +2617,7 @@ print_statement (s, os)
  26852. case lang_output_statement_enum:
  26853. minfo ("OUTPUT(%s", s->output_statement.name);
  26854. if (output_target != NULL)
  26855. - minfo (" %s", output_target);
  26856. + minfo (" %s", output_target);
  26857. minfo (")\n");
  26858. break;
  26859. case lang_input_statement_enum:
  26860. @@ -2531,10 +2657,10 @@ dprint_statement (s, n)
  26861. else
  26862. {
  26863. while (s && --n >= 0)
  26864. - {
  26865. - print_statement (s, abs_output_section);
  26866. - s = s->next;
  26867. - }
  26868. + {
  26869. + print_statement (s, abs_output_section);
  26870. + s = s->next;
  26871. + }
  26872. }
  26873. config.map_file = map_save;
  26874. @@ -2557,14 +2683,14 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
  26875. */
  26876. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26877. - ldfile_output_machine);
  26878. + ldfile_output_machine);
  26879. unsigned int alignment_needed = align_power (dot, power) - dot;
  26880. if (alignment_needed != 0)
  26881. {
  26882. lang_statement_union_type *new =
  26883. - ((lang_statement_union_type *)
  26884. - stat_alloc (sizeof (lang_padding_statement_type)));
  26885. + ((lang_statement_union_type *)
  26886. + stat_alloc (sizeof (lang_padding_statement_type)));
  26887. /* Link into existing chain */
  26888. new->header.next = *this_ptr;
  26889. @@ -2572,7 +2698,7 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot)
  26890. new->header.type = lang_padding_statement_enum;
  26891. new->padding_statement.output_section = output_section_statement;
  26892. new->padding_statement.output_offset =
  26893. - dot - output_section_statement->vma;
  26894. + dot - output_section_statement->vma;
  26895. new->padding_statement.fill = fill;
  26896. new->padding_statement.size = alignment_needed * opb;
  26897. }
  26898. @@ -2600,27 +2726,27 @@ size_input_section (this_ptr, output_section_statement, fill, dot, relax)
  26899. lang_input_section_type *is = &((*this_ptr)->input_section);
  26900. asection *i = is->section;
  26901. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  26902. - ldfile_output_machine);
  26903. + ldfile_output_machine);
  26904. if (is->ifile->just_syms_flag == false)
  26905. {
  26906. if (output_section_statement->subsection_alignment != -1)
  26907. i->alignment_power =
  26908. - output_section_statement->subsection_alignment;
  26909. + output_section_statement->subsection_alignment;
  26910. dot = insert_pad (this_ptr, fill, i->alignment_power,
  26911. - output_section_statement->bfd_section, dot);
  26912. + output_section_statement->bfd_section, dot);
  26913. /* Remember where in the output section this input section goes */
  26914. i->output_offset = dot - output_section_statement->bfd_section->vma;
  26915. /* Mark how big the output section must be to contain this now
  26916. - */
  26917. + */
  26918. if (i->_cooked_size != 0)
  26919. - dot += i->_cooked_size / opb;
  26920. + dot += i->_cooked_size / opb;
  26921. else
  26922. - dot += i->_raw_size / opb;
  26923. + dot += i->_raw_size / opb;
  26924. output_section_statement->bfd_section->_raw_size =
  26925. (dot - output_section_statement->bfd_section->vma) * opb;
  26926. }
  26927. @@ -2652,42 +2778,42 @@ lang_check_section_addresses ()
  26928. /* Ignore sections which are not loaded or which have no contents. */
  26929. if (IGNORE_SECTION (output_bfd, s))
  26930. - continue;
  26931. + continue;
  26932. /* Once we reach section 's' stop our seach. This prevents two
  26933. - warning messages from being produced, one for 'section A overlaps
  26934. - section B' and one for 'section B overlaps section A'. */
  26935. + warning messages from being produced, one for 'section A overlaps
  26936. + section B' and one for 'section B overlaps section A'. */
  26937. for (os = output_bfd->sections; os != s; os = os->next)
  26938. - {
  26939. - bfd_vma s_start;
  26940. - bfd_vma s_end;
  26941. - bfd_vma os_start;
  26942. - bfd_vma os_end;
  26943. -
  26944. - /* Only consider loadable sections with real contents. */
  26945. - if (IGNORE_SECTION (output_bfd, os))
  26946. - continue;
  26947. -
  26948. - /* We must check the sections' LMA addresses not their
  26949. - VMA addresses because overlay sections can have
  26950. - overlapping VMAs but they must have distinct LMAs. */
  26951. - s_start = bfd_section_lma (output_bfd, s);
  26952. - os_start = bfd_section_lma (output_bfd, os);
  26953. - s_end = s_start + bfd_section_size (output_bfd, s) / opb - 1;
  26954. - os_end = os_start + bfd_section_size (output_bfd, os) / opb - 1;
  26955. -
  26956. - /* Look for an overlap. */
  26957. - if ((s_end < os_start) || (s_start > os_end))
  26958. - continue;
  26959. -
  26960. - einfo (
  26961. + {
  26962. + bfd_vma s_start;
  26963. + bfd_vma s_end;
  26964. + bfd_vma os_start;
  26965. + bfd_vma os_end;
  26966. +
  26967. + /* Only consider loadable sections with real contents. */
  26968. + if (IGNORE_SECTION (output_bfd, os))
  26969. + continue;
  26970. +
  26971. + /* We must check the sections' LMA addresses not their
  26972. + VMA addresses because overlay sections can have
  26973. + overlapping VMAs but they must have distinct LMAs. */
  26974. + s_start = bfd_section_lma (output_bfd, s);
  26975. + os_start = bfd_section_lma (output_bfd, os);
  26976. + s_end = s_start + bfd_section_size (output_bfd, s) / opb - 1;
  26977. + os_end = os_start + bfd_section_size (output_bfd, os) / opb - 1;
  26978. +
  26979. + /* Look for an overlap. */
  26980. + if ((s_end < os_start) || (s_start > os_end))
  26981. + continue;
  26982. +
  26983. + einfo (
  26984. _("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
  26985. - s->name, s_start, s_end, os->name, os_start, os_end);
  26986. -
  26987. - /* Once we have found one overlap for this section,
  26988. - stop looking for others. */
  26989. - break;
  26990. - }
  26991. + s->name, s_start, s_end, os->name, os_start, os_end);
  26992. +
  26993. + /* Once we have found one overlap for this section,
  26994. + stop looking for others. */
  26995. + break;
  26996. + }
  26997. }
  26998. }
  26999. @@ -2745,153 +2871,153 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
  27000. boolean relax;
  27001. {
  27002. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  27003. - ldfile_output_machine);
  27004. + ldfile_output_machine);
  27005. /* Size up the sections from their constituent parts. */
  27006. for (; s != (lang_statement_union_type *) NULL; s = s->next)
  27007. {
  27008. switch (s->header.type)
  27009. - {
  27010. - case lang_output_section_statement_enum:
  27011. - {
  27012. - bfd_vma after;
  27013. - lang_output_section_statement_type *os = &s->output_section_statement;
  27014. -
  27015. - if (os->bfd_section == NULL)
  27016. - /* This section was never actually created. */
  27017. - break;
  27018. -
  27019. - /* If this is a COFF shared library section, use the size and
  27020. - address from the input section. FIXME: This is COFF
  27021. - specific; it would be cleaner if there were some other way
  27022. - to do this, but nothing simple comes to mind. */
  27023. - if ((os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
  27024. - {
  27025. - asection * input;
  27026. -
  27027. - if (os->children.head == NULL
  27028. - || os->children.head->next != NULL
  27029. - || os->children.head->header.type != lang_input_section_enum)
  27030. - einfo (_("%P%X: Internal error on COFF shared library section %s\n"),
  27031. - os->name);
  27032. -
  27033. - input = os->children.head->input_section.section;
  27034. - bfd_set_section_vma (os->bfd_section->owner,
  27035. - os->bfd_section,
  27036. - bfd_section_vma (input->owner, input));
  27037. - os->bfd_section->_raw_size = input->_raw_size;
  27038. - break;
  27039. - }
  27040. -
  27041. - if (bfd_is_abs_section (os->bfd_section))
  27042. - {
  27043. - /* No matter what happens, an abs section starts at zero. */
  27044. - ASSERT (os->bfd_section->vma == 0);
  27045. - }
  27046. - else
  27047. - {
  27048. - if (os->addr_tree == (etree_type *) NULL)
  27049. - {
  27050. - /* No address specified for this section, get one
  27051. - from the region specification. */
  27052. - if (os->region == (lang_memory_region_type *) NULL
  27053. - || (((bfd_get_section_flags (output_bfd, os->bfd_section)
  27054. - & (SEC_ALLOC | SEC_LOAD)) != 0)
  27055. - && os->region->name[0] == '*'
  27056. - && strcmp (os->region->name, "*default*") == 0))
  27057. - {
  27058. - os->region = lang_memory_default (os->bfd_section);
  27059. - }
  27060. -
  27061. - /* If a loadable section is using the default memory
  27062. - region, and some non default memory regions were
  27063. - defined, issue a warning. */
  27064. - if ((bfd_get_section_flags (output_bfd, os->bfd_section)
  27065. - & (SEC_ALLOC | SEC_LOAD)) != 0
  27066. - && ! link_info.relocateable
  27067. - && strcmp (os->region->name, "*default*") == 0
  27068. - && lang_memory_region_list != NULL
  27069. - && (strcmp (lang_memory_region_list->name, "*default*") != 0
  27070. - || lang_memory_region_list->next != NULL))
  27071. - einfo (_("%P: warning: no memory region specified for section `%s'\n"),
  27072. - bfd_get_section_name (output_bfd, os->bfd_section));
  27073. -
  27074. - dot = os->region->current;
  27075. + {
  27076. + case lang_output_section_statement_enum:
  27077. + {
  27078. + bfd_vma after;
  27079. + lang_output_section_statement_type *os = &s->output_section_statement;
  27080. +
  27081. + if (os->bfd_section == NULL)
  27082. + /* This section was never actually created. */
  27083. + break;
  27084. +
  27085. + /* If this is a COFF shared library section, use the size and
  27086. + address from the input section. FIXME: This is COFF
  27087. + specific; it would be cleaner if there were some other way
  27088. + to do this, but nothing simple comes to mind. */
  27089. + if ((os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
  27090. + {
  27091. + asection * input;
  27092. +
  27093. + if (os->children.head == NULL
  27094. + || os->children.head->next != NULL
  27095. + || os->children.head->header.type != lang_input_section_enum)
  27096. + einfo (_("%P%X: Internal error on COFF shared library section %s\n"),
  27097. + os->name);
  27098. +
  27099. + input = os->children.head->input_section.section;
  27100. + bfd_set_section_vma (os->bfd_section->owner,
  27101. + os->bfd_section,
  27102. + bfd_section_vma (input->owner, input));
  27103. + os->bfd_section->_raw_size = input->_raw_size;
  27104. + break;
  27105. + }
  27106. +
  27107. + if (bfd_is_abs_section (os->bfd_section))
  27108. + {
  27109. + /* No matter what happens, an abs section starts at zero. */
  27110. + ASSERT (os->bfd_section->vma == 0);
  27111. + }
  27112. + else
  27113. + {
  27114. + if (os->addr_tree == (etree_type *) NULL)
  27115. + {
  27116. + /* No address specified for this section, get one
  27117. + from the region specification. */
  27118. + if (os->region == (lang_memory_region_type *) NULL
  27119. + || (((bfd_get_section_flags (output_bfd, os->bfd_section)
  27120. + & (SEC_ALLOC | SEC_LOAD)) != 0)
  27121. + && os->region->name[0] == '*'
  27122. + && strcmp (os->region->name, "*default*") == 0))
  27123. + {
  27124. + os->region = lang_memory_default (os->bfd_section);
  27125. + }
  27126. +
  27127. + /* If a loadable section is using the default memory
  27128. + region, and some non default memory regions were
  27129. + defined, issue a warning. */
  27130. + if ((bfd_get_section_flags (output_bfd, os->bfd_section)
  27131. + & (SEC_ALLOC | SEC_LOAD)) != 0
  27132. + && ! link_info.relocateable
  27133. + && strcmp (os->region->name, "*default*") == 0
  27134. + && lang_memory_region_list != NULL
  27135. + && (strcmp (lang_memory_region_list->name, "*default*") != 0
  27136. + || lang_memory_region_list->next != NULL))
  27137. + einfo (_("%P: warning: no memory region specified for section `%s'\n"),
  27138. + bfd_get_section_name (output_bfd, os->bfd_section));
  27139. +
  27140. + dot = os->region->current;
  27141. - if (os->section_alignment == -1)
  27142. - {
  27143. - bfd_vma olddot;
  27144. -
  27145. - olddot = dot;
  27146. - dot = align_power (dot, os->bfd_section->alignment_power);
  27147. -
  27148. - if (dot != olddot && config.warn_section_align)
  27149. - einfo (_("%P: warning: changing start of section %s by %u bytes\n"),
  27150. - os->name, (unsigned int) (dot - olddot));
  27151. - }
  27152. - }
  27153. - else
  27154. - {
  27155. - etree_value_type r;
  27156. -
  27157. - r = exp_fold_tree (os->addr_tree,
  27158. - abs_output_section,
  27159. - lang_allocating_phase_enum,
  27160. - dot, &dot);
  27161. - if (r.valid_p == false)
  27162. - {
  27163. - einfo (_("%F%S: non constant address expression for section %s\n"),
  27164. - os->name);
  27165. - }
  27166. - dot = r.value + r.section->bfd_section->vma;
  27167. - }
  27168. -
  27169. - /* The section starts here.
  27170. - First, align to what the section needs. */
  27171. -
  27172. - if (os->section_alignment != -1)
  27173. - dot = align_power (dot, os->section_alignment);
  27174. -
  27175. - bfd_set_section_vma (0, os->bfd_section, dot);
  27176. -
  27177. - os->bfd_section->output_offset = 0;
  27178. - }
  27179. -
  27180. - (void) lang_size_sections (os->children.head, os, &os->children.head,
  27181. - os->fill, dot, relax);
  27182. -
  27183. + if (os->section_alignment == -1)
  27184. + {
  27185. + bfd_vma olddot;
  27186. +
  27187. + olddot = dot;
  27188. + dot = align_power (dot, os->bfd_section->alignment_power);
  27189. +
  27190. + if (dot != olddot && config.warn_section_align)
  27191. + einfo (_("%P: warning: changing start of section %s by %u bytes\n"),
  27192. + os->name, (unsigned int) (dot - olddot));
  27193. + }
  27194. + }
  27195. + else
  27196. + {
  27197. + etree_value_type r;
  27198. +
  27199. + r = exp_fold_tree (os->addr_tree,
  27200. + abs_output_section,
  27201. + lang_allocating_phase_enum,
  27202. + dot, &dot);
  27203. + if (r.valid_p == false)
  27204. + {
  27205. + einfo (_("%F%S: non constant address expression for section %s\n"),
  27206. + os->name);
  27207. + }
  27208. + dot = r.value + r.section->bfd_section->vma;
  27209. + }
  27210. +
  27211. + /* The section starts here.
  27212. + First, align to what the section needs. */
  27213. +
  27214. + if (os->section_alignment != -1)
  27215. + dot = align_power (dot, os->section_alignment);
  27216. +
  27217. + bfd_set_section_vma (0, os->bfd_section, dot);
  27218. +
  27219. + os->bfd_section->output_offset = 0;
  27220. + }
  27221. +
  27222. + (void) lang_size_sections (os->children.head, os, &os->children.head,
  27223. + os->fill, dot, relax);
  27224. +
  27225. /* put the section within the requested block size, or align at
  27226. the block boundary */
  27227. - after = ALIGN_N (os->bfd_section->vma
  27228. - + os->bfd_section->_raw_size / opb,
  27229. - /* The coercion here is important, see ld.h. */
  27230. - (bfd_vma) os->block_value);
  27231. -
  27232. - if (bfd_is_abs_section (os->bfd_section))
  27233. - ASSERT (after == os->bfd_section->vma);
  27234. - else
  27235. - os->bfd_section->_raw_size =
  27236. + after = ALIGN_N (os->bfd_section->vma
  27237. + + os->bfd_section->_raw_size / opb,
  27238. + /* The coercion here is important, see ld.h. */
  27239. + (bfd_vma) os->block_value);
  27240. +
  27241. + if (bfd_is_abs_section (os->bfd_section))
  27242. + ASSERT (after == os->bfd_section->vma);
  27243. + else
  27244. + os->bfd_section->_raw_size =
  27245. (after - os->bfd_section->vma) * opb;
  27246. - dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
  27247. - os->processed = true;
  27248. -
  27249. - /* Update dot in the region ?
  27250. - We only do this if the section is going to be allocated,
  27251. - since unallocated sections do not contribute to the region's
  27252. - overall size in memory.
  27253. -
  27254. - If the SEC_NEVER_LOAD bit is not set, it will affect the
  27255. - addresses of sections after it. We have to update
  27256. - dot. */
  27257. - if (os->region != (lang_memory_region_type *) NULL
  27258. - && ((bfd_get_section_flags (output_bfd, os->bfd_section)
  27259. - & SEC_NEVER_LOAD) == 0
  27260. - || (bfd_get_section_flags (output_bfd, os->bfd_section)
  27261. - & (SEC_ALLOC | SEC_LOAD))))
  27262. - {
  27263. - os->region->current = dot;
  27264. -
  27265. - /* Make sure the new address is within the region. */
  27266. + dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
  27267. + os->processed = true;
  27268. +
  27269. + /* Update dot in the region ?
  27270. + We only do this if the section is going to be allocated,
  27271. + since unallocated sections do not contribute to the region's
  27272. + overall size in memory.
  27273. +
  27274. + If the SEC_NEVER_LOAD bit is not set, it will affect the
  27275. + addresses of sections after it. We have to update
  27276. + dot. */
  27277. + if (os->region != (lang_memory_region_type *) NULL
  27278. + && ((bfd_get_section_flags (output_bfd, os->bfd_section)
  27279. + & SEC_NEVER_LOAD) == 0
  27280. + || (bfd_get_section_flags (output_bfd, os->bfd_section)
  27281. + & (SEC_ALLOC | SEC_LOAD))))
  27282. + {
  27283. + os->region->current = dot;
  27284. +
  27285. + /* Make sure the new address is within the region. */
  27286. os_region_check (os, os->region, os->addr_tree,
  27287. os->bfd_section->vma);
  27288. @@ -2920,193 +3046,193 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
  27289. }
  27290. }
  27291. }
  27292. - }
  27293. - }
  27294. - break;
  27295. -
  27296. - case lang_constructors_statement_enum:
  27297. - dot = lang_size_sections (constructor_list.head,
  27298. - output_section_statement,
  27299. - &s->wild_statement.children.head,
  27300. - fill,
  27301. - dot, relax);
  27302. - break;
  27303. -
  27304. - case lang_data_statement_enum:
  27305. - {
  27306. - unsigned int size = 0;
  27307. -
  27308. - s->data_statement.output_vma = dot - output_section_statement->bfd_section->vma;
  27309. - s->data_statement.output_section =
  27310. - output_section_statement->bfd_section;
  27311. -
  27312. - switch (s->data_statement.type)
  27313. - {
  27314. + }
  27315. + }
  27316. + break;
  27317. +
  27318. + case lang_constructors_statement_enum:
  27319. + dot = lang_size_sections (constructor_list.head,
  27320. + output_section_statement,
  27321. + &s->wild_statement.children.head,
  27322. + fill,
  27323. + dot, relax);
  27324. + break;
  27325. +
  27326. + case lang_data_statement_enum:
  27327. + {
  27328. + unsigned int size = 0;
  27329. +
  27330. + s->data_statement.output_vma = dot - output_section_statement->bfd_section->vma;
  27331. + s->data_statement.output_section =
  27332. + output_section_statement->bfd_section;
  27333. +
  27334. + switch (s->data_statement.type)
  27335. + {
  27336. default:
  27337. abort();
  27338. - case QUAD:
  27339. - case SQUAD:
  27340. - size = QUAD_SIZE;
  27341. - break;
  27342. - case LONG:
  27343. - size = LONG_SIZE;
  27344. - break;
  27345. - case SHORT:
  27346. - size = SHORT_SIZE;
  27347. - break;
  27348. - case BYTE:
  27349. - size = BYTE_SIZE;
  27350. - break;
  27351. - }
  27352. + case QUAD:
  27353. + case SQUAD:
  27354. + size = QUAD_SIZE;
  27355. + break;
  27356. + case LONG:
  27357. + size = LONG_SIZE;
  27358. + break;
  27359. + case SHORT:
  27360. + size = SHORT_SIZE;
  27361. + break;
  27362. + case BYTE:
  27363. + size = BYTE_SIZE;
  27364. + break;
  27365. + }
  27366. if (size < opb)
  27367. size = opb;
  27368. - dot += size / opb;
  27369. - output_section_statement->bfd_section->_raw_size += size;
  27370. - /* The output section gets contents, and then we inspect for
  27371. - any flags set in the input script which override any ALLOC. */
  27372. - output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS;
  27373. - if (!(output_section_statement->flags & SEC_NEVER_LOAD)) {
  27374. - output_section_statement->bfd_section->flags |= SEC_ALLOC | SEC_LOAD;
  27375. - }
  27376. - }
  27377. - break;
  27378. -
  27379. - case lang_reloc_statement_enum:
  27380. - {
  27381. - int size;
  27382. -
  27383. - s->reloc_statement.output_vma =
  27384. - dot - output_section_statement->bfd_section->vma;
  27385. - s->reloc_statement.output_section =
  27386. - output_section_statement->bfd_section;
  27387. - size = bfd_get_reloc_size (s->reloc_statement.howto);
  27388. - dot += size / opb;
  27389. - output_section_statement->bfd_section->_raw_size += size;
  27390. - }
  27391. - break;
  27392. + dot += size / opb;
  27393. + output_section_statement->bfd_section->_raw_size += size;
  27394. + /* The output section gets contents, and then we inspect for
  27395. + any flags set in the input script which override any ALLOC. */
  27396. + output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS;
  27397. + if (!(output_section_statement->flags & SEC_NEVER_LOAD)) {
  27398. + output_section_statement->bfd_section->flags |= SEC_ALLOC | SEC_LOAD;
  27399. + }
  27400. + }
  27401. + break;
  27402. +
  27403. + case lang_reloc_statement_enum:
  27404. + {
  27405. + int size;
  27406. +
  27407. + s->reloc_statement.output_vma =
  27408. + dot - output_section_statement->bfd_section->vma;
  27409. + s->reloc_statement.output_section =
  27410. + output_section_statement->bfd_section;
  27411. + size = bfd_get_reloc_size (s->reloc_statement.howto);
  27412. + dot += size / opb;
  27413. + output_section_statement->bfd_section->_raw_size += size;
  27414. + }
  27415. + break;
  27416. - case lang_wild_statement_enum:
  27417. -
  27418. - dot = lang_size_sections (s->wild_statement.children.head,
  27419. - output_section_statement,
  27420. - &s->wild_statement.children.head,
  27421. -
  27422. - fill, dot, relax);
  27423. -
  27424. - break;
  27425. -
  27426. - case lang_object_symbols_statement_enum:
  27427. - link_info.create_object_symbols_section =
  27428. - output_section_statement->bfd_section;
  27429. - break;
  27430. - case lang_output_statement_enum:
  27431. - case lang_target_statement_enum:
  27432. - break;
  27433. - case lang_input_section_enum:
  27434. - {
  27435. - asection *i;
  27436. -
  27437. - i = (*prev)->input_section.section;
  27438. - if (! relax)
  27439. - {
  27440. - if (i->_cooked_size == 0)
  27441. - i->_cooked_size = i->_raw_size;
  27442. - }
  27443. - else
  27444. - {
  27445. - boolean again;
  27446. -
  27447. - if (! bfd_relax_section (i->owner, i, &link_info, &again))
  27448. - einfo (_("%P%F: can't relax section: %E\n"));
  27449. - if (again)
  27450. - relax_again = true;
  27451. - }
  27452. - dot = size_input_section (prev,
  27453. - output_section_statement,
  27454. - output_section_statement->fill,
  27455. - dot, relax);
  27456. - }
  27457. - break;
  27458. - case lang_input_statement_enum:
  27459. - break;
  27460. - case lang_fill_statement_enum:
  27461. - s->fill_statement.output_section = output_section_statement->bfd_section;
  27462. -
  27463. - fill = s->fill_statement.fill;
  27464. - break;
  27465. - case lang_assignment_statement_enum:
  27466. - {
  27467. - bfd_vma newdot = dot;
  27468. -
  27469. - exp_fold_tree (s->assignment_statement.exp,
  27470. - output_section_statement,
  27471. - lang_allocating_phase_enum,
  27472. - dot,
  27473. - &newdot);
  27474. -
  27475. - if (newdot != dot)
  27476. - {
  27477. - /* The assignment changed dot. Insert a pad. */
  27478. - if (output_section_statement == abs_output_section)
  27479. - {
  27480. - /* If we don't have an output section, then just adjust
  27481. - the default memory address. */
  27482. - lang_memory_region_lookup ("*default*")->current = newdot;
  27483. - }
  27484. - else if (!relax)
  27485. - {
  27486. - lang_statement_union_type *new =
  27487. - ((lang_statement_union_type *)
  27488. - stat_alloc (sizeof (lang_padding_statement_type)));
  27489. -
  27490. - /* Link into existing chain. */
  27491. - new->header.next = *prev;
  27492. - *prev = new;
  27493. - new->header.type = lang_padding_statement_enum;
  27494. - new->padding_statement.output_section =
  27495. - output_section_statement->bfd_section;
  27496. - new->padding_statement.output_offset =
  27497. - dot - output_section_statement->bfd_section->vma;
  27498. - new->padding_statement.fill = fill;
  27499. - new->padding_statement.size = (newdot - dot) * opb;
  27500. - output_section_statement->bfd_section->_raw_size +=
  27501. - new->padding_statement.size;
  27502. - }
  27503. -
  27504. - dot = newdot;
  27505. - }
  27506. - }
  27507. - break;
  27508. -
  27509. - case lang_padding_statement_enum:
  27510. - /* If we are relaxing, and this is not the first pass, some
  27511. - padding statements may have been inserted during previous
  27512. - passes. We may have to move the padding statement to a new
  27513. - location if dot has a different value at this point in this
  27514. - pass than it did at this point in the previous pass. */
  27515. - s->padding_statement.output_offset =
  27516. - dot - output_section_statement->bfd_section->vma;
  27517. - dot += s->padding_statement.size / opb;
  27518. - output_section_statement->bfd_section->_raw_size +=
  27519. - s->padding_statement.size;
  27520. - break;
  27521. -
  27522. - case lang_group_statement_enum:
  27523. - dot = lang_size_sections (s->group_statement.children.head,
  27524. - output_section_statement,
  27525. - &s->group_statement.children.head,
  27526. - fill, dot, relax);
  27527. - break;
  27528. -
  27529. - default:
  27530. - FAIL ();
  27531. - break;
  27532. -
  27533. - /* This can only get here when relaxing is turned on. */
  27534. -
  27535. - case lang_address_statement_enum:
  27536. - break;
  27537. - }
  27538. + case lang_wild_statement_enum:
  27539. +
  27540. + dot = lang_size_sections (s->wild_statement.children.head,
  27541. + output_section_statement,
  27542. + &s->wild_statement.children.head,
  27543. +
  27544. + fill, dot, relax);
  27545. +
  27546. + break;
  27547. +
  27548. + case lang_object_symbols_statement_enum:
  27549. + link_info.create_object_symbols_section =
  27550. + output_section_statement->bfd_section;
  27551. + break;
  27552. + case lang_output_statement_enum:
  27553. + case lang_target_statement_enum:
  27554. + break;
  27555. + case lang_input_section_enum:
  27556. + {
  27557. + asection *i;
  27558. +
  27559. + i = (*prev)->input_section.section;
  27560. + if (! relax)
  27561. + {
  27562. + if (i->_cooked_size == 0)
  27563. + i->_cooked_size = i->_raw_size;
  27564. + }
  27565. + else
  27566. + {
  27567. + boolean again;
  27568. +
  27569. + if (! bfd_relax_section (i->owner, i, &link_info, &again))
  27570. + einfo (_("%P%F: can't relax section: %E\n"));
  27571. + if (again)
  27572. + relax_again = true;
  27573. + }
  27574. + dot = size_input_section (prev,
  27575. + output_section_statement,
  27576. + output_section_statement->fill,
  27577. + dot, relax);
  27578. + }
  27579. + break;
  27580. + case lang_input_statement_enum:
  27581. + break;
  27582. + case lang_fill_statement_enum:
  27583. + s->fill_statement.output_section = output_section_statement->bfd_section;
  27584. +
  27585. + fill = s->fill_statement.fill;
  27586. + break;
  27587. + case lang_assignment_statement_enum:
  27588. + {
  27589. + bfd_vma newdot = dot;
  27590. +
  27591. + exp_fold_tree (s->assignment_statement.exp,
  27592. + output_section_statement,
  27593. + lang_allocating_phase_enum,
  27594. + dot,
  27595. + &newdot);
  27596. +
  27597. + if (newdot != dot)
  27598. + {
  27599. + /* The assignment changed dot. Insert a pad. */
  27600. + if (output_section_statement == abs_output_section)
  27601. + {
  27602. + /* If we don't have an output section, then just adjust
  27603. + the default memory address. */
  27604. + lang_memory_region_lookup ("*default*")->current = newdot;
  27605. + }
  27606. + else if (!relax)
  27607. + {
  27608. + lang_statement_union_type *new =
  27609. + ((lang_statement_union_type *)
  27610. + stat_alloc (sizeof (lang_padding_statement_type)));
  27611. +
  27612. + /* Link into existing chain. */
  27613. + new->header.next = *prev;
  27614. + *prev = new;
  27615. + new->header.type = lang_padding_statement_enum;
  27616. + new->padding_statement.output_section =
  27617. + output_section_statement->bfd_section;
  27618. + new->padding_statement.output_offset =
  27619. + dot - output_section_statement->bfd_section->vma;
  27620. + new->padding_statement.fill = fill;
  27621. + new->padding_statement.size = (newdot - dot) * opb;
  27622. + output_section_statement->bfd_section->_raw_size +=
  27623. + new->padding_statement.size;
  27624. + }
  27625. +
  27626. + dot = newdot;
  27627. + }
  27628. + }
  27629. + break;
  27630. +
  27631. + case lang_padding_statement_enum:
  27632. + /* If we are relaxing, and this is not the first pass, some
  27633. + padding statements may have been inserted during previous
  27634. + passes. We may have to move the padding statement to a new
  27635. + location if dot has a different value at this point in this
  27636. + pass than it did at this point in the previous pass. */
  27637. + s->padding_statement.output_offset =
  27638. + dot - output_section_statement->bfd_section->vma;
  27639. + dot += s->padding_statement.size / opb;
  27640. + output_section_statement->bfd_section->_raw_size +=
  27641. + s->padding_statement.size;
  27642. + break;
  27643. +
  27644. + case lang_group_statement_enum:
  27645. + dot = lang_size_sections (s->group_statement.children.head,
  27646. + output_section_statement,
  27647. + &s->group_statement.children.head,
  27648. + fill, dot, relax);
  27649. + break;
  27650. +
  27651. + default:
  27652. + FAIL ();
  27653. + break;
  27654. +
  27655. + /* This can only get here when relaxing is turned on. */
  27656. +
  27657. + case lang_address_statement_enum:
  27658. + break;
  27659. + }
  27660. prev = &s->header.next;
  27661. }
  27662. return dot;
  27663. @@ -3120,70 +3246,70 @@ lang_do_assignments (s, output_section_statement, fill, dot)
  27664. bfd_vma dot;
  27665. {
  27666. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  27667. - ldfile_output_machine);
  27668. + ldfile_output_machine);
  27669. for (; s != (lang_statement_union_type *) NULL; s = s->next)
  27670. {
  27671. switch (s->header.type)
  27672. - {
  27673. - case lang_constructors_statement_enum:
  27674. - dot = lang_do_assignments (constructor_list.head,
  27675. - output_section_statement,
  27676. - fill,
  27677. - dot);
  27678. - break;
  27679. -
  27680. - case lang_output_section_statement_enum:
  27681. - {
  27682. - lang_output_section_statement_type *os =
  27683. - &(s->output_section_statement);
  27684. -
  27685. - if (os->bfd_section != NULL)
  27686. - {
  27687. - dot = os->bfd_section->vma;
  27688. - (void) lang_do_assignments (os->children.head, os,
  27689. - os->fill, dot);
  27690. - dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
  27691. -
  27692. - }
  27693. - if (os->load_base)
  27694. - {
  27695. - /* If nothing has been placed into the output section then
  27696. - it won't have a bfd_section. */
  27697. - if (os->bfd_section)
  27698. - {
  27699. - os->bfd_section->lma
  27700. - = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
  27701. - }
  27702. - }
  27703. - }
  27704. - break;
  27705. - case lang_wild_statement_enum:
  27706. -
  27707. - dot = lang_do_assignments (s->wild_statement.children.head,
  27708. - output_section_statement,
  27709. - fill, dot);
  27710. -
  27711. - break;
  27712. -
  27713. - case lang_object_symbols_statement_enum:
  27714. - case lang_output_statement_enum:
  27715. - case lang_target_statement_enum:
  27716. + {
  27717. + case lang_constructors_statement_enum:
  27718. + dot = lang_do_assignments (constructor_list.head,
  27719. + output_section_statement,
  27720. + fill,
  27721. + dot);
  27722. + break;
  27723. +
  27724. + case lang_output_section_statement_enum:
  27725. + {
  27726. + lang_output_section_statement_type *os =
  27727. + &(s->output_section_statement);
  27728. +
  27729. + if (os->bfd_section != NULL)
  27730. + {
  27731. + dot = os->bfd_section->vma;
  27732. + (void) lang_do_assignments (os->children.head, os,
  27733. + os->fill, dot);
  27734. + dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
  27735. +
  27736. + }
  27737. + if (os->load_base)
  27738. + {
  27739. + /* If nothing has been placed into the output section then
  27740. + it won't have a bfd_section. */
  27741. + if (os->bfd_section)
  27742. + {
  27743. + os->bfd_section->lma
  27744. + = exp_get_abs_int(os->load_base, 0,"load base", lang_final_phase_enum);
  27745. + }
  27746. + }
  27747. + }
  27748. + break;
  27749. + case lang_wild_statement_enum:
  27750. +
  27751. + dot = lang_do_assignments (s->wild_statement.children.head,
  27752. + output_section_statement,
  27753. + fill, dot);
  27754. +
  27755. + break;
  27756. +
  27757. + case lang_object_symbols_statement_enum:
  27758. + case lang_output_statement_enum:
  27759. + case lang_target_statement_enum:
  27760. #if 0
  27761. - case lang_common_statement_enum:
  27762. + case lang_common_statement_enum:
  27763. #endif
  27764. - break;
  27765. - case lang_data_statement_enum:
  27766. - {
  27767. - etree_value_type value;
  27768. -
  27769. - value = exp_fold_tree (s->data_statement.exp,
  27770. - abs_output_section,
  27771. - lang_final_phase_enum, dot, &dot);
  27772. - s->data_statement.value = value.value;
  27773. - if (value.valid_p == false)
  27774. - einfo (_("%F%P: invalid data statement\n"));
  27775. - }
  27776. + break;
  27777. + case lang_data_statement_enum:
  27778. + {
  27779. + etree_value_type value;
  27780. +
  27781. + value = exp_fold_tree (s->data_statement.exp,
  27782. + abs_output_section,
  27783. + lang_final_phase_enum, dot, &dot);
  27784. + s->data_statement.value = value.value;
  27785. + if (value.valid_p == false)
  27786. + einfo (_("%F%P: invalid data statement\n"));
  27787. + }
  27788. {
  27789. unsigned int size;
  27790. switch (s->data_statement.type)
  27791. @@ -3208,65 +3334,65 @@ lang_do_assignments (s, output_section_statement, fill, dot)
  27792. size = opb;
  27793. dot += size / opb;
  27794. }
  27795. - break;
  27796. -
  27797. - case lang_reloc_statement_enum:
  27798. - {
  27799. - etree_value_type value;
  27800. -
  27801. - value = exp_fold_tree (s->reloc_statement.addend_exp,
  27802. - abs_output_section,
  27803. - lang_final_phase_enum, dot, &dot);
  27804. - s->reloc_statement.addend_value = value.value;
  27805. - if (value.valid_p == false)
  27806. - einfo (_("%F%P: invalid reloc statement\n"));
  27807. - }
  27808. - dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
  27809. - break;
  27810. -
  27811. - case lang_input_section_enum:
  27812. - {
  27813. - asection *in = s->input_section.section;
  27814. -
  27815. - if (in->_cooked_size != 0)
  27816. - dot += in->_cooked_size / opb;
  27817. - else
  27818. - dot += in->_raw_size / opb;
  27819. - }
  27820. - break;
  27821. -
  27822. - case lang_input_statement_enum:
  27823. - break;
  27824. - case lang_fill_statement_enum:
  27825. - fill = s->fill_statement.fill;
  27826. - break;
  27827. - case lang_assignment_statement_enum:
  27828. - {
  27829. - exp_fold_tree (s->assignment_statement.exp,
  27830. - output_section_statement,
  27831. - lang_final_phase_enum,
  27832. - dot,
  27833. - &dot);
  27834. - }
  27835. -
  27836. - break;
  27837. - case lang_padding_statement_enum:
  27838. - dot += s->padding_statement.size / opb;
  27839. - break;
  27840. -
  27841. - case lang_group_statement_enum:
  27842. - dot = lang_do_assignments (s->group_statement.children.head,
  27843. - output_section_statement,
  27844. - fill, dot);
  27845. -
  27846. - break;
  27847. -
  27848. - default:
  27849. - FAIL ();
  27850. - break;
  27851. - case lang_address_statement_enum:
  27852. - break;
  27853. - }
  27854. + break;
  27855. +
  27856. + case lang_reloc_statement_enum:
  27857. + {
  27858. + etree_value_type value;
  27859. +
  27860. + value = exp_fold_tree (s->reloc_statement.addend_exp,
  27861. + abs_output_section,
  27862. + lang_final_phase_enum, dot, &dot);
  27863. + s->reloc_statement.addend_value = value.value;
  27864. + if (value.valid_p == false)
  27865. + einfo (_("%F%P: invalid reloc statement\n"));
  27866. + }
  27867. + dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb;
  27868. + break;
  27869. +
  27870. + case lang_input_section_enum:
  27871. + {
  27872. + asection *in = s->input_section.section;
  27873. +
  27874. + if (in->_cooked_size != 0)
  27875. + dot += in->_cooked_size / opb;
  27876. + else
  27877. + dot += in->_raw_size / opb;
  27878. + }
  27879. + break;
  27880. +
  27881. + case lang_input_statement_enum:
  27882. + break;
  27883. + case lang_fill_statement_enum:
  27884. + fill = s->fill_statement.fill;
  27885. + break;
  27886. + case lang_assignment_statement_enum:
  27887. + {
  27888. + exp_fold_tree (s->assignment_statement.exp,
  27889. + output_section_statement,
  27890. + lang_final_phase_enum,
  27891. + dot,
  27892. + &dot);
  27893. + }
  27894. +
  27895. + break;
  27896. + case lang_padding_statement_enum:
  27897. + dot += s->padding_statement.size / opb;
  27898. + break;
  27899. +
  27900. + case lang_group_statement_enum:
  27901. + dot = lang_do_assignments (s->group_statement.children.head,
  27902. + output_section_statement,
  27903. + fill, dot);
  27904. +
  27905. + break;
  27906. +
  27907. + default:
  27908. + FAIL ();
  27909. + break;
  27910. + case lang_address_statement_enum:
  27911. + break;
  27912. + }
  27913. }
  27914. return dot;
  27915. @@ -3299,25 +3425,25 @@ lang_set_startof ()
  27916. sprintf (buf, ".startof.%s", secname);
  27917. h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
  27918. if (h != NULL && h->type == bfd_link_hash_undefined)
  27919. - {
  27920. - h->type = bfd_link_hash_defined;
  27921. - h->u.def.value = bfd_get_section_vma (output_bfd, s);
  27922. - h->u.def.section = bfd_abs_section_ptr;
  27923. - }
  27924. + {
  27925. + h->type = bfd_link_hash_defined;
  27926. + h->u.def.value = bfd_get_section_vma (output_bfd, s);
  27927. + h->u.def.section = bfd_abs_section_ptr;
  27928. + }
  27929. sprintf (buf, ".sizeof.%s", secname);
  27930. h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true);
  27931. if (h != NULL && h->type == bfd_link_hash_undefined)
  27932. - {
  27933. + {
  27934. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  27935. - ldfile_output_machine);
  27936. - h->type = bfd_link_hash_defined;
  27937. - if (s->_cooked_size != 0)
  27938. - h->u.def.value = s->_cooked_size / opb;
  27939. - else
  27940. - h->u.def.value = s->_raw_size / opb;
  27941. - h->u.def.section = bfd_abs_section_ptr;
  27942. - }
  27943. + ldfile_output_machine);
  27944. + h->type = bfd_link_hash_defined;
  27945. + if (s->_cooked_size != 0)
  27946. + h->u.def.value = s->_cooked_size / opb;
  27947. + else
  27948. + h->u.def.value = s->_raw_size / opb;
  27949. + h->u.def.section = bfd_abs_section_ptr;
  27950. + }
  27951. free (buf);
  27952. }
  27953. @@ -3337,7 +3463,7 @@ lang_finish ()
  27954. if (entry_symbol == (char *) NULL)
  27955. {
  27956. /* No entry has been specified. Look for start, but don't warn
  27957. - if we don't find it. */
  27958. + if we don't find it. */
  27959. entry_symbol = "start";
  27960. warn = false;
  27961. }
  27962. @@ -3345,17 +3471,17 @@ lang_finish ()
  27963. h = bfd_link_hash_lookup (link_info.hash, entry_symbol, false, false, true);
  27964. if (h != (struct bfd_link_hash_entry *) NULL
  27965. && (h->type == bfd_link_hash_defined
  27966. - || h->type == bfd_link_hash_defweak)
  27967. + || h->type == bfd_link_hash_defweak)
  27968. && h->u.def.section->output_section != NULL)
  27969. {
  27970. bfd_vma val;
  27971. val = (h->u.def.value
  27972. - + bfd_get_section_vma (output_bfd,
  27973. - h->u.def.section->output_section)
  27974. - + h->u.def.section->output_offset);
  27975. + + bfd_get_section_vma (output_bfd,
  27976. + h->u.def.section->output_section)
  27977. + + h->u.def.section->output_offset);
  27978. if (! bfd_set_start_address (output_bfd, val))
  27979. - einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
  27980. + einfo (_("%P%F:%s: can't set start address\n"), entry_symbol);
  27981. }
  27982. else
  27983. {
  27984. @@ -3366,34 +3492,34 @@ lang_finish ()
  27985. number. */
  27986. val = bfd_scan_vma (entry_symbol, &send, 0);
  27987. if (*send == '\0')
  27988. - {
  27989. - if (! bfd_set_start_address (output_bfd, val))
  27990. - einfo (_("%P%F: can't set start address\n"));
  27991. - }
  27992. + {
  27993. + if (! bfd_set_start_address (output_bfd, val))
  27994. + einfo (_("%P%F: can't set start address\n"));
  27995. + }
  27996. else
  27997. - {
  27998. - asection *ts;
  27999. + {
  28000. + asection *ts;
  28001. - /* Can't find the entry symbol, and it's not a number. Use
  28002. - the first address in the text section. */
  28003. - ts = bfd_get_section_by_name (output_bfd, ".text");
  28004. - if (ts != (asection *) NULL)
  28005. - {
  28006. - if (warn)
  28007. - einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
  28008. - entry_symbol, bfd_get_section_vma (output_bfd, ts));
  28009. - if (! bfd_set_start_address (output_bfd,
  28010. - bfd_get_section_vma (output_bfd,
  28011. - ts)))
  28012. - einfo (_("%P%F: can't set start address\n"));
  28013. - }
  28014. - else
  28015. - {
  28016. - if (warn)
  28017. - einfo (_("%P: warning: cannot find entry symbol %s; not setting start address\n"),
  28018. - entry_symbol);
  28019. - }
  28020. - }
  28021. + /* Can't find the entry symbol, and it's not a number. Use
  28022. + the first address in the text section. */
  28023. + ts = bfd_get_section_by_name (output_bfd, ".text");
  28024. + if (ts != (asection *) NULL)
  28025. + {
  28026. + if (warn)
  28027. + einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
  28028. + entry_symbol, bfd_get_section_vma (output_bfd, ts));
  28029. + if (! bfd_set_start_address (output_bfd,
  28030. + bfd_get_section_vma (output_bfd,
  28031. + ts)))
  28032. + einfo (_("%P%F: can't set start address\n"));
  28033. + }
  28034. + else
  28035. + {
  28036. + if (warn)
  28037. + einfo (_("%P: warning: cannot find entry symbol %s; not setting start address\n"),
  28038. + entry_symbol);
  28039. + }
  28040. + }
  28041. }
  28042. }
  28043. @@ -3428,34 +3554,34 @@ lang_check ()
  28044. {
  28045. input_bfd = file->input_statement.the_bfd;
  28046. compatible = bfd_arch_get_compatible (input_bfd,
  28047. - output_bfd);
  28048. + output_bfd);
  28049. if (compatible == NULL)
  28050. - {
  28051. - if (command_line.warn_mismatch)
  28052. - einfo (_("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n"),
  28053. - bfd_printable_name (input_bfd), input_bfd,
  28054. - bfd_printable_name (output_bfd));
  28055. - }
  28056. + {
  28057. + if (command_line.warn_mismatch)
  28058. + einfo (_("%P: warning: %s architecture of input file `%B' is incompatible with %s output\n"),
  28059. + bfd_printable_name (input_bfd), input_bfd,
  28060. + bfd_printable_name (output_bfd));
  28061. + }
  28062. else
  28063. - {
  28064. - bfd_error_handler_type pfn = NULL;
  28065. + {
  28066. + bfd_error_handler_type pfn = NULL;
  28067. - /* If we aren't supposed to warn about mismatched input
  28068. + /* If we aren't supposed to warn about mismatched input
  28069. files, temporarily set the BFD error handler to a
  28070. function which will do nothing. We still want to call
  28071. bfd_merge_private_bfd_data, since it may set up
  28072. information which is needed in the output file. */
  28073. - if (! command_line.warn_mismatch)
  28074. - pfn = bfd_set_error_handler (ignore_bfd_errors);
  28075. - if (! bfd_merge_private_bfd_data (input_bfd, output_bfd))
  28076. - {
  28077. - if (command_line.warn_mismatch)
  28078. - einfo (_("%E%X: failed to merge target specific data of file %B\n"),
  28079. - input_bfd);
  28080. - }
  28081. - if (! command_line.warn_mismatch)
  28082. - bfd_set_error_handler (pfn);
  28083. - }
  28084. + if (! command_line.warn_mismatch)
  28085. + pfn = bfd_set_error_handler (ignore_bfd_errors);
  28086. + if (! bfd_merge_private_bfd_data (input_bfd, output_bfd))
  28087. + {
  28088. + if (command_line.warn_mismatch)
  28089. + einfo (_("%E%X: failed to merge target specific data of file %B\n"),
  28090. + input_bfd);
  28091. + }
  28092. + if (! command_line.warn_mismatch)
  28093. + bfd_set_error_handler (pfn);
  28094. + }
  28095. }
  28096. }
  28097. @@ -3477,8 +3603,8 @@ lang_common ()
  28098. int power;
  28099. for (power = 4; power >= 0; power--)
  28100. - bfd_link_hash_traverse (link_info.hash, lang_one_common,
  28101. - (PTR) &power);
  28102. + bfd_link_hash_traverse (link_info.hash, lang_one_common,
  28103. + (PTR) &power);
  28104. }
  28105. }
  28106. @@ -3493,7 +3619,7 @@ lang_one_common (h, info)
  28107. bfd_vma size;
  28108. asection *section;
  28109. unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
  28110. - ldfile_output_machine);
  28111. + ldfile_output_machine);
  28112. if (h->type != bfd_link_hash_common)
  28113. return true;
  28114. @@ -3509,7 +3635,7 @@ lang_one_common (h, info)
  28115. /* Increase the size of the section. */
  28116. section->_cooked_size = ALIGN_N ((section->_cooked_size + opb - 1) / opb,
  28117. - (bfd_size_type) (1 << power_of_two)) * opb;
  28118. + (bfd_size_type) (1 << power_of_two)) * opb;
  28119. /* Adjust the alignment if necessary. */
  28120. if (power_of_two > section->alignment_power)
  28121. @@ -3536,11 +3662,11 @@ lang_one_common (h, info)
  28122. char buf[50];
  28123. if (! header_printed)
  28124. - {
  28125. - minfo (_("\nAllocating common symbols\n"));
  28126. - minfo (_("Common symbol size file\n\n"));
  28127. - header_printed = true;
  28128. - }
  28129. + {
  28130. + minfo (_("\nAllocating common symbols\n"));
  28131. + minfo (_("Common symbol size file\n\n"));
  28132. + header_printed = true;
  28133. + }
  28134. name = demangle (h->root.string);
  28135. minfo ("%s", name);
  28136. @@ -3548,29 +3674,29 @@ lang_one_common (h, info)
  28137. free (name);
  28138. if (len >= 19)
  28139. - {
  28140. - print_nl ();
  28141. - len = 0;
  28142. - }
  28143. + {
  28144. + print_nl ();
  28145. + len = 0;
  28146. + }
  28147. while (len < 20)
  28148. - {
  28149. - print_space ();
  28150. - ++len;
  28151. - }
  28152. + {
  28153. + print_space ();
  28154. + ++len;
  28155. + }
  28156. minfo ("0x");
  28157. if (size <= 0xffffffff)
  28158. - sprintf (buf, "%lx", (unsigned long) size);
  28159. + sprintf (buf, "%lx", (unsigned long) size);
  28160. else
  28161. - sprintf_vma (buf, size);
  28162. + sprintf_vma (buf, size);
  28163. minfo ("%s", buf);
  28164. len = strlen (buf);
  28165. while (len < 16)
  28166. - {
  28167. - print_space ();
  28168. - ++len;
  28169. - }
  28170. + {
  28171. + print_space ();
  28172. + ++len;
  28173. + }
  28174. minfo ("%B\n", section->owner);
  28175. }
  28176. @@ -3593,57 +3719,57 @@ lang_place_orphans ()
  28177. asection *s;
  28178. for (s = file->the_bfd->sections;
  28179. - s != (asection *) NULL;
  28180. - s = s->next)
  28181. - {
  28182. - if (s->output_section == (asection *) NULL)
  28183. - {
  28184. - /* This section of the file is not attatched, root
  28185. - around for a sensible place for it to go */
  28186. + s != (asection *) NULL;
  28187. + s = s->next)
  28188. + {
  28189. + if (s->output_section == (asection *) NULL)
  28190. + {
  28191. + /* This section of the file is not attatched, root
  28192. + around for a sensible place for it to go */
  28193. - if (file->just_syms_flag)
  28194. - {
  28195. - /* We are only retrieving symbol values from this
  28196. + if (file->just_syms_flag)
  28197. + {
  28198. + /* We are only retrieving symbol values from this
  28199. file. We want the symbols to act as though the
  28200. values in the file are absolute. */
  28201. - s->output_section = bfd_abs_section_ptr;
  28202. - s->output_offset = s->vma;
  28203. - }
  28204. - else if (strcmp (s->name, "COMMON") == 0)
  28205. - {
  28206. - /* This is a lonely common section which must have
  28207. - come from an archive. We attach to the section
  28208. - with the wildcard. */
  28209. - if (! link_info.relocateable
  28210. - || command_line.force_common_definition)
  28211. - {
  28212. - if (default_common_section == NULL)
  28213. - {
  28214. + s->output_section = bfd_abs_section_ptr;
  28215. + s->output_offset = s->vma;
  28216. + }
  28217. + else if (strcmp (s->name, "COMMON") == 0)
  28218. + {
  28219. + /* This is a lonely common section which must have
  28220. + come from an archive. We attach to the section
  28221. + with the wildcard. */
  28222. + if (! link_info.relocateable
  28223. + || command_line.force_common_definition)
  28224. + {
  28225. + if (default_common_section == NULL)
  28226. + {
  28227. #if 0
  28228. - /* This message happens when using the
  28229. + /* This message happens when using the
  28230. svr3.ifile linker script, so I have
  28231. disabled it. */
  28232. - info_msg (_("%P: no [COMMON] command, defaulting to .bss\n"));
  28233. + info_msg (_("%P: no [COMMON] command, defaulting to .bss\n"));
  28234. #endif
  28235. - default_common_section =
  28236. - lang_output_section_statement_lookup (".bss");
  28237. + default_common_section =
  28238. + lang_output_section_statement_lookup (".bss");
  28239. - }
  28240. - wild_doit (&default_common_section->children, s,
  28241. - default_common_section, file);
  28242. - }
  28243. - }
  28244. - else if (ldemul_place_orphan (file, s))
  28245. - ;
  28246. - else
  28247. - {
  28248. - lang_output_section_statement_type *os =
  28249. - lang_output_section_statement_lookup (s->name);
  28250. + }
  28251. + wild_doit (&default_common_section->children, s,
  28252. + default_common_section, file);
  28253. + }
  28254. + }
  28255. + else if (ldemul_place_orphan (file, s))
  28256. + ;
  28257. + else
  28258. + {
  28259. + lang_output_section_statement_type *os =
  28260. + lang_output_section_statement_lookup (s->name);
  28261. - wild_doit (&os->children, s, os, file);
  28262. - }
  28263. - }
  28264. - }
  28265. + wild_doit (&os->children, s, os, file);
  28266. + }
  28267. + }
  28268. + }
  28269. }
  28270. }
  28271. @@ -3660,32 +3786,32 @@ lang_set_flags (ptr, flags, invert)
  28272. while (*flags)
  28273. {
  28274. switch (*flags)
  28275. - {
  28276. - case 'A': case 'a':
  28277. - *ptr_flags |= SEC_ALLOC;
  28278. - break;
  28279. -
  28280. - case 'R': case 'r':
  28281. - *ptr_flags |= SEC_READONLY;
  28282. - break;
  28283. -
  28284. - case 'W': case 'w':
  28285. - *ptr_flags |= SEC_DATA;
  28286. - break;
  28287. -
  28288. - case 'X': case 'x':
  28289. - *ptr_flags |= SEC_CODE;
  28290. - break;
  28291. -
  28292. - case 'L': case 'l':
  28293. - case 'I': case 'i':
  28294. - *ptr_flags |= SEC_LOAD;
  28295. - break;
  28296. -
  28297. - default:
  28298. - einfo (_("%P%F: invalid syntax in flags\n"));
  28299. - break;
  28300. - }
  28301. + {
  28302. + case 'A': case 'a':
  28303. + *ptr_flags |= SEC_ALLOC;
  28304. + break;
  28305. +
  28306. + case 'R': case 'r':
  28307. + *ptr_flags |= SEC_READONLY;
  28308. + break;
  28309. +
  28310. + case 'W': case 'w':
  28311. + *ptr_flags |= SEC_DATA;
  28312. + break;
  28313. +
  28314. + case 'X': case 'x':
  28315. + *ptr_flags |= SEC_CODE;
  28316. + break;
  28317. +
  28318. + case 'L': case 'l':
  28319. + case 'I': case 'i':
  28320. + *ptr_flags |= SEC_LOAD;
  28321. + break;
  28322. +
  28323. + default:
  28324. + einfo (_("%P%F: invalid syntax in flags\n"));
  28325. + break;
  28326. + }
  28327. flags++;
  28328. }
  28329. }
  28330. @@ -3732,11 +3858,11 @@ lang_for_each_input_section (func)
  28331. asection * s;
  28332. for (s = f->the_bfd->sections;
  28333. - s != (asection *) NULL;
  28334. - s = s->next)
  28335. - {
  28336. - func (f->the_bfd, s);
  28337. - }
  28338. + s != (asection *) NULL;
  28339. + s = s->next)
  28340. + {
  28341. + func (f->the_bfd, s);
  28342. + }
  28343. }
  28344. }
  28345. @@ -3749,8 +3875,8 @@ ldlang_add_file (entry)
  28346. bfd **pp;
  28347. lang_statement_append (&file_chain,
  28348. - (lang_statement_union_type *) entry,
  28349. - &entry->next);
  28350. + (lang_statement_union_type *) entry,
  28351. + &entry->next);
  28352. /* The BFD linker needs to have a list of all input BFDs involved in
  28353. a link. */
  28354. @@ -3806,7 +3932,7 @@ topower (x)
  28355. for (l = 0; l < 32; l++)
  28356. {
  28357. if (i >= (unsigned int) x)
  28358. - return l;
  28359. + return l;
  28360. i <<= 1;
  28361. }
  28362. @@ -3815,8 +3941,8 @@ topower (x)
  28363. lang_output_section_statement_type *
  28364. lang_enter_output_section_statement (output_section_statement_name,
  28365. - address_exp, sectype, block_value,
  28366. - align, subalign, ebase)
  28367. + address_exp, sectype, block_value,
  28368. + align, subalign, ebase)
  28369. const char *output_section_statement_name;
  28370. etree_type * address_exp;
  28371. enum section_type sectype;
  28372. @@ -3854,11 +3980,11 @@ lang_enter_output_section_statement (output_section_statement_name,
  28373. os->subsection_alignment = topower(
  28374. exp_get_value_int(subalign, -1,
  28375. - "subsection alignment",
  28376. - 0));
  28377. + "subsection alignment",
  28378. + 0));
  28379. os->section_alignment = topower(
  28380. exp_get_value_int(align, -1,
  28381. - "section alignment", 0));
  28382. + "section alignment", 0));
  28383. os->load_base = ebase;
  28384. return os;
  28385. @@ -3926,24 +4052,24 @@ lang_gc_sections_1 (s)
  28386. for (; s != (lang_statement_union_type *) NULL; s = s->next)
  28387. {
  28388. switch (s->header.type)
  28389. - {
  28390. - case lang_wild_statement_enum:
  28391. - lang_gc_wild (&s->wild_statement,
  28392. - s->wild_statement.section_name,
  28393. - s->wild_statement.filename);
  28394. - break;
  28395. - case lang_constructors_statement_enum:
  28396. - lang_gc_sections_1 (constructor_list.head);
  28397. - break;
  28398. - case lang_output_section_statement_enum:
  28399. - lang_gc_sections_1 (s->output_section_statement.children.head);
  28400. - break;
  28401. - case lang_group_statement_enum:
  28402. - lang_gc_sections_1 (s->group_statement.children.head);
  28403. - break;
  28404. - default:
  28405. - break;
  28406. - }
  28407. + {
  28408. + case lang_wild_statement_enum:
  28409. + lang_gc_wild (&s->wild_statement,
  28410. + s->wild_statement.section_name,
  28411. + s->wild_statement.filename);
  28412. + break;
  28413. + case lang_constructors_statement_enum:
  28414. + lang_gc_sections_1 (constructor_list.head);
  28415. + break;
  28416. + case lang_output_section_statement_enum:
  28417. + lang_gc_sections_1 (s->output_section_statement.children.head);
  28418. + break;
  28419. + case lang_group_statement_enum:
  28420. + lang_gc_sections_1 (s->group_statement.children.head);
  28421. + break;
  28422. + default:
  28423. + break;
  28424. + }
  28425. }
  28426. }
  28427. @@ -3972,15 +4098,15 @@ lang_gc_sections ()
  28428. for (; ulist; ulist = ulist->next)
  28429. {
  28430. h = bfd_link_hash_lookup (link_info.hash, ulist->name,
  28431. - false, false, false);
  28432. + false, false, false);
  28433. if (h != (struct bfd_link_hash_entry *) NULL
  28434. && (h->type == bfd_link_hash_defined
  28435. || h->type == bfd_link_hash_defweak)
  28436. - && ! bfd_is_abs_section (h->u.def.section))
  28437. - {
  28438. - h->u.def.section->flags |= SEC_KEEP;
  28439. - }
  28440. + && ! bfd_is_abs_section (h->u.def.section))
  28441. + {
  28442. + h->u.def.section->flags |= SEC_KEEP;
  28443. + }
  28444. }
  28445. bfd_gc_sections (output_bfd, &link_info);
  28446. @@ -3992,7 +4118,7 @@ lang_process ()
  28447. lang_reasonable_defaults ();
  28448. current_target = default_target;
  28449. - lang_for_each_statement (ldlang_open_output); /* Open the output file */
  28450. + lang_for_each_statement (ldlang_open_output); /* Open the output file */
  28451. ldemul_create_output_section_statements ();
  28452. @@ -4035,7 +4161,7 @@ lang_process ()
  28453. to the correct output sections
  28454. */
  28455. map_input_to_output_sections (statement_list.head, (char *) NULL,
  28456. - (lang_output_section_statement_type *) NULL);
  28457. + (lang_output_section_statement_type *) NULL);
  28458. /* Find any sections not attached explicitly and handle them */
  28459. @@ -4051,42 +4177,42 @@ lang_process ()
  28460. if (command_line.relax)
  28461. {
  28462. /* First time round is a trial run to get the 'worst case'
  28463. - addresses of the objects if there was no relaxing. */
  28464. + addresses of the objects if there was no relaxing. */
  28465. lang_size_sections (statement_list.head,
  28466. - abs_output_section,
  28467. - &(statement_list.head), 0, (bfd_vma) 0, false);
  28468. + abs_output_section,
  28469. + &(statement_list.head), 0, (bfd_vma) 0, false);
  28470. /* Keep relaxing until bfd_relax_section gives up. */
  28471. do
  28472. - {
  28473. - reset_memory_regions ();
  28474. -
  28475. - relax_again = false;
  28476. -
  28477. - /* Note: pe-dll.c does something like this also. If you find
  28478. - you need to change this code, you probably need to change
  28479. - pe-dll.c also. DJ */
  28480. -
  28481. - /* Do all the assignments with our current guesses as to
  28482. - section sizes. */
  28483. - lang_do_assignments (statement_list.head,
  28484. - abs_output_section,
  28485. - (fill_type) 0, (bfd_vma) 0);
  28486. -
  28487. - /* Perform another relax pass - this time we know where the
  28488. - globals are, so can make better guess. */
  28489. - lang_size_sections (statement_list.head,
  28490. - abs_output_section,
  28491. - &(statement_list.head), 0, (bfd_vma) 0, true);
  28492. - }
  28493. + {
  28494. + reset_memory_regions ();
  28495. +
  28496. + relax_again = false;
  28497. +
  28498. + /* Note: pe-dll.c does something like this also. If you find
  28499. + you need to change this code, you probably need to change
  28500. + pe-dll.c also. DJ */
  28501. +
  28502. + /* Do all the assignments with our current guesses as to
  28503. + section sizes. */
  28504. + lang_do_assignments (statement_list.head,
  28505. + abs_output_section,
  28506. + (fill_type) 0, (bfd_vma) 0);
  28507. +
  28508. + /* Perform another relax pass - this time we know where the
  28509. + globals are, so can make better guess. */
  28510. + lang_size_sections (statement_list.head,
  28511. + abs_output_section,
  28512. + &(statement_list.head), 0, (bfd_vma) 0, true);
  28513. + }
  28514. while (relax_again);
  28515. }
  28516. else
  28517. {
  28518. /* Size up the sections. */
  28519. lang_size_sections (statement_list.head,
  28520. - abs_output_section,
  28521. - &(statement_list.head), 0, (bfd_vma) 0, false);
  28522. + abs_output_section,
  28523. + &(statement_list.head), 0, (bfd_vma) 0, false);
  28524. }
  28525. /* See if anything special should be done now we know how big
  28526. @@ -4100,8 +4226,8 @@ lang_process ()
  28527. of all the symbols */
  28528. lang_do_assignments (statement_list.head,
  28529. - abs_output_section,
  28530. - (fill_type) 0, (bfd_vma) 0);
  28531. + abs_output_section,
  28532. + (fill_type) 0, (bfd_vma) 0);
  28533. /* Make sure that the section addresses make sense. */
  28534. if (! link_info.relocateable
  28535. @@ -4118,7 +4244,7 @@ lang_process ()
  28536. void
  28537. lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
  28538. - keep_sections, exclude_filename_list)
  28539. + keep_sections, exclude_filename_list)
  28540. const char *const section_name;
  28541. boolean sections_sorted;
  28542. const char *const filename;
  28543. @@ -4127,7 +4253,7 @@ lang_add_wild (section_name, sections_sorted, filename, filenames_sorted,
  28544. struct name_list *exclude_filename_list;
  28545. {
  28546. lang_wild_statement_type *new = new_stat (lang_wild_statement,
  28547. - stat_ptr);
  28548. + stat_ptr);
  28549. if (section_name != (char *) NULL && strcmp (section_name, "COMMON") == 0)
  28550. {
  28551. @@ -4181,7 +4307,7 @@ lang_add_target (name)
  28552. CONST char *name;
  28553. {
  28554. lang_target_statement_type *new = new_stat (lang_target_statement,
  28555. - stat_ptr);
  28556. + stat_ptr);
  28557. new->target = name;
  28558. @@ -4194,11 +4320,11 @@ lang_add_map (name)
  28559. while (*name)
  28560. {
  28561. switch (*name)
  28562. - {
  28563. - case 'F':
  28564. - map_option_f = true;
  28565. - break;
  28566. - }
  28567. + {
  28568. + case 'F':
  28569. + map_option_f = true;
  28570. + break;
  28571. + }
  28572. name++;
  28573. }
  28574. }
  28575. @@ -4208,7 +4334,7 @@ lang_add_fill (exp)
  28576. int exp;
  28577. {
  28578. lang_fill_statement_type *new = new_stat (lang_fill_statement,
  28579. - stat_ptr);
  28580. + stat_ptr);
  28581. new->fill = exp;
  28582. }
  28583. @@ -4220,7 +4346,7 @@ lang_add_data (type, exp)
  28584. {
  28585. lang_data_statement_type *new = new_stat (lang_data_statement,
  28586. - stat_ptr);
  28587. + stat_ptr);
  28588. new->exp = exp;
  28589. new->type = type;
  28590. @@ -4260,7 +4386,7 @@ lang_add_assignment (exp)
  28591. etree_type * exp;
  28592. {
  28593. lang_assignment_statement_type *new = new_stat (lang_assignment_statement,
  28594. - stat_ptr);
  28595. + stat_ptr);
  28596. new->exp = exp;
  28597. return new;
  28598. @@ -4342,9 +4468,9 @@ lang_abs_symbol_at_beginning_of (secname, name)
  28599. sec = bfd_get_section_by_name (output_bfd, secname);
  28600. if (sec == (asection *) NULL)
  28601. - h->u.def.value = 0;
  28602. + h->u.def.value = 0;
  28603. else
  28604. - h->u.def.value = bfd_get_section_vma (output_bfd, sec);
  28605. + h->u.def.value = bfd_get_section_vma (output_bfd, sec);
  28606. h->u.def.section = bfd_abs_section_ptr;
  28607. }
  28608. @@ -4376,10 +4502,10 @@ lang_abs_symbol_at_end_of (secname, name)
  28609. sec = bfd_get_section_by_name (output_bfd, secname);
  28610. if (sec == (asection *) NULL)
  28611. - h->u.def.value = 0;
  28612. + h->u.def.value = 0;
  28613. else
  28614. - h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
  28615. - + bfd_section_size (output_bfd, sec) /
  28616. + h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
  28617. + + bfd_section_size (output_bfd, sec) /
  28618. bfd_octets_per_byte (output_bfd));
  28619. h->u.def.section = bfd_abs_section_ptr;
  28620. @@ -4408,11 +4534,11 @@ lang_add_output_format (format, big, little, from_script)
  28621. if (output_target == NULL || !from_script)
  28622. {
  28623. if (command_line.endian == ENDIAN_BIG
  28624. - && big != NULL)
  28625. - format = big;
  28626. + && big != NULL)
  28627. + format = big;
  28628. else if (command_line.endian == ENDIAN_LITTLE
  28629. - && little != NULL)
  28630. - format = little;
  28631. + && little != NULL)
  28632. + format = little;
  28633. output_target = format;
  28634. }
  28635. @@ -4460,7 +4586,7 @@ lang_new_phdr (name, type, filehdr, phdrs, at, flags)
  28636. n->next = NULL;
  28637. n->name = name;
  28638. n->type = exp_get_value_int (type, 0, "program header type",
  28639. - lang_final_phase_enum);
  28640. + lang_final_phase_enum);
  28641. n->filehdr = filehdr;
  28642. n->phdrs = phdrs;
  28643. n->at = at;
  28644. @@ -4494,64 +4620,64 @@ lang_record_phdrs ()
  28645. c = 0;
  28646. for (u = lang_output_section_statement.head;
  28647. - u != NULL;
  28648. - u = u->output_section_statement.next)
  28649. - {
  28650. - lang_output_section_statement_type *os;
  28651. - struct lang_output_section_phdr_list *pl;
  28652. -
  28653. - os = &u->output_section_statement;
  28654. -
  28655. - pl = os->phdrs;
  28656. - if (pl != NULL)
  28657. - last = pl;
  28658. - else
  28659. - {
  28660. - if (os->sectype == noload_section
  28661. - || os->bfd_section == NULL
  28662. - || (os->bfd_section->flags & SEC_ALLOC) == 0)
  28663. - continue;
  28664. - pl = last;
  28665. - }
  28666. + u != NULL;
  28667. + u = u->output_section_statement.next)
  28668. + {
  28669. + lang_output_section_statement_type *os;
  28670. + struct lang_output_section_phdr_list *pl;
  28671. - if (os->bfd_section == NULL)
  28672. - continue;
  28673. + os = &u->output_section_statement;
  28674. - for (; pl != NULL; pl = pl->next)
  28675. - {
  28676. - if (strcmp (pl->name, l->name) == 0)
  28677. - {
  28678. - if (c >= alc)
  28679. - {
  28680. - alc *= 2;
  28681. - secs = ((asection **)
  28682. - xrealloc (secs, alc * sizeof (asection *)));
  28683. - }
  28684. - secs[c] = os->bfd_section;
  28685. - ++c;
  28686. - pl->used = true;
  28687. - }
  28688. - }
  28689. - }
  28690. + pl = os->phdrs;
  28691. + if (pl != NULL)
  28692. + last = pl;
  28693. + else
  28694. + {
  28695. + if (os->sectype == noload_section
  28696. + || os->bfd_section == NULL
  28697. + || (os->bfd_section->flags & SEC_ALLOC) == 0)
  28698. + continue;
  28699. + pl = last;
  28700. + }
  28701. +
  28702. + if (os->bfd_section == NULL)
  28703. + continue;
  28704. +
  28705. + for (; pl != NULL; pl = pl->next)
  28706. + {
  28707. + if (strcmp (pl->name, l->name) == 0)
  28708. + {
  28709. + if (c >= alc)
  28710. + {
  28711. + alc *= 2;
  28712. + secs = ((asection **)
  28713. + xrealloc (secs, alc * sizeof (asection *)));
  28714. + }
  28715. + secs[c] = os->bfd_section;
  28716. + ++c;
  28717. + pl->used = true;
  28718. + }
  28719. + }
  28720. + }
  28721. if (l->flags == NULL)
  28722. - flags = 0;
  28723. + flags = 0;
  28724. else
  28725. - flags = exp_get_vma (l->flags, 0, "phdr flags",
  28726. - lang_final_phase_enum);
  28727. + flags = exp_get_vma (l->flags, 0, "phdr flags",
  28728. + lang_final_phase_enum);
  28729. if (l->at == NULL)
  28730. - at = 0;
  28731. + at = 0;
  28732. else
  28733. - at = exp_get_vma (l->at, 0, "phdr load address",
  28734. - lang_final_phase_enum);
  28735. + at = exp_get_vma (l->at, 0, "phdr load address",
  28736. + lang_final_phase_enum);
  28737. if (! bfd_record_phdr (output_bfd, l->type,
  28738. - l->flags == NULL ? false : true,
  28739. - flags,
  28740. - l->at == NULL ? false : true,
  28741. - at, l->filehdr, l->phdrs, c, secs))
  28742. - einfo (_("%F%P: bfd_record_phdr failed: %E\n"));
  28743. + l->flags == NULL ? false : true,
  28744. + flags,
  28745. + l->at == NULL ? false : true,
  28746. + at, l->filehdr, l->phdrs, c, secs))
  28747. + einfo (_("%F%P: bfd_record_phdr failed: %E\n"));
  28748. }
  28749. free (secs);
  28750. @@ -4564,14 +4690,14 @@ lang_record_phdrs ()
  28751. struct lang_output_section_phdr_list *pl;
  28752. if (u->output_section_statement.bfd_section == NULL)
  28753. - continue;
  28754. + continue;
  28755. for (pl = u->output_section_statement.phdrs;
  28756. - pl != NULL;
  28757. - pl = pl->next)
  28758. - if (! pl->used && strcmp (pl->name, "NONE") != 0)
  28759. - einfo (_("%X%P: section `%s' assigned to non-existent phdr `%s'\n"),
  28760. - u->output_section_statement.name, pl->name);
  28761. + pl != NULL;
  28762. + pl = pl->next)
  28763. + if (! pl->used && strcmp (pl->name, "NONE") != 0)
  28764. + einfo (_("%X%P: section `%s' assigned to non-existent phdr `%s'\n"),
  28765. + u->output_section_statement.name, pl->name);
  28766. }
  28767. }
  28768. @@ -4626,9 +4752,9 @@ lang_enter_overlay (vma_expr, lma_expr, nocrossrefs)
  28769. {
  28770. /* The grammar should prevent nested overlays from occurring. */
  28771. ASSERT (overlay_vma == NULL
  28772. - && overlay_lma == NULL
  28773. - && overlay_list == NULL
  28774. - && overlay_max == NULL);
  28775. + && overlay_lma == NULL
  28776. + && overlay_list == NULL
  28777. + && overlay_max == NULL);
  28778. overlay_vma = vma_expr;
  28779. overlay_lma = lma_expr;
  28780. @@ -4646,7 +4772,7 @@ lang_enter_overlay_section (name)
  28781. etree_type *size;
  28782. lang_enter_output_section_statement (name, overlay_vma, normal_section,
  28783. - 0, 0, 0, overlay_lma);
  28784. + 0, 0, 0, overlay_lma);
  28785. /* If this is the first section, then base the VMA and LMA of future
  28786. sections on this one. This will work correctly even if `.' is
  28787. @@ -4705,14 +4831,14 @@ lang_leave_overlay_section (fill, phdrs)
  28788. buf = xmalloc (strlen (clean) + sizeof "__load_start_");
  28789. sprintf (buf, "__load_start_%s", clean);
  28790. lang_add_assignment (exp_assop ('=', buf,
  28791. - exp_nameop (LOADADDR, name)));
  28792. + exp_nameop (LOADADDR, name)));
  28793. buf = xmalloc (strlen (clean) + sizeof "__load_stop_");
  28794. sprintf (buf, "__load_stop_%s", clean);
  28795. lang_add_assignment (exp_assop ('=', buf,
  28796. - exp_binop ('+',
  28797. - exp_nameop (LOADADDR, name),
  28798. - exp_nameop (SIZEOF, name))));
  28799. + exp_binop ('+',
  28800. + exp_nameop (LOADADDR, name),
  28801. + exp_nameop (SIZEOF, name))));
  28802. free (clean);
  28803. }
  28804. @@ -4750,23 +4876,23 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
  28805. struct overlay_list *next;
  28806. if (fill != 0 && l->os->fill == 0)
  28807. - l->os->fill = fill;
  28808. + l->os->fill = fill;
  28809. if (region != NULL && l->os->region == NULL)
  28810. - l->os->region = region;
  28811. + l->os->region = region;
  28812. if (lma_region != NULL && l->os->lma_region == NULL)
  28813. l->os->lma_region = lma_region;
  28814. if (phdrs != NULL && l->os->phdrs == NULL)
  28815. - l->os->phdrs = phdrs;
  28816. + l->os->phdrs = phdrs;
  28817. if (overlay_nocrossrefs)
  28818. - {
  28819. - struct lang_nocrossref *nc;
  28820. + {
  28821. + struct lang_nocrossref *nc;
  28822. - nc = (struct lang_nocrossref *) xmalloc (sizeof *nc);
  28823. - nc->name = l->os->name;
  28824. - nc->next = nocrossref;
  28825. - nocrossref = nc;
  28826. - }
  28827. + nc = (struct lang_nocrossref *) xmalloc (sizeof *nc);
  28828. + nc->name = l->os->name;
  28829. + nc->next = nocrossref;
  28830. + nocrossref = nc;
  28831. + }
  28832. next = l->next;
  28833. free (l);
  28834. @@ -4778,7 +4904,7 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
  28835. /* Update . for the end of the overlay. */
  28836. lang_add_assignment (exp_assop ('=', ".",
  28837. - exp_binop ('+', overlay_vma, overlay_max)));
  28838. + exp_binop ('+', overlay_vma, overlay_max)));
  28839. overlay_vma = NULL;
  28840. overlay_lma = NULL;
  28841. @@ -4818,7 +4944,7 @@ lang_vers_match_lang_cplusplus (expr, sym)
  28842. if (!alt_sym)
  28843. {
  28844. /* cplus_demangle (also) returns NULL when it is not a C++ symbol.
  28845. - Should we early out false in this case? */
  28846. + Should we early out false in this case? */
  28847. result = fnmatch (expr->pattern, sym, 0) == 0;
  28848. }
  28849. else
  28850. @@ -4845,7 +4971,7 @@ lang_vers_match_lang_java (expr, sym)
  28851. if (!alt_sym)
  28852. {
  28853. /* cplus_demangle (also) returns NULL when it is not a Java symbol.
  28854. - Should we early out false in this case? */
  28855. + Should we early out false in this case? */
  28856. result = fnmatch (expr->pattern, sym, 0) == 0;
  28857. }
  28858. else
  28859. @@ -4880,7 +5006,7 @@ lang_new_vers_regex (orig, new, lang)
  28860. else
  28861. {
  28862. einfo (_("%X%P: unknown language `%s' in version information\n"),
  28863. - lang);
  28864. + lang);
  28865. ret->match = lang_vers_match_lang_c;
  28866. }
  28867. @@ -4936,27 +5062,27 @@ lang_register_vers_node (name, version, deps)
  28868. for (e1 = version->globals; e1 != NULL; e1 = e1->next)
  28869. {
  28870. for (t = lang_elf_version_info; t != NULL; t = t->next)
  28871. - {
  28872. - struct bfd_elf_version_expr *e2;
  28873. + {
  28874. + struct bfd_elf_version_expr *e2;
  28875. - for (e2 = t->locals; e2 != NULL; e2 = e2->next)
  28876. - if (strcmp (e1->pattern, e2->pattern) == 0)
  28877. - einfo (_("%X%P: duplicate expression `%s' in version information\n"),
  28878. - e1->pattern);
  28879. - }
  28880. + for (e2 = t->locals; e2 != NULL; e2 = e2->next)
  28881. + if (strcmp (e1->pattern, e2->pattern) == 0)
  28882. + einfo (_("%X%P: duplicate expression `%s' in version information\n"),
  28883. + e1->pattern);
  28884. + }
  28885. }
  28886. for (e1 = version->locals; e1 != NULL; e1 = e1->next)
  28887. {
  28888. for (t = lang_elf_version_info; t != NULL; t = t->next)
  28889. - {
  28890. - struct bfd_elf_version_expr *e2;
  28891. + {
  28892. + struct bfd_elf_version_expr *e2;
  28893. - for (e2 = t->globals; e2 != NULL; e2 = e2->next)
  28894. - if (strcmp (e1->pattern, e2->pattern) == 0)
  28895. - einfo (_("%X%P: duplicate expression `%s' in version information\n"),
  28896. - e1->pattern);
  28897. - }
  28898. + for (e2 = t->globals; e2 != NULL; e2 = e2->next)
  28899. + if (strcmp (e1->pattern, e2->pattern) == 0)
  28900. + einfo (_("%X%P: duplicate expression `%s' in version information\n"),
  28901. + e1->pattern);
  28902. + }
  28903. }
  28904. version->deps = deps;
  28905. @@ -4985,10 +5111,10 @@ lang_add_vers_depend (list, name)
  28906. for (t = lang_elf_version_info; t != NULL; t = t->next)
  28907. {
  28908. if (strcmp (t->name, name) == 0)
  28909. - {
  28910. - ret->version_needed = t;
  28911. - return ret;
  28912. - }
  28913. + {
  28914. + ret->version_needed = t;
  28915. + return ret;
  28916. + }
  28917. }
  28918. einfo (_("%X%P: unable to find version dependency `%s'\n"), name);
  28919. @@ -5013,23 +5139,23 @@ lang_do_version_exports_section ()
  28920. len = bfd_section_size (is->the_bfd, sec);
  28921. contents = xmalloc (len);
  28922. if (!bfd_get_section_contents (is->the_bfd, sec, contents, 0, len))
  28923. - einfo (_("%X%P: unable to read .exports section contents"), sec);
  28924. + einfo (_("%X%P: unable to read .exports section contents"), sec);
  28925. p = contents;
  28926. while (p < contents+len)
  28927. - {
  28928. - greg = lang_new_vers_regex (greg, p, NULL);
  28929. - p = strchr (p, '\0') + 1;
  28930. - }
  28931. + {
  28932. + greg = lang_new_vers_regex (greg, p, NULL);
  28933. + p = strchr (p, '\0') + 1;
  28934. + }
  28935. /* Do not free the contents, as we used them creating the regex. */
  28936. /* Do not include this section in the link. */
  28937. bfd_set_section_flags (is->the_bfd, sec,
  28938. - bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
  28939. + bfd_get_section_flags (is->the_bfd, sec) | SEC_EXCLUDE);
  28940. }
  28941. lreg = lang_new_vers_regex (NULL, "*", NULL);
  28942. lang_register_vers_node (command_line.version_exports_section,
  28943. - lang_new_vers_node (greg, lreg), NULL);
  28944. + lang_new_vers_node (greg, lreg), NULL);
  28945. }
  28946. diff --git a/ld/ldmain.c b/ld/ldmain.c
  28947. index 676eeba..da117b6 100644
  28948. --- a/ld/ldmain.c
  28949. +++ b/ld/ldmain.c
  28950. @@ -41,9 +41,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  28951. #include "ldfile.h"
  28952. #include "ldctor.h"
  28953. +int g_iAdvance = 0; /* add T.Tazaki 2003/05/14 */
  28954. +int g_iPE = 0; /* add T.Tazaki 2003/11/18 */
  28955. +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  28956. +///* add architecture number 2003/05/14 T.Tazaki */
  28957. +//#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processor */
  28958. +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  28959. +
  28960. /* Somewhere above, sys/stat.h got included . . . . */
  28961. #if !defined(S_ISDIR) && defined(S_IFDIR)
  28962. -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  28963. +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  28964. #endif
  28965. #include <string.h>
  28966. @@ -94,41 +101,41 @@ ld_config_type config;
  28967. static void remove_output PARAMS ((void));
  28968. static boolean check_for_scripts_dir PARAMS ((char *dir));
  28969. static boolean add_archive_element PARAMS ((struct bfd_link_info *, bfd *,
  28970. - const char *));
  28971. + const char *));
  28972. static boolean multiple_definition PARAMS ((struct bfd_link_info *,
  28973. - const char *,
  28974. - bfd *, asection *, bfd_vma,
  28975. - bfd *, asection *, bfd_vma));
  28976. + const char *,
  28977. + bfd *, asection *, bfd_vma,
  28978. + bfd *, asection *, bfd_vma));
  28979. static boolean multiple_common PARAMS ((struct bfd_link_info *,
  28980. - const char *, bfd *,
  28981. - enum bfd_link_hash_type, bfd_vma,
  28982. - bfd *, enum bfd_link_hash_type,
  28983. - bfd_vma));
  28984. + const char *, bfd *,
  28985. + enum bfd_link_hash_type, bfd_vma,
  28986. + bfd *, enum bfd_link_hash_type,
  28987. + bfd_vma));
  28988. static boolean add_to_set PARAMS ((struct bfd_link_info *,
  28989. - struct bfd_link_hash_entry *,
  28990. - bfd_reloc_code_real_type,
  28991. - bfd *, asection *, bfd_vma));
  28992. + struct bfd_link_hash_entry *,
  28993. + bfd_reloc_code_real_type,
  28994. + bfd *, asection *, bfd_vma));
  28995. static boolean constructor_callback PARAMS ((struct bfd_link_info *,
  28996. - boolean constructor,
  28997. - const char *name,
  28998. - bfd *, asection *, bfd_vma));
  28999. + boolean constructor,
  29000. + const char *name,
  29001. + bfd *, asection *, bfd_vma));
  29002. static boolean warning_callback PARAMS ((struct bfd_link_info *,
  29003. - const char *, const char *, bfd *,
  29004. - asection *, bfd_vma));
  29005. + const char *, const char *, bfd *,
  29006. + asection *, bfd_vma));
  29007. static void warning_find_reloc PARAMS ((bfd *, asection *, PTR));
  29008. static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
  29009. - const char *, bfd *,
  29010. - asection *, bfd_vma, boolean));
  29011. + const char *, bfd *,
  29012. + asection *, bfd_vma, boolean));
  29013. static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
  29014. - const char *, bfd_vma,
  29015. - bfd *, asection *, bfd_vma));
  29016. + const char *, bfd_vma,
  29017. + bfd *, asection *, bfd_vma));
  29018. static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *,
  29019. - bfd *, asection *, bfd_vma));
  29020. + bfd *, asection *, bfd_vma));
  29021. static boolean unattached_reloc PARAMS ((struct bfd_link_info *,
  29022. - const char *, bfd *, asection *,
  29023. - bfd_vma));
  29024. + const char *, bfd *, asection *,
  29025. + bfd_vma));
  29026. static boolean notice PARAMS ((struct bfd_link_info *, const char *,
  29027. - bfd *, asection *, bfd_vma));
  29028. + bfd *, asection *, bfd_vma));
  29029. static struct bfd_link_callbacks link_callbacks =
  29030. {
  29031. @@ -153,9 +160,9 @@ remove_output ()
  29032. if (output_filename)
  29033. {
  29034. if (output_bfd && output_bfd->iostream)
  29035. - fclose((FILE *)(output_bfd->iostream));
  29036. + fclose((FILE *)(output_bfd->iostream));
  29037. if (delete_output_file_on_failure)
  29038. - unlink (output_filename);
  29039. + unlink (output_filename);
  29040. }
  29041. }
  29042. @@ -166,6 +173,9 @@ main (argc, argv)
  29043. {
  29044. char *emulation;
  29045. long start_time = get_run_time ();
  29046. +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29047. +// FILE *fpOut; /* ELF file write file pointer add T.Tazaki 2003/05/14 */
  29048. +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29049. #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
  29050. setlocale (LC_MESSAGES, "");
  29051. @@ -258,13 +268,13 @@ main (argc, argv)
  29052. if (link_info.relocateable)
  29053. {
  29054. if (command_line.gc_sections)
  29055. - einfo ("%P%F: --gc-sections and -r may not be used together\n");
  29056. + einfo ("%P%F: --gc-sections and -r may not be used together\n");
  29057. if (link_info.mpc860c0)
  29058. - einfo (_("%P%F: -r and --mpc860c0 may not be used together\n"));
  29059. + einfo (_("%P%F: -r and --mpc860c0 may not be used together\n"));
  29060. else if (command_line.relax)
  29061. - einfo (_("%P%F: --relax and -r may not be used together\n"));
  29062. + einfo (_("%P%F: --relax and -r may not be used together\n"));
  29063. if (link_info.shared)
  29064. - einfo (_("%P%F: -r and -shared may not be used together\n"));
  29065. + einfo (_("%P%F: -r and -shared may not be used together\n"));
  29066. }
  29067. /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
  29068. @@ -274,7 +284,7 @@ main (argc, argv)
  29069. {
  29070. link_info.strip = strip_debugger;
  29071. if (link_info.discard == discard_none)
  29072. - link_info.discard = discard_all;
  29073. + link_info.discard = discard_all;
  29074. }
  29075. /* This essentially adds another -L directory so this must be done after
  29076. @@ -288,19 +298,19 @@ main (argc, argv)
  29077. char *s = ldemul_get_script (&isfile);
  29078. if (isfile)
  29079. - ldfile_open_command_file (s);
  29080. + ldfile_open_command_file (s);
  29081. else
  29082. - {
  29083. - if (trace_file_tries)
  29084. - {
  29085. - info_msg (_("using internal linker script:\n"));
  29086. - info_msg ("==================================================\n");
  29087. - info_msg (s);
  29088. - info_msg ("\n==================================================\n");
  29089. - }
  29090. - lex_string = s;
  29091. - lex_redirect (s);
  29092. - }
  29093. + {
  29094. + if (trace_file_tries)
  29095. + {
  29096. + info_msg (_("using internal linker script:\n"));
  29097. + info_msg ("==================================================\n");
  29098. + info_msg (s);
  29099. + info_msg ("\n==================================================\n");
  29100. + }
  29101. + lex_string = s;
  29102. + lex_redirect (s);
  29103. + }
  29104. parser_input = input_script;
  29105. yyparse ();
  29106. lex_string = NULL;
  29107. @@ -311,7 +321,7 @@ main (argc, argv)
  29108. if (lang_has_input_file == false)
  29109. {
  29110. if (version_printed)
  29111. - xexit (0);
  29112. + xexit (0);
  29113. einfo (_("%P%F: no input files\n"));
  29114. }
  29115. @@ -326,19 +336,19 @@ main (argc, argv)
  29116. if (config.map_filename)
  29117. {
  29118. if (strcmp (config.map_filename, "-") == 0)
  29119. - {
  29120. - config.map_file = stdout;
  29121. - }
  29122. + {
  29123. + config.map_file = stdout;
  29124. + }
  29125. else
  29126. - {
  29127. - config.map_file = fopen (config.map_filename, FOPEN_WT);
  29128. - if (config.map_file == (FILE *) NULL)
  29129. - {
  29130. - bfd_set_error (bfd_error_system_call);
  29131. - einfo (_("%P%F: cannot open map file %s: %E\n"),
  29132. - config.map_filename);
  29133. - }
  29134. - }
  29135. + {
  29136. + config.map_file = fopen (config.map_filename, FOPEN_WT);
  29137. + if (config.map_file == (FILE *) NULL)
  29138. + {
  29139. + bfd_set_error (bfd_error_system_call);
  29140. + einfo (_("%P%F: cannot open map file %s: %E\n"),
  29141. + config.map_filename);
  29142. + }
  29143. + }
  29144. }
  29145. @@ -354,9 +364,9 @@ main (argc, argv)
  29146. asection *found = bfd_get_section_by_name (output_bfd, ".text");
  29147. if (found != (asection *) NULL)
  29148. - {
  29149. - found->flags |= SEC_READONLY;
  29150. - }
  29151. + {
  29152. + found->flags |= SEC_READONLY;
  29153. + }
  29154. }
  29155. if (link_info.relocateable)
  29156. @@ -366,12 +376,17 @@ main (argc, argv)
  29157. ldwrite ();
  29158. +/* del T.Tazaki 2003/06/24 >>> : Map file output after bfd close.
  29159. + : symbol with underbar modify */
  29160. +//#if 0 /* add T.Tazaki 2003/11/19 bug fix */
  29161. if (config.map_file != NULL)
  29162. lang_map ();
  29163. if (command_line.cref)
  29164. output_cref (config.map_file != NULL ? config.map_file : stdout);
  29165. if (nocrossref_list != NULL)
  29166. check_nocrossrefs ();
  29167. +//#endif
  29168. +/* del T.Tazaki 2003/06/24 <<< */
  29169. /* Even if we're producing relocateable output, some non-fatal errors should
  29170. be reported in the exit status. (What non-fatal errors, if any, do we
  29171. @@ -380,10 +395,10 @@ main (argc, argv)
  29172. if (config.make_executable == false && force_make_executable == false)
  29173. {
  29174. if (trace_files == true)
  29175. - {
  29176. - einfo (_("%P: link errors found, deleting executable `%s'\n"),
  29177. - output_filename);
  29178. - }
  29179. + {
  29180. + einfo (_("%P: link errors found, deleting executable `%s'\n"),
  29181. + output_filename);
  29182. + }
  29183. /* The file will be removed by remove_output. */
  29184. @@ -392,50 +407,98 @@ main (argc, argv)
  29185. else
  29186. {
  29187. if (! bfd_close (output_bfd))
  29188. - einfo (_("%F%B: final close failed: %E\n"), output_bfd);
  29189. + einfo (_("%F%B: final close failed: %E\n"), output_bfd);
  29190. +
  29191. +/* add T.Tazaki 2003/06/24 >>> : Map file output after bfd close.
  29192. + : symbol with underbar modify */
  29193. +#if 0 /* del T.Tazaki 2003/11/19 bug fix */
  29194. + if (config.map_file != NULL)
  29195. + lang_map ();
  29196. + if (command_line.cref)
  29197. + output_cref (config.map_file != NULL ? config.map_file : stdout);
  29198. + if (nocrossref_list != NULL)
  29199. + check_nocrossrefs ();
  29200. +#endif
  29201. +/* add T.Tazaki 2003/06/24 <<< */
  29202. +
  29203. +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29204. +///* add T.Tazaki 2003/05/14 >>> */
  29205. +// fpOut = fopen( output_filename,"r+b" );
  29206. +// if( fpOut != NULL )
  29207. +// {
  29208. +// /* e_machine number set */
  29209. +// fseek( fpOut, 18, SEEK_SET );
  29210. +// fputc( EM_SE_C33, fpOut );
  29211. +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29212. +
  29213. +/* >>>>> DELETED D.Fujimoto 2007/10/01 macro flag output moved to bfd/elf32-c33.c */
  29214. +// /* Advanced macro mode ? */
  29215. +// if( g_iAdvance == 1 )
  29216. +// {
  29217. +// /* ELF header : e_flags bit31-28=CPU flag set */
  29218. +// /* flag = 0x0 : Standard macro */
  29219. +// /* flag = 'A' : Advanced macro */
  29220. +// /* flag = 'P' : PE macro */
  29221. +// fseek( fpOut, 39, SEEK_SET );
  29222. +// fputc( 'A', fpOut );
  29223. +// }
  29224. +// else if ( g_iPE == 1 ) /* add T.Tazaki 2003/11/18 */
  29225. +// {
  29226. +// fseek( fpOut, 39, SEEK_SET );
  29227. +// fputc( 'P', fpOut );
  29228. +// }
  29229. +/* <<<<< DELETED D.Fujimoto 2007/10/01 macro flag output moved to bfd/elf32-c33.c */
  29230. +
  29231. +/* >>>>> DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29232. +// fclose( fpOut );
  29233. +// }
  29234. +//
  29235. +///* add T.Tazaki 2003/05/14 <<< */
  29236. +/* <<<<< DELETED D.Fujimoto 2007/10/15 e_machine set in elf.c */
  29237. +
  29238. /* If the --force-exe-suffix is enabled, and we're making an
  29239. - executable file and it doesn't end in .exe, copy it to one which does. */
  29240. + executable file and it doesn't end in .exe, copy it to one which does. */
  29241. if (! link_info.relocateable && command_line.force_exe_suffix)
  29242. - {
  29243. - int len = strlen (output_filename);
  29244. - if (len < 4
  29245. - || (strcasecmp (output_filename + len - 4, ".exe") != 0
  29246. - && strcasecmp (output_filename + len - 4, ".dll") != 0))
  29247. - {
  29248. - FILE *src;
  29249. - FILE *dst;
  29250. - const int bsize = 4096;
  29251. - char *buf = xmalloc (bsize);
  29252. - int l;
  29253. - char *dst_name = xmalloc (len + 5);
  29254. - strcpy (dst_name, output_filename);
  29255. - strcat (dst_name, ".exe");
  29256. - src = fopen (output_filename, FOPEN_RB);
  29257. - dst = fopen (dst_name, FOPEN_WB);
  29258. -
  29259. - if (!src)
  29260. - einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
  29261. - if (!dst)
  29262. - einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
  29263. - while ((l = fread (buf, 1, bsize, src)) > 0)
  29264. - {
  29265. - int done = fwrite (buf, 1, l, dst);
  29266. - if (done != l)
  29267. - {
  29268. - einfo (_("%P: Error writing file `%s'\n"), dst_name);
  29269. - }
  29270. - }
  29271. - fclose (src);
  29272. - if (fclose (dst) == EOF)
  29273. - {
  29274. - einfo (_("%P: Error closing file `%s'\n"), dst_name);
  29275. - }
  29276. - free (dst_name);
  29277. - free (buf);
  29278. - }
  29279. - }
  29280. + {
  29281. + int len = strlen (output_filename);
  29282. + if (len < 4
  29283. + || (strcasecmp (output_filename + len - 4, ".exe") != 0
  29284. + && strcasecmp (output_filename + len - 4, ".dll") != 0))
  29285. + {
  29286. + FILE *src;
  29287. + FILE *dst;
  29288. + const int bsize = 4096;
  29289. + char *buf = xmalloc (bsize);
  29290. + int l;
  29291. + char *dst_name = xmalloc (len + 5);
  29292. + strcpy (dst_name, output_filename);
  29293. + strcat (dst_name, ".exe");
  29294. + src = fopen (output_filename, FOPEN_RB);
  29295. + dst = fopen (dst_name, FOPEN_WB);
  29296. +
  29297. + if (!src)
  29298. + einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
  29299. + if (!dst)
  29300. + einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
  29301. + while ((l = fread (buf, 1, bsize, src)) > 0)
  29302. + {
  29303. + int done = fwrite (buf, 1, l, dst);
  29304. + if (done != l)
  29305. + {
  29306. + einfo (_("%P: Error writing file `%s'\n"), dst_name);
  29307. + }
  29308. + }
  29309. + fclose (src);
  29310. + if (fclose (dst) == EOF)
  29311. + {
  29312. + einfo (_("%P: Error closing file `%s'\n"), dst_name);
  29313. + }
  29314. + free (dst_name);
  29315. + free (buf);
  29316. + }
  29317. + }
  29318. }
  29319. END_PROGRESS (program_name);
  29320. @@ -448,10 +511,10 @@ main (argc, argv)
  29321. long run_time = get_run_time () - start_time;
  29322. fprintf (stderr, _("%s: total time in link: %ld.%06ld\n"),
  29323. - program_name, run_time / 1000000, run_time % 1000000);
  29324. + program_name, run_time / 1000000, run_time % 1000000);
  29325. #ifdef HAVE_SBRK
  29326. fprintf (stderr, _("%s: data size %ld\n"), program_name,
  29327. - (long) (lim - (char *) &environ));
  29328. + (long) (lim - (char *) &environ));
  29329. #endif
  29330. }
  29331. @@ -480,45 +543,45 @@ get_emulation (argc, argv)
  29332. for (i = 1; i < argc; i++)
  29333. {
  29334. if (!strncmp (argv[i], "-m", 2))
  29335. - {
  29336. - if (argv[i][2] == '\0')
  29337. - {
  29338. - /* -m EMUL */
  29339. - if (i < argc - 1)
  29340. - {
  29341. - emulation = argv[i + 1];
  29342. - i++;
  29343. - }
  29344. - else
  29345. - {
  29346. - einfo(_("%P%F: missing argument to -m\n"));
  29347. - }
  29348. - }
  29349. - else if (strcmp (argv[i], "-mips1") == 0
  29350. - || strcmp (argv[i], "-mips2") == 0
  29351. - || strcmp (argv[i], "-mips3") == 0
  29352. - || strcmp (argv[i], "-mips4") == 0)
  29353. - {
  29354. - /* FIXME: The arguments -mips1, -mips2 and -mips3 are
  29355. - passed to the linker by some MIPS compilers. They
  29356. - generally tell the linker to use a slightly different
  29357. - library path. Perhaps someday these should be
  29358. - implemented as emulations; until then, we just ignore
  29359. - the arguments and hope that nobody ever creates
  29360. - emulations named ips1, ips2 or ips3. */
  29361. - }
  29362. - else if (strcmp (argv[i], "-m486") == 0)
  29363. - {
  29364. - /* FIXME: The argument -m486 is passed to the linker on
  29365. - some Linux systems. Hope that nobody creates an
  29366. - emulation named 486. */
  29367. - }
  29368. - else
  29369. - {
  29370. - /* -mEMUL */
  29371. - emulation = &argv[i][2];
  29372. - }
  29373. - }
  29374. + {
  29375. + if (argv[i][2] == '\0')
  29376. + {
  29377. + /* -m EMUL */
  29378. + if (i < argc - 1)
  29379. + {
  29380. + emulation = argv[i + 1];
  29381. + i++;
  29382. + }
  29383. + else
  29384. + {
  29385. + einfo(_("%P%F: missing argument to -m\n"));
  29386. + }
  29387. + }
  29388. + else if (strcmp (argv[i], "-mips1") == 0
  29389. + || strcmp (argv[i], "-mips2") == 0
  29390. + || strcmp (argv[i], "-mips3") == 0
  29391. + || strcmp (argv[i], "-mips4") == 0)
  29392. + {
  29393. + /* FIXME: The arguments -mips1, -mips2 and -mips3 are
  29394. + passed to the linker by some MIPS compilers. They
  29395. + generally tell the linker to use a slightly different
  29396. + library path. Perhaps someday these should be
  29397. + implemented as emulations; until then, we just ignore
  29398. + the arguments and hope that nobody ever creates
  29399. + emulations named ips1, ips2 or ips3. */
  29400. + }
  29401. + else if (strcmp (argv[i], "-m486") == 0)
  29402. + {
  29403. + /* FIXME: The argument -m486 is passed to the linker on
  29404. + some Linux systems. Hope that nobody creates an
  29405. + emulation named 486. */
  29406. + }
  29407. + else
  29408. + {
  29409. + /* -mEMUL */
  29410. + emulation = &argv[i][2];
  29411. + }
  29412. + }
  29413. }
  29414. return emulation;
  29415. @@ -564,7 +627,7 @@ set_scripts_dir ()
  29416. size_t dirlen;
  29417. if (check_for_scripts_dir (SCRIPTDIR))
  29418. - return; /* We've been installed normally. */
  29419. + return; /* We've been installed normally. */
  29420. /* Look for "ldscripts" in the dir where our binary is. */
  29421. end = strrchr (program_name, '/');
  29422. @@ -592,14 +655,14 @@ set_scripts_dir ()
  29423. dir[dirlen] = '\0';
  29424. if (check_for_scripts_dir (dir))
  29425. - return; /* Don't free dir. */
  29426. + return; /* Don't free dir. */
  29427. /* Look for "ldscripts" in <the dir where our binary is>/../lib. */
  29428. strcpy (dir + dirlen, "/../lib");
  29429. if (check_for_scripts_dir (dir))
  29430. return;
  29431. - free (dir); /* Well, we tried. */
  29432. + free (dir); /* Well, we tried. */
  29433. }
  29434. void
  29435. @@ -609,11 +672,11 @@ add_ysym (name)
  29436. if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
  29437. {
  29438. link_info.notice_hash = ((struct bfd_hash_table *)
  29439. - xmalloc (sizeof (struct bfd_hash_table)));
  29440. + xmalloc (sizeof (struct bfd_hash_table)));
  29441. if (! bfd_hash_table_init_n (link_info.notice_hash,
  29442. - bfd_hash_newfunc,
  29443. - 61))
  29444. - einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
  29445. + bfd_hash_newfunc,
  29446. + 61))
  29447. + einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
  29448. }
  29449. if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
  29450. @@ -630,11 +693,11 @@ add_wrap (name)
  29451. if (link_info.wrap_hash == NULL)
  29452. {
  29453. link_info.wrap_hash = ((struct bfd_hash_table *)
  29454. - xmalloc (sizeof (struct bfd_hash_table)));
  29455. + xmalloc (sizeof (struct bfd_hash_table)));
  29456. if (! bfd_hash_table_init_n (link_info.wrap_hash,
  29457. - bfd_hash_newfunc,
  29458. - 61))
  29459. - einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
  29460. + bfd_hash_newfunc,
  29461. + 61))
  29462. + einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
  29463. }
  29464. if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL)
  29465. einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
  29466. @@ -663,7 +726,7 @@ add_keepsyms_file (filename)
  29467. }
  29468. link_info.keep_hash = ((struct bfd_hash_table *)
  29469. - xmalloc (sizeof (struct bfd_hash_table)));
  29470. + xmalloc (sizeof (struct bfd_hash_table)));
  29471. if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
  29472. einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
  29473. @@ -674,30 +737,30 @@ add_keepsyms_file (filename)
  29474. while (c != EOF)
  29475. {
  29476. while (isspace (c))
  29477. - c = getc (file);
  29478. + c = getc (file);
  29479. if (c != EOF)
  29480. - {
  29481. - size_t len = 0;
  29482. -
  29483. - while (! isspace (c) && c != EOF)
  29484. - {
  29485. - buf[len] = c;
  29486. - ++len;
  29487. - if (len >= bufsize)
  29488. - {
  29489. - bufsize *= 2;
  29490. - buf = xrealloc (buf, bufsize);
  29491. - }
  29492. - c = getc (file);
  29493. - }
  29494. -
  29495. - buf[len] = '\0';
  29496. -
  29497. - if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
  29498. - == (struct bfd_hash_entry *) NULL)
  29499. - einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
  29500. - }
  29501. + {
  29502. + size_t len = 0;
  29503. +
  29504. + while (! isspace (c) && c != EOF)
  29505. + {
  29506. + buf[len] = c;
  29507. + ++len;
  29508. + if (len >= bufsize)
  29509. + {
  29510. + bufsize *= 2;
  29511. + buf = xrealloc (buf, bufsize);
  29512. + }
  29513. + c = getc (file);
  29514. + }
  29515. +
  29516. + buf[len] = '\0';
  29517. +
  29518. + if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
  29519. + == (struct bfd_hash_entry *) NULL)
  29520. + einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
  29521. + }
  29522. }
  29523. if (link_info.strip != strip_none)
  29524. @@ -721,7 +784,7 @@ add_archive_element (info, abfd, name)
  29525. lang_input_statement_type *input;
  29526. input = ((lang_input_statement_type *)
  29527. - xmalloc (sizeof (lang_input_statement_type)));
  29528. + xmalloc (sizeof (lang_input_statement_type)));
  29529. input->filename = abfd->filename;
  29530. input->local_sym_name = abfd->filename;
  29531. input->the_bfd = abfd;
  29532. @@ -749,72 +812,72 @@ add_archive_element (info, abfd, name)
  29533. h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);
  29534. if (h == NULL)
  29535. - from = NULL;
  29536. + from = NULL;
  29537. else
  29538. - {
  29539. - switch (h->type)
  29540. - {
  29541. - default:
  29542. - from = NULL;
  29543. - break;
  29544. -
  29545. - case bfd_link_hash_defined:
  29546. - case bfd_link_hash_defweak:
  29547. - from = h->u.def.section->owner;
  29548. - break;
  29549. -
  29550. - case bfd_link_hash_undefined:
  29551. - case bfd_link_hash_undefweak:
  29552. - from = h->u.undef.abfd;
  29553. - break;
  29554. -
  29555. - case bfd_link_hash_common:
  29556. - from = h->u.c.p->section->owner;
  29557. - break;
  29558. - }
  29559. - }
  29560. + {
  29561. + switch (h->type)
  29562. + {
  29563. + default:
  29564. + from = NULL;
  29565. + break;
  29566. +
  29567. + case bfd_link_hash_defined:
  29568. + case bfd_link_hash_defweak:
  29569. + from = h->u.def.section->owner;
  29570. + break;
  29571. +
  29572. + case bfd_link_hash_undefined:
  29573. + case bfd_link_hash_undefweak:
  29574. + from = h->u.undef.abfd;
  29575. + break;
  29576. +
  29577. + case bfd_link_hash_common:
  29578. + from = h->u.c.p->section->owner;
  29579. + break;
  29580. + }
  29581. + }
  29582. if (! header_printed)
  29583. - {
  29584. - char buf[100];
  29585. + {
  29586. + char buf[100];
  29587. - sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
  29588. - _("because of file (symbol)"));
  29589. - minfo ("%s", buf);
  29590. - header_printed = true;
  29591. - }
  29592. + sprintf (buf, "%-29s %s\n\n", _("Archive member included"),
  29593. + _("because of file (symbol)"));
  29594. + minfo ("%s", buf);
  29595. + header_printed = true;
  29596. + }
  29597. if (bfd_my_archive (abfd) == NULL)
  29598. - {
  29599. - minfo ("%s", bfd_get_filename (abfd));
  29600. - len = strlen (bfd_get_filename (abfd));
  29601. - }
  29602. + {
  29603. + minfo ("%s", bfd_get_filename (abfd));
  29604. + len = strlen (bfd_get_filename (abfd));
  29605. + }
  29606. else
  29607. - {
  29608. - minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)),
  29609. - bfd_get_filename (abfd));
  29610. - len = (strlen (bfd_get_filename (bfd_my_archive (abfd)))
  29611. - + strlen (bfd_get_filename (abfd))
  29612. - + 2);
  29613. - }
  29614. + {
  29615. + minfo ("%s(%s)", bfd_get_filename (bfd_my_archive (abfd)),
  29616. + bfd_get_filename (abfd));
  29617. + len = (strlen (bfd_get_filename (bfd_my_archive (abfd)))
  29618. + + strlen (bfd_get_filename (abfd))
  29619. + + 2);
  29620. + }
  29621. if (len >= 29)
  29622. - {
  29623. - print_nl ();
  29624. - len = 0;
  29625. - }
  29626. + {
  29627. + print_nl ();
  29628. + len = 0;
  29629. + }
  29630. while (len < 30)
  29631. - {
  29632. - print_space ();
  29633. - ++len;
  29634. - }
  29635. + {
  29636. + print_space ();
  29637. + ++len;
  29638. + }
  29639. if (from != NULL)
  29640. - minfo ("%B ", from);
  29641. + minfo ("%B ", from);
  29642. if (h != NULL)
  29643. - minfo ("(%T)\n", h->root.string);
  29644. + minfo ("(%T)\n", h->root.string);
  29645. else
  29646. - minfo ("(%s)\n", name);
  29647. + minfo ("(%s)\n", name);
  29648. }
  29649. if (trace_files || trace_file_tries)
  29650. @@ -847,15 +910,21 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
  29651. && ! bfd_is_abs_section (osec)
  29652. && bfd_is_abs_section (osec->output_section))
  29653. || (nsec->output_section != NULL
  29654. - && ! bfd_is_abs_section (nsec)
  29655. - && bfd_is_abs_section (nsec->output_section)))
  29656. + && ! bfd_is_abs_section (nsec)
  29657. + && bfd_is_abs_section (nsec->output_section)))
  29658. return true;
  29659. +/* delete 2002.07.01 T.Tazaki mutiple difinition error */
  29660. +#if 0
  29661. +
  29662. einfo (_("%X%C: multiple definition of `%T'\n"),
  29663. - nbfd, nsec, nval, name);
  29664. + nbfd, nsec, nval, name);
  29665. if (obfd != (bfd *) NULL)
  29666. einfo (_("%D: first defined here\n"), obfd, osec, oval);
  29667. +
  29668. +#endif
  29669. return true;
  29670. +
  29671. }
  29672. /* This is called when there is a definition of a common symbol, or
  29673. @@ -884,43 +953,43 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
  29674. {
  29675. ASSERT (otype == bfd_link_hash_common);
  29676. einfo (_("%B: warning: definition of `%T' overriding common\n"),
  29677. - nbfd, name);
  29678. + nbfd, name);
  29679. if (obfd != NULL)
  29680. - einfo (_("%B: warning: common is here\n"), obfd);
  29681. + einfo (_("%B: warning: common is here\n"), obfd);
  29682. }
  29683. else if (otype == bfd_link_hash_defined
  29684. - || otype == bfd_link_hash_defweak
  29685. - || otype == bfd_link_hash_indirect)
  29686. + || otype == bfd_link_hash_defweak
  29687. + || otype == bfd_link_hash_indirect)
  29688. {
  29689. ASSERT (ntype == bfd_link_hash_common);
  29690. einfo (_("%B: warning: common of `%T' overridden by definition\n"),
  29691. - nbfd, name);
  29692. + nbfd, name);
  29693. if (obfd != NULL)
  29694. - einfo (_("%B: warning: defined here\n"), obfd);
  29695. + einfo (_("%B: warning: defined here\n"), obfd);
  29696. }
  29697. else
  29698. {
  29699. ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common);
  29700. if (osize > nsize)
  29701. - {
  29702. - einfo (_("%B: warning: common of `%T' overridden by larger common\n"),
  29703. - nbfd, name);
  29704. - if (obfd != NULL)
  29705. - einfo (_("%B: warning: larger common is here\n"), obfd);
  29706. - }
  29707. + {
  29708. + einfo (_("%B: warning: common of `%T' overridden by larger common\n"),
  29709. + nbfd, name);
  29710. + if (obfd != NULL)
  29711. + einfo (_("%B: warning: larger common is here\n"), obfd);
  29712. + }
  29713. else if (nsize > osize)
  29714. - {
  29715. - einfo (_("%B: warning: common of `%T' overriding smaller common\n"),
  29716. - nbfd, name);
  29717. - if (obfd != NULL)
  29718. - einfo (_("%B: warning: smaller common is here\n"), obfd);
  29719. - }
  29720. + {
  29721. + einfo (_("%B: warning: common of `%T' overriding smaller common\n"),
  29722. + nbfd, name);
  29723. + if (obfd != NULL)
  29724. + einfo (_("%B: warning: smaller common is here\n"), obfd);
  29725. + }
  29726. else
  29727. - {
  29728. - einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name);
  29729. - if (obfd != NULL)
  29730. - einfo (_("%B: warning: previous common is here\n"), obfd);
  29731. - }
  29732. + {
  29733. + einfo (_("%B: warning: multiple common of `%T'\n"), nbfd, name);
  29734. + if (obfd != NULL)
  29735. + einfo (_("%B: warning: previous common is here\n"), obfd);
  29736. + }
  29737. }
  29738. return true;
  29739. @@ -942,7 +1011,7 @@ add_to_set (info, h, reloc, abfd, section, value)
  29740. {
  29741. if (config.warn_constructors)
  29742. einfo (_("%P: warning: global constructor %s used\n"),
  29743. - h->root.string);
  29744. + h->root.string);
  29745. if (! config.build_constructors)
  29746. return true;
  29747. @@ -954,8 +1023,8 @@ add_to_set (info, h, reloc, abfd, section, value)
  29748. h->type = bfd_link_hash_undefined;
  29749. h->u.undef.abfd = abfd;
  29750. /* We don't call bfd_link_add_undef to add this to the list of
  29751. - undefined symbols because we are going to define it
  29752. - ourselves. */
  29753. + undefined symbols because we are going to define it
  29754. + ourselves. */
  29755. }
  29756. return true;
  29757. @@ -989,7 +1058,7 @@ constructor_callback (info, constructor, name, abfd, section, value)
  29758. useful error message. */
  29759. if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL
  29760. && (link_info.relocateable
  29761. - || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
  29762. + || bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
  29763. einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
  29764. s = set_name;
  29765. @@ -1008,8 +1077,8 @@ constructor_callback (info, constructor, name, abfd, section, value)
  29766. h->type = bfd_link_hash_undefined;
  29767. h->u.undef.abfd = abfd;
  29768. /* We don't call bfd_link_add_undef to add this to the list of
  29769. - undefined symbols because we are going to define it
  29770. - ourselves. */
  29771. + undefined symbols because we are going to define it
  29772. + ourselves. */
  29773. }
  29774. ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value);
  29775. @@ -1058,29 +1127,29 @@ warning_callback (info, warning, symbol, abfd, section, address)
  29776. struct warning_callback_info info;
  29777. /* Look through the relocs to see if we can find a plausible
  29778. - address. */
  29779. + address. */
  29780. entry = (lang_input_statement_type *) abfd->usrdata;
  29781. if (entry != NULL && entry->asymbols != NULL)
  29782. - asymbols = entry->asymbols;
  29783. + asymbols = entry->asymbols;
  29784. else
  29785. - {
  29786. - long symsize;
  29787. - long symbol_count;
  29788. -
  29789. - symsize = bfd_get_symtab_upper_bound (abfd);
  29790. - if (symsize < 0)
  29791. - einfo (_("%B%F: could not read symbols: %E\n"), abfd);
  29792. - asymbols = (asymbol **) xmalloc (symsize);
  29793. - symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
  29794. - if (symbol_count < 0)
  29795. - einfo (_("%B%F: could not read symbols: %E\n"), abfd);
  29796. - if (entry != NULL)
  29797. - {
  29798. - entry->asymbols = asymbols;
  29799. - entry->symbol_count = symbol_count;
  29800. - }
  29801. - }
  29802. + {
  29803. + long symsize;
  29804. + long symbol_count;
  29805. +
  29806. + symsize = bfd_get_symtab_upper_bound (abfd);
  29807. + if (symsize < 0)
  29808. + einfo (_("%B%F: could not read symbols: %E\n"), abfd);
  29809. + asymbols = (asymbol **) xmalloc (symsize);
  29810. + symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
  29811. + if (symbol_count < 0)
  29812. + einfo (_("%B%F: could not read symbols: %E\n"), abfd);
  29813. + if (entry != NULL)
  29814. + {
  29815. + entry->asymbols = asymbols;
  29816. + entry->symbol_count = symbol_count;
  29817. + }
  29818. + }
  29819. info.found = false;
  29820. info.warning = warning;
  29821. @@ -1089,10 +1158,10 @@ warning_callback (info, warning, symbol, abfd, section, address)
  29822. bfd_map_over_sections (abfd, warning_find_reloc, (PTR) &info);
  29823. if (! info.found)
  29824. - einfo ("%B: %s\n", abfd, warning);
  29825. + einfo ("%B: %s\n", abfd, warning);
  29826. if (entry == NULL)
  29827. - free (asymbols);
  29828. + free (asymbols);
  29829. }
  29830. return true;
  29831. @@ -1136,14 +1205,14 @@ warning_find_reloc (abfd, sec, iarg)
  29832. arelent *q = *p;
  29833. if (q->sym_ptr_ptr != NULL
  29834. - && *q->sym_ptr_ptr != NULL
  29835. - && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
  29836. - {
  29837. - /* We found a reloc for the symbol we are looking for. */
  29838. - einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
  29839. - info->found = true;
  29840. - break;
  29841. - }
  29842. + && *q->sym_ptr_ptr != NULL
  29843. + && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
  29844. + {
  29845. + /* We found a reloc for the symbol we are looking for. */
  29846. + einfo ("%C: %s\n", abfd, sec, q->address, info->warning);
  29847. + info->found = true;
  29848. + break;
  29849. + }
  29850. }
  29851. free (relpp);
  29852. @@ -1173,18 +1242,18 @@ undefined_symbol (info, name, abfd, section, address, fatal)
  29853. /* Only warn once about a particular undefined symbol. */
  29854. if (hash == NULL)
  29855. - {
  29856. - hash = ((struct bfd_hash_table *)
  29857. - xmalloc (sizeof (struct bfd_hash_table)));
  29858. - if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
  29859. - einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
  29860. - }
  29861. + {
  29862. + hash = ((struct bfd_hash_table *)
  29863. + xmalloc (sizeof (struct bfd_hash_table)));
  29864. + if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
  29865. + einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
  29866. + }
  29867. if (bfd_hash_lookup (hash, name, false, false) != NULL)
  29868. - return true;
  29869. + return true;
  29870. if (bfd_hash_lookup (hash, name, true, true) == NULL)
  29871. - einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
  29872. + einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
  29873. }
  29874. /* We never print more than a reasonable number of errors in a row
  29875. @@ -1196,35 +1265,35 @@ undefined_symbol (info, name, abfd, section, address, fatal)
  29876. {
  29877. error_count = 0;
  29878. if (error_name != (char *) NULL)
  29879. - free (error_name);
  29880. + free (error_name);
  29881. error_name = buystring (name);
  29882. }
  29883. if (section != NULL)
  29884. {
  29885. if (error_count < MAX_ERRORS_IN_A_ROW)
  29886. - {
  29887. - einfo (_("%C: undefined reference to `%T'\n"),
  29888. - abfd, section, address, name);
  29889. - if (fatal)
  29890. - einfo ("%X");
  29891. - }
  29892. + {
  29893. + einfo (_("%C: undefined reference to `%T'\n"),
  29894. + abfd, section, address, name);
  29895. + if (fatal)
  29896. + einfo ("%X");
  29897. + }
  29898. else if (error_count == MAX_ERRORS_IN_A_ROW)
  29899. - einfo (_("%D: more undefined references to `%T' follow\n"),
  29900. - abfd, section, address, name);
  29901. + einfo (_("%D: more undefined references to `%T' follow\n"),
  29902. + abfd, section, address, name);
  29903. }
  29904. else
  29905. {
  29906. if (error_count < MAX_ERRORS_IN_A_ROW)
  29907. - {
  29908. - einfo (_("%B: undefined reference to `%T'\n"),
  29909. - abfd, name);
  29910. - if (fatal)
  29911. - einfo ("%X");
  29912. - }
  29913. + {
  29914. + einfo (_("%B: undefined reference to `%T'\n"),
  29915. + abfd, name);
  29916. + if (fatal)
  29917. + einfo ("%X");
  29918. + }
  29919. else if (error_count == MAX_ERRORS_IN_A_ROW)
  29920. - einfo (_("%B: more undefined references to `%T' follow\n"),
  29921. - abfd, name);
  29922. + einfo (_("%B: more undefined references to `%T' follow\n"),
  29923. + abfd, name);
  29924. }
  29925. return true;
  29926. @@ -1307,12 +1376,12 @@ notice (info, name, abfd, section, value)
  29927. {
  29928. if (! info->notice_all
  29929. || (info->notice_hash != NULL
  29930. - && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
  29931. + && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))
  29932. {
  29933. if (bfd_is_und_section (section))
  29934. - einfo ("%B: reference to %s\n", abfd, name);
  29935. + einfo ("%B: reference to %s\n", abfd, name);
  29936. else
  29937. - einfo ("%B: definition of %s\n", abfd, name);
  29938. + einfo ("%B: definition of %s\n", abfd, name);
  29939. }
  29940. if (command_line.cref || nocrossref_list != NULL)
  29941. diff --git a/ld/ldver.c b/ld/ldver.c
  29942. index 5b600a2..aaef41b 100644
  29943. --- a/ld/ldver.c
  29944. +++ b/ld/ldver.c
  29945. @@ -26,14 +26,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  29946. #include "ldemul.h"
  29947. #include "ldmain.h"
  29948. +#define C33_LD_REVISION "2.15 <2008/05/22>"
  29949. +
  29950. const char *ld_program_version = VERSION;
  29951. void
  29952. ldversion (noisy)
  29953. int noisy;
  29954. {
  29955. +/* change T.Tazaki 2002.01.31 >>> */
  29956. +/*
  29957. fprintf (stdout, _("GNU ld version %s (with BFD %s)\n"),
  29958. - ld_program_version, BFD_VERSION);
  29959. + ld_program_version, BFD_VERSION);
  29960. +*/
  29961. + fprintf (stdout, _("GNU ld version %s (with BFD %s) (rev %s)\n"),
  29962. + ld_program_version, BFD_VERSION, C33_LD_REVISION );
  29963. +/* change T.Tazaki 2002.01.31 <<< */
  29964. if (noisy)
  29965. {
  29966. @@ -41,9 +49,9 @@ ldversion (noisy)
  29967. printf (_(" Supported emulations:\n"));
  29968. while (*ptr)
  29969. - {
  29970. - printf (" %s\n", (*ptr)->emulation_name);
  29971. - ptr++;
  29972. - }
  29973. + {
  29974. + printf (" %s\n", (*ptr)->emulation_name);
  29975. + ptr++;
  29976. + }
  29977. }
  29978. }
  29979. diff --git a/ld/lexsup.c b/ld/lexsup.c
  29980. index e2aac47..c46ba36 100644
  29981. --- a/ld/lexsup.c
  29982. +++ b/ld/lexsup.c
  29983. @@ -48,7 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  29984. /* Somewhere above, sys/stat.h got included . . . . */
  29985. #if !defined(S_ISDIR) && defined(S_IFDIR)
  29986. -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  29987. +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  29988. #endif
  29989. /* Omit args to avoid the possibility of clashing with a system header
  29990. @@ -66,61 +66,61 @@ int parsing_defsym = 0;
  29991. /* Codes used for the long options with no short synonyms. 150 isn't
  29992. special; it's just an arbitrary non-ASCII char value. */
  29993. -#define OPTION_ASSERT 150
  29994. -#define OPTION_CALL_SHARED (OPTION_ASSERT + 1)
  29995. -#define OPTION_CREF (OPTION_CALL_SHARED + 1)
  29996. -#define OPTION_DEFSYM (OPTION_CREF + 1)
  29997. -#define OPTION_DEMANGLE (OPTION_DEFSYM + 1)
  29998. -#define OPTION_DYNAMIC_LINKER (OPTION_DEMANGLE + 1)
  29999. -#define OPTION_EB (OPTION_DYNAMIC_LINKER + 1)
  30000. -#define OPTION_EL (OPTION_EB + 1)
  30001. -#define OPTION_EMBEDDED_RELOCS (OPTION_EL + 1)
  30002. -#define OPTION_EXPORT_DYNAMIC (OPTION_EMBEDDED_RELOCS + 1)
  30003. -#define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1)
  30004. -#define OPTION_IGNORE (OPTION_HELP + 1)
  30005. -#define OPTION_MAP (OPTION_IGNORE + 1)
  30006. -#define OPTION_NO_DEMANGLE (OPTION_MAP + 1)
  30007. -#define OPTION_NO_KEEP_MEMORY (OPTION_NO_DEMANGLE + 1)
  30008. -#define OPTION_NO_WARN_MISMATCH (OPTION_NO_KEEP_MEMORY + 1)
  30009. -#define OPTION_NOINHIBIT_EXEC (OPTION_NO_WARN_MISMATCH + 1)
  30010. -#define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1)
  30011. -#define OPTION_NO_WHOLE_ARCHIVE (OPTION_NON_SHARED + 1)
  30012. -#define OPTION_OFORMAT (OPTION_NO_WHOLE_ARCHIVE + 1)
  30013. -#define OPTION_RELAX (OPTION_OFORMAT + 1)
  30014. -#define OPTION_RETAIN_SYMBOLS_FILE (OPTION_RELAX + 1)
  30015. -#define OPTION_RPATH (OPTION_RETAIN_SYMBOLS_FILE + 1)
  30016. -#define OPTION_RPATH_LINK (OPTION_RPATH + 1)
  30017. -#define OPTION_SHARED (OPTION_RPATH_LINK + 1)
  30018. -#define OPTION_SONAME (OPTION_SHARED + 1)
  30019. -#define OPTION_SORT_COMMON (OPTION_SONAME + 1)
  30020. -#define OPTION_STATS (OPTION_SORT_COMMON + 1)
  30021. -#define OPTION_SYMBOLIC (OPTION_STATS + 1)
  30022. -#define OPTION_TASK_LINK (OPTION_SYMBOLIC + 1)
  30023. -#define OPTION_TBSS (OPTION_TASK_LINK + 1)
  30024. -#define OPTION_TDATA (OPTION_TBSS + 1)
  30025. -#define OPTION_TTEXT (OPTION_TDATA + 1)
  30026. -#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
  30027. -#define OPTION_UR (OPTION_TRADITIONAL_FORMAT + 1)
  30028. -#define OPTION_VERBOSE (OPTION_UR + 1)
  30029. -#define OPTION_VERSION (OPTION_VERBOSE + 1)
  30030. -#define OPTION_VERSION_SCRIPT (OPTION_VERSION + 1)
  30031. -#define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
  30032. -#define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1)
  30033. -#define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1)
  30034. -#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1)
  30035. -#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
  30036. -#define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1)
  30037. -#define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
  30038. -#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
  30039. -#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
  30040. -#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
  30041. -#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
  30042. -#define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
  30043. -#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
  30044. -#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
  30045. -#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
  30046. +#define OPTION_ASSERT 150
  30047. +#define OPTION_CALL_SHARED (OPTION_ASSERT + 1)
  30048. +#define OPTION_CREF (OPTION_CALL_SHARED + 1)
  30049. +#define OPTION_DEFSYM (OPTION_CREF + 1)
  30050. +#define OPTION_DEMANGLE (OPTION_DEFSYM + 1)
  30051. +#define OPTION_DYNAMIC_LINKER (OPTION_DEMANGLE + 1)
  30052. +#define OPTION_EB (OPTION_DYNAMIC_LINKER + 1)
  30053. +#define OPTION_EL (OPTION_EB + 1)
  30054. +#define OPTION_EMBEDDED_RELOCS (OPTION_EL + 1)
  30055. +#define OPTION_EXPORT_DYNAMIC (OPTION_EMBEDDED_RELOCS + 1)
  30056. +#define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1)
  30057. +#define OPTION_IGNORE (OPTION_HELP + 1)
  30058. +#define OPTION_MAP (OPTION_IGNORE + 1)
  30059. +#define OPTION_NO_DEMANGLE (OPTION_MAP + 1)
  30060. +#define OPTION_NO_KEEP_MEMORY (OPTION_NO_DEMANGLE + 1)
  30061. +#define OPTION_NO_WARN_MISMATCH (OPTION_NO_KEEP_MEMORY + 1)
  30062. +#define OPTION_NOINHIBIT_EXEC (OPTION_NO_WARN_MISMATCH + 1)
  30063. +#define OPTION_NON_SHARED (OPTION_NOINHIBIT_EXEC + 1)
  30064. +#define OPTION_NO_WHOLE_ARCHIVE (OPTION_NON_SHARED + 1)
  30065. +#define OPTION_OFORMAT (OPTION_NO_WHOLE_ARCHIVE + 1)
  30066. +#define OPTION_RELAX (OPTION_OFORMAT + 1)
  30067. +#define OPTION_RETAIN_SYMBOLS_FILE (OPTION_RELAX + 1)
  30068. +#define OPTION_RPATH (OPTION_RETAIN_SYMBOLS_FILE + 1)
  30069. +#define OPTION_RPATH_LINK (OPTION_RPATH + 1)
  30070. +#define OPTION_SHARED (OPTION_RPATH_LINK + 1)
  30071. +#define OPTION_SONAME (OPTION_SHARED + 1)
  30072. +#define OPTION_SORT_COMMON (OPTION_SONAME + 1)
  30073. +#define OPTION_STATS (OPTION_SORT_COMMON + 1)
  30074. +#define OPTION_SYMBOLIC (OPTION_STATS + 1)
  30075. +#define OPTION_TASK_LINK (OPTION_SYMBOLIC + 1)
  30076. +#define OPTION_TBSS (OPTION_TASK_LINK + 1)
  30077. +#define OPTION_TDATA (OPTION_TBSS + 1)
  30078. +#define OPTION_TTEXT (OPTION_TDATA + 1)
  30079. +#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
  30080. +#define OPTION_UR (OPTION_TRADITIONAL_FORMAT + 1)
  30081. +#define OPTION_VERBOSE (OPTION_UR + 1)
  30082. +#define OPTION_VERSION (OPTION_VERBOSE + 1)
  30083. +#define OPTION_VERSION_SCRIPT (OPTION_VERSION + 1)
  30084. +#define OPTION_VERSION_EXPORTS_SECTION (OPTION_VERSION_SCRIPT + 1)
  30085. +#define OPTION_WARN_COMMON (OPTION_VERSION_EXPORTS_SECTION + 1)
  30086. +#define OPTION_WARN_CONSTRUCTORS (OPTION_WARN_COMMON + 1)
  30087. +#define OPTION_WARN_MULTIPLE_GP (OPTION_WARN_CONSTRUCTORS + 1)
  30088. +#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
  30089. +#define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1)
  30090. +#define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
  30091. +#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
  30092. +#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
  30093. +#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
  30094. +#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
  30095. +#define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
  30096. +#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
  30097. +#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
  30098. +#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
  30099. #define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
  30100. -#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
  30101. +#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
  30102. #define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
  30103. #define OPTION_FINI (OPTION_INIT + 1)
  30104. @@ -387,10 +387,10 @@ is_num (string, min, max, err)
  30105. for (; *string; ++string)
  30106. {
  30107. if (! isdigit (*string))
  30108. - {
  30109. - result = err;
  30110. - break;
  30111. - }
  30112. + {
  30113. + result = err;
  30114. + break;
  30115. + }
  30116. result = result * 10 + (*string - '0');
  30117. }
  30118. if (result < min || result > max)
  30119. @@ -411,6 +411,11 @@ parse_args (argc, argv)
  30120. struct option longopts[OPTION_COUNT + 1];
  30121. int last_optind;
  30122. + FILE *fpIn; /* Object file read file pointer add T.Tazaki 2003/05/14 */
  30123. + unsigned char ucFlag; /* add T.Tazaki 2003/05/14 */
  30124. + extern int g_iAdvance; /* add T.Tazaki 2003/05/14 */
  30125. + extern int g_iPE; /* add T.Tazaki 2003/11/18 */
  30126. +
  30127. /* Starting the short option string with '-' is for programs that
  30128. expect options and other ARGV-elements in any order and that care about
  30129. the ordering of the two. We describe each non-option ARGV-element
  30130. @@ -421,26 +426,26 @@ parse_args (argc, argv)
  30131. for (i = 0; i < OPTION_COUNT; i++)
  30132. {
  30133. if (ld_options[i].shortopt != '\0')
  30134. - {
  30135. - shortopts[is] = ld_options[i].shortopt;
  30136. - ++is;
  30137. - if (ld_options[i].opt.has_arg == required_argument
  30138. - || ld_options[i].opt.has_arg == optional_argument)
  30139. - {
  30140. - shortopts[is] = ':';
  30141. - ++is;
  30142. - if (ld_options[i].opt.has_arg == optional_argument)
  30143. - {
  30144. - shortopts[is] = ':';
  30145. - ++is;
  30146. - }
  30147. - }
  30148. - }
  30149. + {
  30150. + shortopts[is] = ld_options[i].shortopt;
  30151. + ++is;
  30152. + if (ld_options[i].opt.has_arg == required_argument
  30153. + || ld_options[i].opt.has_arg == optional_argument)
  30154. + {
  30155. + shortopts[is] = ':';
  30156. + ++is;
  30157. + if (ld_options[i].opt.has_arg == optional_argument)
  30158. + {
  30159. + shortopts[is] = ':';
  30160. + ++is;
  30161. + }
  30162. + }
  30163. + }
  30164. if (ld_options[i].opt.name != NULL)
  30165. - {
  30166. - longopts[il] = ld_options[i].opt;
  30167. - ++il;
  30168. - }
  30169. + {
  30170. + longopts[il] = ld_options[i].opt;
  30171. + ++il;
  30172. + }
  30173. }
  30174. shortopts[is] = '\0';
  30175. longopts[il].name = NULL;
  30176. @@ -458,8 +463,8 @@ parse_args (argc, argv)
  30177. This will work for most normal cases. */
  30178. for (i = 1; i < argc; i++)
  30179. if (strcmp (argv[i], "-G") == 0
  30180. - && (i + 1 >= argc
  30181. - || ! isdigit ((unsigned char) argv[i + 1][0])))
  30182. + && (i + 1 >= argc
  30183. + || ! isdigit ((unsigned char) argv[i + 1][0])))
  30184. argv[i] = (char *) "--shared";
  30185. /* Because we permit long options to start with a single dash, and
  30186. @@ -477,15 +482,15 @@ parse_args (argc, argv)
  30187. for (i = 1; i < argc; i++)
  30188. {
  30189. if (argv[i][0] == '-'
  30190. - && argv[i][1] == 'l'
  30191. - && argv[i][2] != '\0')
  30192. - {
  30193. - char *n;
  30194. -
  30195. - n = (char *) xmalloc (strlen (argv[i]) + 20);
  30196. - sprintf (n, "--library=%s", argv[i] + 2);
  30197. - argv[i] = n;
  30198. - }
  30199. + && argv[i][1] == 'l'
  30200. + && argv[i][2] != '\0')
  30201. + {
  30202. + char *n;
  30203. +
  30204. + n = (char *) xmalloc (strlen (argv[i]) + 20);
  30205. + sprintf (n, "--library=%s", argv[i] + 2);
  30206. + argv[i] = n;
  30207. + }
  30208. }
  30209. last_optind = -1;
  30210. @@ -495,498 +500,532 @@ parse_args (argc, argv)
  30211. int optc;
  30212. /* Using last_optind lets us avoid calling ldemul_parse_args
  30213. - multiple times on a single option, which would lead to
  30214. - confusion in the internal static variables maintained by
  30215. - getopt. This could otherwise happen for an argument like
  30216. - -nx, in which the -n is parsed as a single option, and we
  30217. - loop around to pick up the -x. */
  30218. + multiple times on a single option, which would lead to
  30219. + confusion in the internal static variables maintained by
  30220. + getopt. This could otherwise happen for an argument like
  30221. + -nx, in which the -n is parsed as a single option, and we
  30222. + loop around to pick up the -x. */
  30223. if (optind != last_optind)
  30224. - {
  30225. - if (ldemul_parse_args (argc, argv))
  30226. - continue;
  30227. - last_optind = optind;
  30228. - }
  30229. + {
  30230. + if (ldemul_parse_args (argc, argv))
  30231. + continue;
  30232. + last_optind = optind;
  30233. + }
  30234. /* getopt_long_only is like getopt_long, but '-' as well as '--'
  30235. - can indicate a long option. */
  30236. + can indicate a long option. */
  30237. optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
  30238. if (optc == -1)
  30239. - break;
  30240. + break;
  30241. switch (optc)
  30242. - {
  30243. - default:
  30244. - fprintf (stderr,
  30245. - _("%s: use the --help option for usage information\n"),
  30246. - program_name);
  30247. - xexit (1);
  30248. - case 1: /* File name. */
  30249. - lang_add_input_file (optarg, lang_input_file_is_file_enum,
  30250. - (char *) NULL);
  30251. - break;
  30252. -
  30253. - case OPTION_IGNORE:
  30254. - break;
  30255. - case 'a':
  30256. - /* For HP/UX compatibility. Actually -a shared should mean
  30257. + {
  30258. + default:
  30259. + fprintf (stderr,
  30260. + _("%s: use the --help option for usage information\n"),
  30261. + program_name);
  30262. + xexit (1);
  30263. + case 1: /* File name. */
  30264. + lang_add_input_file (optarg, lang_input_file_is_file_enum,
  30265. + (char *) NULL);
  30266. +
  30267. +/* add T.Tazaki 2003/05/14 >>> */
  30268. + /* Save Link Object file name table. for ELF header flag */
  30269. + fpIn = fopen( optarg, "rb" );
  30270. + if( fpIn != NULL )
  30271. + {
  30272. + fseek( fpIn, 39, SEEK_SET );
  30273. + ucFlag = fgetc( fpIn );
  30274. + if( ucFlag == 0x41 ) /* Advanced macro ? */
  30275. + {
  30276. +/* >>>>> DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
  30277. +// if( g_iPE == 1 ) /* already link PE object file ? add T.Tazaki 2004/04/28 */
  30278. +// {
  30279. +// fprintf( stderr,"Warning: do not link Advanced macro object file and PE object file.\n" );
  30280. +// }
  30281. +/* <<<<< DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
  30282. +
  30283. + g_iAdvance = 1; /* on */
  30284. + }
  30285. + else if( ucFlag == 'P' ) /* PE macro ? add T.Tazaki 2003/11/18 */
  30286. + {
  30287. +/* >>>>> DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
  30288. +// if( g_iAdvance == 1 ) /* already link Advanced object file ? add T.Tazaki 2004/04/28 */
  30289. +// {
  30290. +// fprintf( stderr,"Warning: do not link Advanced macro object file and PE object file.\n" );
  30291. +// }
  30292. +/* <<<<< DELETED D.Fujimoto 2007/10/01 core macro link check moved to bfd/elf32-c33.c */
  30293. +
  30294. + g_iPE = 1; /* on */
  30295. + }
  30296. + fclose( fpIn );
  30297. + }
  30298. + break;
  30299. +/* add T.Tazaki 2003/05/14 <<< */
  30300. + break;
  30301. +
  30302. + case OPTION_IGNORE:
  30303. + break;
  30304. + case 'a':
  30305. + /* For HP/UX compatibility. Actually -a shared should mean
  30306. ``use only shared libraries'' but, then, we don't
  30307. currently support shared libraries on HP/UX anyhow. */
  30308. - if (strcmp (optarg, "archive") == 0)
  30309. - config.dynamic_link = false;
  30310. - else if (strcmp (optarg, "shared") == 0
  30311. - || strcmp (optarg, "default") == 0)
  30312. - config.dynamic_link = true;
  30313. - else
  30314. - einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
  30315. - break;
  30316. - case OPTION_ASSERT:
  30317. - /* FIXME: We just ignore these, but we should handle them. */
  30318. - if (strcmp (optarg, "definitions") == 0)
  30319. - ;
  30320. - else if (strcmp (optarg, "nodefinitions") == 0)
  30321. - ;
  30322. - else if (strcmp (optarg, "nosymbolic") == 0)
  30323. - ;
  30324. - else if (strcmp (optarg, "pure-text") == 0)
  30325. - ;
  30326. - else
  30327. - einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
  30328. - break;
  30329. - case 'A':
  30330. - ldfile_add_arch (optarg);
  30331. - break;
  30332. - case 'b':
  30333. - lang_add_target (optarg);
  30334. - break;
  30335. - case 'c':
  30336. - ldfile_open_command_file (optarg);
  30337. - parser_input = input_mri_script;
  30338. - yyparse ();
  30339. - break;
  30340. - case OPTION_CALL_SHARED:
  30341. - config.dynamic_link = true;
  30342. - break;
  30343. - case OPTION_NON_SHARED:
  30344. - config.dynamic_link = false;
  30345. - break;
  30346. - case OPTION_CREF:
  30347. - command_line.cref = true;
  30348. - link_info.notice_all = true;
  30349. - break;
  30350. - case 'd':
  30351. - command_line.force_common_definition = true;
  30352. - break;
  30353. - case OPTION_DEFSYM:
  30354. - lex_string = optarg;
  30355. - lex_redirect (optarg);
  30356. - parser_input = input_defsym;
  30357. - parsing_defsym = 1;
  30358. - yyparse ();
  30359. - parsing_defsym = 0;
  30360. - lex_string = NULL;
  30361. - break;
  30362. - case OPTION_DEMANGLE:
  30363. - demangling = true;
  30364. - break;
  30365. - case OPTION_DYNAMIC_LINKER:
  30366. - command_line.interpreter = optarg;
  30367. - break;
  30368. - case OPTION_EB:
  30369. - command_line.endian = ENDIAN_BIG;
  30370. - break;
  30371. - case OPTION_EL:
  30372. - command_line.endian = ENDIAN_LITTLE;
  30373. - break;
  30374. - case OPTION_EMBEDDED_RELOCS:
  30375. - command_line.embedded_relocs = true;
  30376. - break;
  30377. - case OPTION_EXPORT_DYNAMIC:
  30378. - case 'E': /* HP/UX compatibility. */
  30379. - command_line.export_dynamic = true;
  30380. - break;
  30381. - case 'e':
  30382. - lang_add_entry (optarg, true);
  30383. - break;
  30384. - case 'f':
  30385. - if (command_line.auxiliary_filters == NULL)
  30386. - {
  30387. - command_line.auxiliary_filters =
  30388. - (char **) xmalloc (2 * sizeof (char *));
  30389. - command_line.auxiliary_filters[0] = optarg;
  30390. - command_line.auxiliary_filters[1] = NULL;
  30391. - }
  30392. - else
  30393. - {
  30394. - int c;
  30395. - char **p;
  30396. -
  30397. - c = 0;
  30398. - for (p = command_line.auxiliary_filters; *p != NULL; p++)
  30399. - ++c;
  30400. - command_line.auxiliary_filters =
  30401. - (char **) xrealloc (command_line.auxiliary_filters,
  30402. - (c + 2) * sizeof (char *));
  30403. - command_line.auxiliary_filters[c] = optarg;
  30404. - command_line.auxiliary_filters[c + 1] = NULL;
  30405. - }
  30406. - break;
  30407. - case 'F':
  30408. - command_line.filter_shlib = optarg;
  30409. - break;
  30410. - case OPTION_FORCE_EXE_SUFFIX:
  30411. - command_line.force_exe_suffix = true;
  30412. - break;
  30413. - case 'G':
  30414. - {
  30415. - char *end;
  30416. - g_switch_value = strtoul (optarg, &end, 0);
  30417. - if (*end)
  30418. - einfo (_("%P%F: invalid number `%s'\n"), optarg);
  30419. - }
  30420. - break;
  30421. - case 'g':
  30422. - /* Ignore. */
  30423. - break;
  30424. - case OPTION_GC_SECTIONS:
  30425. - command_line.gc_sections = true;
  30426. - break;
  30427. - case OPTION_HELP:
  30428. - help ();
  30429. - xexit (0);
  30430. - break;
  30431. - case 'L':
  30432. - ldfile_add_library_path (optarg, true);
  30433. - break;
  30434. - case 'l':
  30435. - lang_add_input_file (optarg, lang_input_file_is_l_enum,
  30436. - (char *) NULL);
  30437. - break;
  30438. - case 'M':
  30439. - config.map_filename = "-";
  30440. - break;
  30441. - case 'm':
  30442. - /* Ignore. Was handled in a pre-parse. */
  30443. - break;
  30444. - case OPTION_MAP:
  30445. - config.map_filename = optarg;
  30446. - break;
  30447. - case 'N':
  30448. - config.text_read_only = false;
  30449. - config.magic_demand_paged = false;
  30450. - config.dynamic_link = false;
  30451. - break;
  30452. - case 'n':
  30453. - config.magic_demand_paged = false;
  30454. - config.dynamic_link = false;
  30455. - break;
  30456. - case OPTION_NO_DEMANGLE:
  30457. - demangling = false;
  30458. - break;
  30459. - case OPTION_NO_GC_SECTIONS:
  30460. - command_line.gc_sections = false;
  30461. - break;
  30462. - case OPTION_NO_KEEP_MEMORY:
  30463. - link_info.keep_memory = false;
  30464. - break;
  30465. - case OPTION_NO_UNDEFINED:
  30466. - link_info.no_undefined = true;
  30467. - break;
  30468. - case OPTION_NO_WARN_MISMATCH:
  30469. - command_line.warn_mismatch = false;
  30470. - break;
  30471. - case OPTION_NOINHIBIT_EXEC:
  30472. - force_make_executable = true;
  30473. - break;
  30474. - case OPTION_NO_WHOLE_ARCHIVE:
  30475. - whole_archive = false;
  30476. - break;
  30477. - case 'O':
  30478. - /* FIXME "-O<non-digits> <value>" used to set the address of
  30479. - section <non-digits>. Was this for compatibility with
  30480. - something, or can we create a new option to do that
  30481. - (with a syntax similar to -defsym)?
  30482. - getopt can't handle two args to an option without kludges. */
  30483. -
  30484. - /* Enable optimizations of output files. */
  30485. - link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
  30486. - break;
  30487. - case 'o':
  30488. - lang_add_output (optarg, 0);
  30489. - break;
  30490. - case OPTION_OFORMAT:
  30491. - lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
  30492. - break;
  30493. - case 'i':
  30494. - case 'r':
  30495. - link_info.relocateable = true;
  30496. - config.build_constructors = false;
  30497. - config.magic_demand_paged = false;
  30498. - config.text_read_only = false;
  30499. - config.dynamic_link = false;
  30500. - break;
  30501. - case 'R':
  30502. - /* The GNU linker traditionally uses -R to mean to include
  30503. - only the symbols from a file. The Solaris linker uses -R
  30504. - to set the path used by the runtime linker to find
  30505. - libraries. This is the GNU linker -rpath argument. We
  30506. - try to support both simultaneously by checking the file
  30507. - named. If it is a directory, rather than a regular file,
  30508. - we assume -rpath was meant. */
  30509. - {
  30510. - struct stat s;
  30511. -
  30512. - if (stat (optarg, &s) >= 0
  30513. - && ! S_ISDIR (s.st_mode))
  30514. - {
  30515. - lang_add_input_file (optarg,
  30516. - lang_input_file_is_symbols_only_enum,
  30517. - (char *) NULL);
  30518. - break;
  30519. - }
  30520. - }
  30521. - /* Fall through. */
  30522. - case OPTION_RPATH:
  30523. - if (command_line.rpath == NULL)
  30524. - command_line.rpath = buystring (optarg);
  30525. - else
  30526. - {
  30527. - size_t rpath_len = strlen (command_line.rpath);
  30528. - size_t optarg_len = strlen (optarg);
  30529. - char *buf;
  30530. - char *cp = command_line.rpath;
  30531. -
  30532. - /* First see whether OPTARG is already in the path. */
  30533. - do
  30534. - {
  30535. - size_t idx = 0;
  30536. - while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
  30537. - ++idx;
  30538. - if (optarg[idx] == '\0'
  30539. - && (cp[idx] == '\0' || cp[idx] == ':'))
  30540. - /* We found it. */
  30541. - break;
  30542. -
  30543. - /* Not yet found. */
  30544. - cp = strchr (cp, ':');
  30545. - if (cp != NULL)
  30546. - ++cp;
  30547. - }
  30548. - while (cp != NULL);
  30549. -
  30550. - if (cp == NULL)
  30551. - {
  30552. - buf = xmalloc (rpath_len + optarg_len + 2);
  30553. - sprintf (buf, "%s:%s", command_line.rpath, optarg);
  30554. - free (command_line.rpath);
  30555. - command_line.rpath = buf;
  30556. - }
  30557. - }
  30558. - break;
  30559. - case OPTION_RPATH_LINK:
  30560. - if (command_line.rpath_link == NULL)
  30561. - command_line.rpath_link = buystring (optarg);
  30562. - else
  30563. - {
  30564. - char *buf;
  30565. -
  30566. - buf = xmalloc (strlen (command_line.rpath_link)
  30567. - + strlen (optarg)
  30568. - + 2);
  30569. - sprintf (buf, "%s:%s", command_line.rpath_link, optarg);
  30570. - free (command_line.rpath_link);
  30571. - command_line.rpath_link = buf;
  30572. - }
  30573. - break;
  30574. - case OPTION_RELAX:
  30575. - command_line.relax = true;
  30576. - break;
  30577. - case OPTION_RETAIN_SYMBOLS_FILE:
  30578. - add_keepsyms_file (optarg);
  30579. - break;
  30580. - case 'S':
  30581. - link_info.strip = strip_debugger;
  30582. - break;
  30583. - case 's':
  30584. - link_info.strip = strip_all;
  30585. - break;
  30586. - case OPTION_SHARED:
  30587. - if (config.has_shared)
  30588. - link_info.shared = true;
  30589. - else
  30590. - einfo (_("%P%F: -shared not supported\n"));
  30591. - break;
  30592. - case 'h': /* Used on Solaris. */
  30593. - case OPTION_SONAME:
  30594. - command_line.soname = optarg;
  30595. - break;
  30596. - case OPTION_SORT_COMMON:
  30597. - config.sort_common = true;
  30598. - break;
  30599. - case OPTION_STATS:
  30600. - config.stats = true;
  30601. - break;
  30602. - case OPTION_SYMBOLIC:
  30603. - link_info.symbolic = true;
  30604. - break;
  30605. - case 't':
  30606. - trace_files = true;
  30607. - break;
  30608. - case 'T':
  30609. - ldfile_open_command_file (optarg);
  30610. - parser_input = input_script;
  30611. - yyparse ();
  30612. - break;
  30613. - case OPTION_TBSS:
  30614. - set_section_start (".bss", optarg);
  30615. - break;
  30616. - case OPTION_TDATA:
  30617. - set_section_start (".data", optarg);
  30618. - break;
  30619. - case OPTION_TTEXT:
  30620. - set_section_start (".text", optarg);
  30621. - break;
  30622. - case OPTION_TRADITIONAL_FORMAT:
  30623. - link_info.traditional_format = true;
  30624. - break;
  30625. - case OPTION_TASK_LINK:
  30626. - link_info.task_link = true;
  30627. - /* Fall through - do an implied -r option. */
  30628. - case OPTION_UR:
  30629. - link_info.relocateable = true;
  30630. - config.build_constructors = true;
  30631. - config.magic_demand_paged = false;
  30632. - config.text_read_only = false;
  30633. - config.dynamic_link = false;
  30634. - break;
  30635. - case 'u':
  30636. - ldlang_add_undef (optarg);
  30637. - break;
  30638. - case OPTION_VERBOSE:
  30639. - ldversion (1);
  30640. - version_printed = true;
  30641. - trace_file_tries = true;
  30642. - break;
  30643. - case 'v':
  30644. - ldversion (0);
  30645. - version_printed = true;
  30646. - break;
  30647. - case 'V':
  30648. - ldversion (1);
  30649. - version_printed = true;
  30650. - break;
  30651. - case OPTION_VERSION:
  30652. - /* This output is intended to follow the GNU standards document. */
  30653. - printf ("GNU ld %s\n", ld_program_version);
  30654. - printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
  30655. - printf (_("\
  30656. + if (strcmp (optarg, "archive") == 0)
  30657. + config.dynamic_link = false;
  30658. + else if (strcmp (optarg, "shared") == 0
  30659. + || strcmp (optarg, "default") == 0)
  30660. + config.dynamic_link = true;
  30661. + else
  30662. + einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
  30663. + break;
  30664. + case OPTION_ASSERT:
  30665. + /* FIXME: We just ignore these, but we should handle them. */
  30666. + if (strcmp (optarg, "definitions") == 0)
  30667. + ;
  30668. + else if (strcmp (optarg, "nodefinitions") == 0)
  30669. + ;
  30670. + else if (strcmp (optarg, "nosymbolic") == 0)
  30671. + ;
  30672. + else if (strcmp (optarg, "pure-text") == 0)
  30673. + ;
  30674. + else
  30675. + einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
  30676. + break;
  30677. + case 'A':
  30678. + ldfile_add_arch (optarg);
  30679. + break;
  30680. + case 'b':
  30681. + lang_add_target (optarg);
  30682. + break;
  30683. + case 'c':
  30684. + ldfile_open_command_file (optarg);
  30685. + parser_input = input_mri_script;
  30686. + yyparse ();
  30687. + break;
  30688. + case OPTION_CALL_SHARED:
  30689. + config.dynamic_link = true;
  30690. + break;
  30691. + case OPTION_NON_SHARED:
  30692. + config.dynamic_link = false;
  30693. + break;
  30694. + case OPTION_CREF:
  30695. + command_line.cref = true;
  30696. + link_info.notice_all = true;
  30697. + break;
  30698. + case 'd':
  30699. + command_line.force_common_definition = true;
  30700. + break;
  30701. + case OPTION_DEFSYM:
  30702. + lex_string = optarg;
  30703. + lex_redirect (optarg);
  30704. + parser_input = input_defsym;
  30705. + parsing_defsym = 1;
  30706. + yyparse ();
  30707. + parsing_defsym = 0;
  30708. + lex_string = NULL;
  30709. + break;
  30710. + case OPTION_DEMANGLE:
  30711. + demangling = true;
  30712. + break;
  30713. + case OPTION_DYNAMIC_LINKER:
  30714. + command_line.interpreter = optarg;
  30715. + break;
  30716. + case OPTION_EB:
  30717. + command_line.endian = ENDIAN_BIG;
  30718. + break;
  30719. + case OPTION_EL:
  30720. + command_line.endian = ENDIAN_LITTLE;
  30721. + break;
  30722. + case OPTION_EMBEDDED_RELOCS:
  30723. + command_line.embedded_relocs = true;
  30724. + break;
  30725. + case OPTION_EXPORT_DYNAMIC:
  30726. + case 'E': /* HP/UX compatibility. */
  30727. + command_line.export_dynamic = true;
  30728. + break;
  30729. + case 'e':
  30730. + lang_add_entry (optarg, true);
  30731. + break;
  30732. + case 'f':
  30733. + if (command_line.auxiliary_filters == NULL)
  30734. + {
  30735. + command_line.auxiliary_filters =
  30736. + (char **) xmalloc (2 * sizeof (char *));
  30737. + command_line.auxiliary_filters[0] = optarg;
  30738. + command_line.auxiliary_filters[1] = NULL;
  30739. + }
  30740. + else
  30741. + {
  30742. + int c;
  30743. + char **p;
  30744. +
  30745. + c = 0;
  30746. + for (p = command_line.auxiliary_filters; *p != NULL; p++)
  30747. + ++c;
  30748. + command_line.auxiliary_filters =
  30749. + (char **) xrealloc (command_line.auxiliary_filters,
  30750. + (c + 2) * sizeof (char *));
  30751. + command_line.auxiliary_filters[c] = optarg;
  30752. + command_line.auxiliary_filters[c + 1] = NULL;
  30753. + }
  30754. + break;
  30755. + case 'F':
  30756. + command_line.filter_shlib = optarg;
  30757. + break;
  30758. + case OPTION_FORCE_EXE_SUFFIX:
  30759. + command_line.force_exe_suffix = true;
  30760. + break;
  30761. + case 'G':
  30762. + {
  30763. + char *end;
  30764. + g_switch_value = strtoul (optarg, &end, 0);
  30765. + if (*end)
  30766. + einfo (_("%P%F: invalid number `%s'\n"), optarg);
  30767. + }
  30768. + break;
  30769. + case 'g':
  30770. + /* Ignore. */
  30771. + break;
  30772. + case OPTION_GC_SECTIONS:
  30773. + command_line.gc_sections = true;
  30774. + break;
  30775. + case OPTION_HELP:
  30776. + help ();
  30777. + xexit (0);
  30778. + break;
  30779. + case 'L':
  30780. + ldfile_add_library_path (optarg, true);
  30781. + break;
  30782. + case 'l':
  30783. + lang_add_input_file (optarg, lang_input_file_is_l_enum,
  30784. + (char *) NULL);
  30785. + break;
  30786. + case 'M':
  30787. + config.map_filename = "-";
  30788. + break;
  30789. + case 'm':
  30790. + /* Ignore. Was handled in a pre-parse. */
  30791. + break;
  30792. + case OPTION_MAP:
  30793. + config.map_filename = optarg;
  30794. + break;
  30795. + case 'N':
  30796. + config.text_read_only = false;
  30797. + config.magic_demand_paged = false;
  30798. + config.dynamic_link = false;
  30799. + break;
  30800. + case 'n':
  30801. + config.magic_demand_paged = false;
  30802. + config.dynamic_link = false;
  30803. + break;
  30804. + case OPTION_NO_DEMANGLE:
  30805. + demangling = false;
  30806. + break;
  30807. + case OPTION_NO_GC_SECTIONS:
  30808. + command_line.gc_sections = false;
  30809. + break;
  30810. + case OPTION_NO_KEEP_MEMORY:
  30811. + link_info.keep_memory = false;
  30812. + break;
  30813. + case OPTION_NO_UNDEFINED:
  30814. + link_info.no_undefined = true;
  30815. + break;
  30816. + case OPTION_NO_WARN_MISMATCH:
  30817. + command_line.warn_mismatch = false;
  30818. + break;
  30819. + case OPTION_NOINHIBIT_EXEC:
  30820. + force_make_executable = true;
  30821. + break;
  30822. + case OPTION_NO_WHOLE_ARCHIVE:
  30823. + whole_archive = false;
  30824. + break;
  30825. + case 'O':
  30826. + /* FIXME "-O<non-digits> <value>" used to set the address of
  30827. + section <non-digits>. Was this for compatibility with
  30828. + something, or can we create a new option to do that
  30829. + (with a syntax similar to -defsym)?
  30830. + getopt can't handle two args to an option without kludges. */
  30831. +
  30832. + /* Enable optimizations of output files. */
  30833. + link_info.optimize = strtoul (optarg, NULL, 0) ? true : false;
  30834. + break;
  30835. + case 'o':
  30836. + lang_add_output (optarg, 0);
  30837. + break;
  30838. + case OPTION_OFORMAT:
  30839. + lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
  30840. + break;
  30841. + case 'i':
  30842. + case 'r':
  30843. + link_info.relocateable = true;
  30844. + config.build_constructors = false;
  30845. + config.magic_demand_paged = false;
  30846. + config.text_read_only = false;
  30847. + config.dynamic_link = false;
  30848. + break;
  30849. + case 'R':
  30850. + /* The GNU linker traditionally uses -R to mean to include
  30851. + only the symbols from a file. The Solaris linker uses -R
  30852. + to set the path used by the runtime linker to find
  30853. + libraries. This is the GNU linker -rpath argument. We
  30854. + try to support both simultaneously by checking the file
  30855. + named. If it is a directory, rather than a regular file,
  30856. + we assume -rpath was meant. */
  30857. + {
  30858. + struct stat s;
  30859. +
  30860. + if (stat (optarg, &s) >= 0
  30861. + && ! S_ISDIR (s.st_mode))
  30862. + {
  30863. + lang_add_input_file (optarg,
  30864. + lang_input_file_is_symbols_only_enum,
  30865. + (char *) NULL);
  30866. + break;
  30867. + }
  30868. + }
  30869. + /* Fall through. */
  30870. + case OPTION_RPATH:
  30871. + if (command_line.rpath == NULL)
  30872. + command_line.rpath = buystring (optarg);
  30873. + else
  30874. + {
  30875. + size_t rpath_len = strlen (command_line.rpath);
  30876. + size_t optarg_len = strlen (optarg);
  30877. + char *buf;
  30878. + char *cp = command_line.rpath;
  30879. +
  30880. + /* First see whether OPTARG is already in the path. */
  30881. + do
  30882. + {
  30883. + size_t idx = 0;
  30884. + while (optarg[idx] != '\0' && optarg[idx] == cp[idx])
  30885. + ++idx;
  30886. + if (optarg[idx] == '\0'
  30887. + && (cp[idx] == '\0' || cp[idx] == ':'))
  30888. + /* We found it. */
  30889. + break;
  30890. +
  30891. + /* Not yet found. */
  30892. + cp = strchr (cp, ':');
  30893. + if (cp != NULL)
  30894. + ++cp;
  30895. + }
  30896. + while (cp != NULL);
  30897. +
  30898. + if (cp == NULL)
  30899. + {
  30900. + buf = xmalloc (rpath_len + optarg_len + 2);
  30901. + sprintf (buf, "%s:%s", command_line.rpath, optarg);
  30902. + free (command_line.rpath);
  30903. + command_line.rpath = buf;
  30904. + }
  30905. + }
  30906. + break;
  30907. + case OPTION_RPATH_LINK:
  30908. + if (command_line.rpath_link == NULL)
  30909. + command_line.rpath_link = buystring (optarg);
  30910. + else
  30911. + {
  30912. + char *buf;
  30913. +
  30914. + buf = xmalloc (strlen (command_line.rpath_link)
  30915. + + strlen (optarg)
  30916. + + 2);
  30917. + sprintf (buf, "%s:%s", command_line.rpath_link, optarg);
  30918. + free (command_line.rpath_link);
  30919. + command_line.rpath_link = buf;
  30920. + }
  30921. + break;
  30922. + case OPTION_RELAX:
  30923. + command_line.relax = true;
  30924. + break;
  30925. + case OPTION_RETAIN_SYMBOLS_FILE:
  30926. + add_keepsyms_file (optarg);
  30927. + break;
  30928. + case 'S':
  30929. + link_info.strip = strip_debugger;
  30930. + break;
  30931. + case 's':
  30932. + link_info.strip = strip_all;
  30933. + break;
  30934. + case OPTION_SHARED:
  30935. + if (config.has_shared)
  30936. + link_info.shared = true;
  30937. + else
  30938. + einfo (_("%P%F: -shared not supported\n"));
  30939. + break;
  30940. + case 'h': /* Used on Solaris. */
  30941. + case OPTION_SONAME:
  30942. + command_line.soname = optarg;
  30943. + break;
  30944. + case OPTION_SORT_COMMON:
  30945. + config.sort_common = true;
  30946. + break;
  30947. + case OPTION_STATS:
  30948. + config.stats = true;
  30949. + break;
  30950. + case OPTION_SYMBOLIC:
  30951. + link_info.symbolic = true;
  30952. + break;
  30953. + case 't':
  30954. + trace_files = true;
  30955. + break;
  30956. + case 'T':
  30957. + ldfile_open_command_file (optarg);
  30958. + parser_input = input_script;
  30959. + yyparse ();
  30960. + break;
  30961. + case OPTION_TBSS:
  30962. + set_section_start (".bss", optarg);
  30963. + break;
  30964. + case OPTION_TDATA:
  30965. + set_section_start (".data", optarg);
  30966. + break;
  30967. + case OPTION_TTEXT:
  30968. + set_section_start (".text", optarg);
  30969. + break;
  30970. + case OPTION_TRADITIONAL_FORMAT:
  30971. + link_info.traditional_format = true;
  30972. + break;
  30973. + case OPTION_TASK_LINK:
  30974. + link_info.task_link = true;
  30975. + /* Fall through - do an implied -r option. */
  30976. + case OPTION_UR:
  30977. + link_info.relocateable = true;
  30978. + config.build_constructors = true;
  30979. + config.magic_demand_paged = false;
  30980. + config.text_read_only = false;
  30981. + config.dynamic_link = false;
  30982. + break;
  30983. + case 'u':
  30984. + ldlang_add_undef (optarg);
  30985. + break;
  30986. + case OPTION_VERBOSE:
  30987. + ldversion (1);
  30988. + version_printed = true;
  30989. + trace_file_tries = true;
  30990. + break;
  30991. + case 'v':
  30992. + ldversion (0);
  30993. + version_printed = true;
  30994. + break;
  30995. + case 'V':
  30996. + ldversion (1);
  30997. + version_printed = true;
  30998. + break;
  30999. + case OPTION_VERSION:
  31000. + /* This output is intended to follow the GNU standards document. */
  31001. + printf ("GNU ld %s\n", ld_program_version);
  31002. + printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
  31003. + printf (_("\
  31004. This program is free software; you may redistribute it under the terms of\n\
  31005. the GNU General Public License. This program has absolutely no warranty.\n"));
  31006. - {
  31007. - ld_emulation_xfer_type **ptr = ld_emulations;
  31008. + {
  31009. + ld_emulation_xfer_type **ptr = ld_emulations;
  31010. - printf (_(" Supported emulations:\n"));
  31011. - while (*ptr)
  31012. - {
  31013. - printf (" %s\n", (*ptr)->emulation_name);
  31014. - ptr++;
  31015. - }
  31016. - }
  31017. - xexit (0);
  31018. - break;
  31019. - case OPTION_VERSION_SCRIPT:
  31020. - /* This option indicates a small script that only specifies
  31021. + printf (_(" Supported emulations:\n"));
  31022. + while (*ptr)
  31023. + {
  31024. + printf (" %s\n", (*ptr)->emulation_name);
  31025. + ptr++;
  31026. + }
  31027. + }
  31028. + xexit (0);
  31029. + break;
  31030. + case OPTION_VERSION_SCRIPT:
  31031. + /* This option indicates a small script that only specifies
  31032. version information. Read it, but don't assume that
  31033. we've seen a linker script. */
  31034. - {
  31035. - boolean hold_had_script;
  31036. -
  31037. - hold_had_script = had_script;
  31038. - ldfile_open_command_file (optarg);
  31039. - had_script = hold_had_script;
  31040. - parser_input = input_version_script;
  31041. - yyparse ();
  31042. - }
  31043. - break;
  31044. - case OPTION_VERSION_EXPORTS_SECTION:
  31045. - /* This option records a version symbol to be applied to the
  31046. - symbols listed for export to be found in the object files
  31047. - .exports sections. */
  31048. - command_line.version_exports_section = optarg;
  31049. - break;
  31050. - case OPTION_WARN_COMMON:
  31051. - config.warn_common = true;
  31052. - break;
  31053. - case OPTION_WARN_CONSTRUCTORS:
  31054. - config.warn_constructors = true;
  31055. - break;
  31056. - case OPTION_WARN_MULTIPLE_GP:
  31057. - config.warn_multiple_gp = true;
  31058. - break;
  31059. - case OPTION_WARN_ONCE:
  31060. - config.warn_once = true;
  31061. - break;
  31062. - case OPTION_WARN_SECTION_ALIGN:
  31063. - config.warn_section_align = true;
  31064. - break;
  31065. - case OPTION_WHOLE_ARCHIVE:
  31066. - whole_archive = true;
  31067. - break;
  31068. - case OPTION_WRAP:
  31069. - add_wrap (optarg);
  31070. - break;
  31071. - case 'X':
  31072. - link_info.discard = discard_l;
  31073. - break;
  31074. - case 'x':
  31075. - link_info.discard = discard_all;
  31076. - break;
  31077. - case 'Y':
  31078. - if (strncmp (optarg, "P,", 2) == 0)
  31079. - optarg += 2;
  31080. - default_dirlist = xstrdup (optarg);
  31081. - break;
  31082. - case 'y':
  31083. - add_ysym (optarg);
  31084. - break;
  31085. - case 'z':
  31086. - /* We accept and ignore this option for Solaris
  31087. + {
  31088. + boolean hold_had_script;
  31089. +
  31090. + hold_had_script = had_script;
  31091. + ldfile_open_command_file (optarg);
  31092. + had_script = hold_had_script;
  31093. + parser_input = input_version_script;
  31094. + yyparse ();
  31095. + }
  31096. + break;
  31097. + case OPTION_VERSION_EXPORTS_SECTION:
  31098. + /* This option records a version symbol to be applied to the
  31099. + symbols listed for export to be found in the object files
  31100. + .exports sections. */
  31101. + command_line.version_exports_section = optarg;
  31102. + break;
  31103. + case OPTION_WARN_COMMON:
  31104. + config.warn_common = true;
  31105. + break;
  31106. + case OPTION_WARN_CONSTRUCTORS:
  31107. + config.warn_constructors = true;
  31108. + break;
  31109. + case OPTION_WARN_MULTIPLE_GP:
  31110. + config.warn_multiple_gp = true;
  31111. + break;
  31112. + case OPTION_WARN_ONCE:
  31113. + config.warn_once = true;
  31114. + break;
  31115. + case OPTION_WARN_SECTION_ALIGN:
  31116. + config.warn_section_align = true;
  31117. + break;
  31118. + case OPTION_WHOLE_ARCHIVE:
  31119. + whole_archive = true;
  31120. + break;
  31121. + case OPTION_WRAP:
  31122. + add_wrap (optarg);
  31123. + break;
  31124. + case 'X':
  31125. + link_info.discard = discard_l;
  31126. + break;
  31127. + case 'x':
  31128. + link_info.discard = discard_all;
  31129. + break;
  31130. + case 'Y':
  31131. + if (strncmp (optarg, "P,", 2) == 0)
  31132. + optarg += 2;
  31133. + default_dirlist = xstrdup (optarg);
  31134. + break;
  31135. + case 'y':
  31136. + add_ysym (optarg);
  31137. + break;
  31138. + case 'z':
  31139. + /* We accept and ignore this option for Solaris
  31140. compatibility. Actually, on Solaris, optarg is not
  31141. ignored. Someday we should handle it correctly. FIXME. */
  31142. - break;
  31143. - case OPTION_SPLIT_BY_RELOC:
  31144. - config.split_by_reloc = strtoul (optarg, NULL, 0);
  31145. - break;
  31146. - case OPTION_SPLIT_BY_FILE:
  31147. - config.split_by_file = true;
  31148. - break;
  31149. - case OPTION_CHECK_SECTIONS:
  31150. - command_line.check_section_addresses = true;
  31151. - break;
  31152. - case OPTION_NO_CHECK_SECTIONS:
  31153. - command_line.check_section_addresses = false;
  31154. - break;
  31155. - case '(':
  31156. - if (ingroup)
  31157. - {
  31158. - fprintf (stderr,
  31159. - _("%s: may not nest groups (--help for usage)\n"),
  31160. - program_name);
  31161. - xexit (1);
  31162. - }
  31163. - lang_enter_group ();
  31164. - ingroup = 1;
  31165. - break;
  31166. - case ')':
  31167. - if (! ingroup)
  31168. - {
  31169. - fprintf (stderr,
  31170. - _("%s: group ended before it began (--help for usage)\n"),
  31171. - program_name);
  31172. - xexit (1);
  31173. - }
  31174. - lang_leave_group ();
  31175. - ingroup = 0;
  31176. - break;
  31177. + break;
  31178. + case OPTION_SPLIT_BY_RELOC:
  31179. + config.split_by_reloc = strtoul (optarg, NULL, 0);
  31180. + break;
  31181. + case OPTION_SPLIT_BY_FILE:
  31182. + config.split_by_file = true;
  31183. + break;
  31184. + case OPTION_CHECK_SECTIONS:
  31185. + command_line.check_section_addresses = true;
  31186. + break;
  31187. + case OPTION_NO_CHECK_SECTIONS:
  31188. + command_line.check_section_addresses = false;
  31189. + break;
  31190. + case '(':
  31191. + if (ingroup)
  31192. + {
  31193. + fprintf (stderr,
  31194. + _("%s: may not nest groups (--help for usage)\n"),
  31195. + program_name);
  31196. + xexit (1);
  31197. + }
  31198. + lang_enter_group ();
  31199. + ingroup = 1;
  31200. + break;
  31201. + case ')':
  31202. + if (! ingroup)
  31203. + {
  31204. + fprintf (stderr,
  31205. + _("%s: group ended before it began (--help for usage)\n"),
  31206. + program_name);
  31207. + xexit (1);
  31208. + }
  31209. + lang_leave_group ();
  31210. + ingroup = 0;
  31211. + break;
  31212. case OPTION_MPC860C0:
  31213. link_info.mpc860c0 = 20; /* default value (in bytes) */
  31214. if (optarg)
  31215. @@ -997,8 +1036,8 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
  31216. if (words == 0)
  31217. {
  31218. fprintf (stderr,
  31219. - _("%s: Invalid argument to option \"mpc860c0\"\n"),
  31220. - program_name);
  31221. + _("%s: Invalid argument to option \"mpc860c0\"\n"),
  31222. + program_name);
  31223. xexit (1);
  31224. }
  31225. link_info.mpc860c0 = words * 4; /* convert words to bytes */
  31226. @@ -1006,14 +1045,14 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
  31227. command_line.relax = true;
  31228. break;
  31229. - case OPTION_INIT:
  31230. - link_info.init_function = optarg;
  31231. - break;
  31232. -
  31233. - case OPTION_FINI:
  31234. - link_info.fini_function = optarg;
  31235. - break;
  31236. - }
  31237. + case OPTION_INIT:
  31238. + link_info.init_function = optarg;
  31239. + break;
  31240. +
  31241. + case OPTION_FINI:
  31242. + link_info.fini_function = optarg;
  31243. + break;
  31244. + }
  31245. }
  31246. if (ingroup)
  31247. @@ -1037,11 +1076,11 @@ set_default_dirlist (dirlist_ptr)
  31248. {
  31249. p = strchr (dirlist_ptr, PATH_SEPARATOR);
  31250. if (p != NULL)
  31251. - *p = '\0';
  31252. + *p = '\0';
  31253. if (*dirlist_ptr != '\0')
  31254. - ldfile_add_library_path (dirlist_ptr, true);
  31255. + ldfile_add_library_path (dirlist_ptr, true);
  31256. if (p == NULL)
  31257. - break;
  31258. + break;
  31259. dirlist_ptr = p + 1;
  31260. }
  31261. }
  31262. @@ -1071,76 +1110,76 @@ help ()
  31263. for (i = 0; i < OPTION_COUNT; i++)
  31264. {
  31265. if (ld_options[i].doc != NULL)
  31266. - {
  31267. - boolean comma;
  31268. - int len;
  31269. - int j;
  31270. -
  31271. - printf (" ");
  31272. -
  31273. - comma = false;
  31274. - len = 2;
  31275. -
  31276. - j = i;
  31277. - do
  31278. - {
  31279. - if (ld_options[j].shortopt != '\0'
  31280. - && ld_options[j].control != NO_HELP)
  31281. - {
  31282. - printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
  31283. - len += (comma ? 2 : 0) + 2;
  31284. - if (ld_options[j].arg != NULL)
  31285. - {
  31286. - if (ld_options[j].opt.has_arg != optional_argument)
  31287. - {
  31288. - printf (" ");
  31289. - ++len;
  31290. - }
  31291. - printf ("%s", _(ld_options[j].arg));
  31292. - len += strlen (_(ld_options[j].arg));
  31293. - }
  31294. - comma = true;
  31295. - }
  31296. - ++j;
  31297. - }
  31298. - while (j < OPTION_COUNT && ld_options[j].doc == NULL);
  31299. -
  31300. - j = i;
  31301. - do
  31302. - {
  31303. - if (ld_options[j].opt.name != NULL
  31304. - && ld_options[j].control != NO_HELP)
  31305. - {
  31306. - printf ("%s-%s%s",
  31307. - comma ? ", " : "",
  31308. - ld_options[j].control == TWO_DASHES ? "-" : "",
  31309. - ld_options[j].opt.name);
  31310. - len += ((comma ? 2 : 0)
  31311. - + 1
  31312. - + (ld_options[j].control == TWO_DASHES ? 1 : 0)
  31313. - + strlen (ld_options[j].opt.name));
  31314. - if (ld_options[j].arg != NULL)
  31315. - {
  31316. - printf (" %s", _(ld_options[j].arg));
  31317. - len += 1 + strlen (_(ld_options[j].arg));
  31318. - }
  31319. - comma = true;
  31320. - }
  31321. - ++j;
  31322. - }
  31323. - while (j < OPTION_COUNT && ld_options[j].doc == NULL);
  31324. -
  31325. - if (len >= 30)
  31326. - {
  31327. - printf ("\n");
  31328. - len = 0;
  31329. - }
  31330. -
  31331. - for (; len < 30; len++)
  31332. - putchar (' ');
  31333. -
  31334. - printf ("%s\n", _(ld_options[i].doc));
  31335. - }
  31336. + {
  31337. + boolean comma;
  31338. + int len;
  31339. + int j;
  31340. +
  31341. + printf (" ");
  31342. +
  31343. + comma = false;
  31344. + len = 2;
  31345. +
  31346. + j = i;
  31347. + do
  31348. + {
  31349. + if (ld_options[j].shortopt != '\0'
  31350. + && ld_options[j].control != NO_HELP)
  31351. + {
  31352. + printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
  31353. + len += (comma ? 2 : 0) + 2;
  31354. + if (ld_options[j].arg != NULL)
  31355. + {
  31356. + if (ld_options[j].opt.has_arg != optional_argument)
  31357. + {
  31358. + printf (" ");
  31359. + ++len;
  31360. + }
  31361. + printf ("%s", _(ld_options[j].arg));
  31362. + len += strlen (_(ld_options[j].arg));
  31363. + }
  31364. + comma = true;
  31365. + }
  31366. + ++j;
  31367. + }
  31368. + while (j < OPTION_COUNT && ld_options[j].doc == NULL);
  31369. +
  31370. + j = i;
  31371. + do
  31372. + {
  31373. + if (ld_options[j].opt.name != NULL
  31374. + && ld_options[j].control != NO_HELP)
  31375. + {
  31376. + printf ("%s-%s%s",
  31377. + comma ? ", " : "",
  31378. + ld_options[j].control == TWO_DASHES ? "-" : "",
  31379. + ld_options[j].opt.name);
  31380. + len += ((comma ? 2 : 0)
  31381. + + 1
  31382. + + (ld_options[j].control == TWO_DASHES ? 1 : 0)
  31383. + + strlen (ld_options[j].opt.name));
  31384. + if (ld_options[j].arg != NULL)
  31385. + {
  31386. + printf (" %s", _(ld_options[j].arg));
  31387. + len += 1 + strlen (_(ld_options[j].arg));
  31388. + }
  31389. + comma = true;
  31390. + }
  31391. + ++j;
  31392. + }
  31393. + while (j < OPTION_COUNT && ld_options[j].doc == NULL);
  31394. +
  31395. + if (len >= 30)
  31396. + {
  31397. + printf ("\n");
  31398. + len = 0;
  31399. + }
  31400. +
  31401. + for (; len < 30; len++)
  31402. + putchar (' ');
  31403. +
  31404. + printf ("%s\n", _(ld_options[i].doc));
  31405. + }
  31406. }
  31407. /* Note: Various tools (such as libtool) depend upon the
  31408. diff --git a/ld/scripttempl/c33.sc b/ld/scripttempl/c33.sc
  31409. new file mode 100644
  31410. index 0000000..add0cc4
  31411. --- /dev/null
  31412. +++ b/ld/scripttempl/c33.sc
  31413. @@ -0,0 +1,98 @@
  31414. +cat << EOF
  31415. +/*=======================================================================
  31416. +
  31417. + c33 ld default linker script
  31418. +
  31419. + 2002.02.28 start T.Tazaki
  31420. +
  31421. +=========================================================================*/
  31422. +OUTPUT_FORMAT("elf32-c33", "elf32-c33",
  31423. + "elf32-c33")
  31424. +OUTPUT_ARCH(c33)
  31425. +SEARCH_DIR(.);
  31426. +SECTIONS
  31427. +{
  31428. +
  31429. + __dp = 0x0;
  31430. +
  31431. + . = 0x0;
  31432. + .comm : { *(.comm) }
  31433. + .bss : { *(.bss) }
  31434. + .data : { *(.data) }
  31435. +
  31436. + . = 0xc00000;
  31437. + .text : { *(.text) }
  31438. + .rodata : { *(.rodata) }
  31439. +
  31440. + /* Read-only sections, merged into text segment: */
  31441. + .interp : { *(.interp) }
  31442. + .hash : { *(.hash) }
  31443. + .dynsym : { *(.dynsym) }
  31444. + .dynstr : { *(.dynstr) }
  31445. + .rel.text : { *(.rel.text) }
  31446. + .rela.text : { *(.rela.text) }
  31447. + .rel.data : { *(.rel.data) }
  31448. + .rela.data : { *(.rela.data) }
  31449. + .rel.rodata : { *(.rel.rodata) }
  31450. + .rela.rodata : { *(.rela.rodata) }
  31451. + .rel.got : { *(.rel.got) }
  31452. + .rela.got : { *(.rela.got) }
  31453. + .rel.ctors : { *(.rel.ctors) }
  31454. + .rela.ctors : { *(.rela.ctors) }
  31455. + .rel.dtors : { *(.rel.dtors) }
  31456. + .rela.dtors : { *(.rela.dtors) }
  31457. + .rel.init : { *(.rel.init) }
  31458. + .rela.init : { *(.rela.init) }
  31459. + .rel.fini : { *(.rel.fini) }
  31460. + .rela.fini : { *(.rela.fini) }
  31461. + .rel.bss : { *(.rel.bss) }
  31462. + .rela.bss : { *(.rela.bss) }
  31463. + .rel.plt : { *(.rel.plt) }
  31464. + .rela.plt : { *(.rela.plt) }
  31465. + .init : { KEEP (*(.init)) } =0
  31466. + .plt : { *(.plt) }
  31467. +
  31468. +
  31469. + /* Stabs debugging sections. */
  31470. + .stab 0 : { *(.stab) }
  31471. + .stabstr 0 : { *(.stabstr) }
  31472. + .stab.excl 0 : { *(.stab.excl) }
  31473. + .stab.exclstr 0 : { *(.stab.exclstr) }
  31474. + .stab.index 0 : { *(.stab.index) }
  31475. + .stab.indexstr 0 : { *(.stab.indexstr) }
  31476. + .comment 0 : { *(.comment) }
  31477. +
  31478. + /* DWARF debug sections.
  31479. + Symbols in the DWARF debugging sections are relative to the beginning
  31480. + of the section so we begin them at 0. */
  31481. +
  31482. + /* DWARF 1 */
  31483. + .debug 0 : { *(.debug) }
  31484. + .line 0 : { *(.line) }
  31485. +
  31486. + /* GNU DWARF 1 extensions */
  31487. + .debug_srcinfo 0 : { *(.debug_srcinfo) }
  31488. + .debug_sfnames 0 : { *(.debug_sfnames) }
  31489. +
  31490. + /* DWARF 1.1 and DWARF 2 */
  31491. + .debug_aranges 0 : { *(.debug_aranges) }
  31492. + .debug_pubnames 0 : { *(.debug_pubnames) }
  31493. +
  31494. + /* DWARF 2 */
  31495. + .debug_info 0 : { *(.debug_info) }
  31496. + .debug_abbrev 0 : { *(.debug_abbrev) }
  31497. + .debug_line 0 : { *(.debug_line) }
  31498. + .debug_frame 0 : { *(.debug_frame) }
  31499. + .debug_str 0 : { *(.debug_str) }
  31500. + .debug_loc 0 : { *(.debug_loc) }
  31501. + .debug_macinfo 0 : { *(.debug_macinfo) }
  31502. +
  31503. + /* SGI/MIPS DWARF 2 extensions */
  31504. + .debug_weaknames 0 : { *(.debug_weaknames) }
  31505. + .debug_funcnames 0 : { *(.debug_funcnames) }
  31506. + .debug_typenames 0 : { *(.debug_typenames) }
  31507. + .debug_varnames 0 : { *(.debug_varnames) }
  31508. +
  31509. + /* These must appear regardless of . */
  31510. +}
  31511. +EOF
  31512. diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
  31513. index 77beb4d..27bb95f 100644
  31514. --- a/opcodes/Makefile.am
  31515. +++ b/opcodes/Makefile.am
  31516. @@ -85,6 +85,8 @@ CFILES = \
  31517. tic80-opc.c \
  31518. v850-dis.c \
  31519. v850-opc.c \
  31520. + c33-dis.c \
  31521. + c33-opc.c \
  31522. vax-dis.c \
  31523. w65-dis.c \
  31524. z8k-dis.c \
  31525. @@ -145,6 +147,8 @@ ALL_MACHINES = \
  31526. tic30-dis.lo \
  31527. tic80-dis.lo \
  31528. tic80-opc.lo \
  31529. + c33-dis.lo \
  31530. + c33-opc.lo \
  31531. v850-dis.lo \
  31532. v850-opc.lo \
  31533. vax-dis.lo \
  31534. @@ -370,6 +374,10 @@ v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
  31535. $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
  31536. v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
  31537. opintl.h
  31538. +c33-dis.lo: c33-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
  31539. + $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
  31540. +c33-opc.lo: c33-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
  31541. + opintl.h
  31542. vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
  31543. $(BFD_H) $(INCDIR)/ansidecl.h
  31544. w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
  31545. diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
  31546. index 0cf1c27..5f1fe32 100644
  31547. --- a/opcodes/Makefile.in
  31548. +++ b/opcodes/Makefile.in
  31549. @@ -189,6 +189,8 @@ CFILES = \
  31550. tic80-opc.c \
  31551. v850-dis.c \
  31552. v850-opc.c \
  31553. + c33-dis.c \
  31554. + c33-opc.c \
  31555. vax-dis.c \
  31556. w65-dis.c \
  31557. z8k-dis.c \
  31558. @@ -252,6 +254,8 @@ ALL_MACHINES = \
  31559. tic80-opc.lo \
  31560. v850-dis.lo \
  31561. v850-opc.lo \
  31562. + c33-dis.lo \
  31563. + c33-opc.lo \
  31564. vax-dis.lo \
  31565. w65-dis.lo \
  31566. z8k-dis.lo
  31567. @@ -867,6 +871,10 @@ v850-dis.lo: v850-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
  31568. $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
  31569. v850-opc.lo: v850-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/v850.h \
  31570. opintl.h
  31571. +c33-dis.lo: c33-dis.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
  31572. + $(INCDIR)/dis-asm.h $(BFD_H) opintl.h
  31573. +c33-opc.lo: c33-opc.c $(INCDIR)/ansidecl.h $(INCDIR)/opcode/c33.h \
  31574. + opintl.h
  31575. vax-dis.lo: vax-dis.c $(INCDIR)/opcode/vax.h $(INCDIR)/dis-asm.h \
  31576. $(BFD_H) $(INCDIR)/ansidecl.h
  31577. w65-dis.lo: w65-dis.c w65-opc.h $(INCDIR)/dis-asm.h \
  31578. diff --git a/opcodes/c33-dis.c b/opcodes/c33-dis.c
  31579. new file mode 100644
  31580. index 0000000..699bc22
  31581. --- /dev/null
  31582. +++ b/opcodes/c33-dis.c
  31583. @@ -0,0 +1,2824 @@
  31584. +/* Disassemble V850 instructions.
  31585. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
  31586. +
  31587. +This program is free software; you can redistribute it and/or modify
  31588. +it under the terms of the GNU General Public License as published by
  31589. +the Free Software Foundation; either version 2 of the License, or
  31590. +(at your option) any later version.
  31591. +
  31592. +This program is distributed in the hope that it will be useful,
  31593. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  31594. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31595. +GNU General Public License for more details.
  31596. +
  31597. +You should have received a copy of the GNU General Public License
  31598. +along with this program; if not, write to the Free Software
  31599. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  31600. +
  31601. +
  31602. +#include <stdio.h>
  31603. +
  31604. +#include "sysdep.h"
  31605. +#include "opcode/c33.h"
  31606. +#include "dis-asm.h"
  31607. +#include "opintl.h"
  31608. +
  31609. +static const char *const c33_reg_names[] =
  31610. +{ "%r0", "%r1", "%r2", "%r3", "%r4", "%r5", "%r6", "%r7",
  31611. + "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
  31612. +};
  31613. +
  31614. +static const char *const c33_sreg_names[] = /* add "idir,dbg__base" T.Tazaki 2003/11/18 */
  31615. +{ "%psr","%sp", "%alr", "%ahr", "%lco", "%lsa", "%lea", "%sor", "%ttbr", "%dp","%idir","%dbbr","","%usp", "%ssp", "%pc" };
  31616. +
  31617. +/* add tazaki 2001.09.12 >>>>> */
  31618. +
  31619. +/******* type definiton ******/
  31620. +typedef char INT8;
  31621. +typedef short INT16;
  31622. +typedef long INT32;
  31623. +typedef unsigned char UINT8;
  31624. +typedef unsigned short UINT16;
  31625. +typedef unsigned long UINT32;
  31626. +typedef unsigned long ADDR;
  31627. +
  31628. +#define NO_ERR 0
  31629. +#define ERR 2
  31630. +#define ERR2 3
  31631. +#define QUIT 100 /* add D.Fujimoto 2007/10/17 */
  31632. +
  31633. +#define BIT0 0x01
  31634. +#define BIT1 0x02
  31635. +#define BIT2 0x04
  31636. +#define BIT3 0x08
  31637. +#define BIT4 0x10
  31638. +#define BIT5 0x20
  31639. +#define BIT6 0x40
  31640. +#define BIT7 0x80
  31641. +#define BIT8 0x100
  31642. +#define BIT9 0x200
  31643. +#define BIT10 0x400
  31644. +#define BIT11 0x800
  31645. +#define BIT12 0x1000
  31646. +#define BIT13 0x2000
  31647. +#define BIT14 0x4000
  31648. +#define BIT15 0x8000
  31649. +#define BIT16 0x10000
  31650. +#define BIT17 0x20000
  31651. +#define BIT18 0x40000
  31652. +#define BIT19 0x80000
  31653. +#define BIT20 0x100000
  31654. +#define BIT21 0x200000
  31655. +#define BIT22 0x400000
  31656. +#define BIT23 0x800000
  31657. +#define BIT24 0x1000000
  31658. +#define BIT25 0x2000000
  31659. +#define BIT26 0x4000000
  31660. +#define BIT27 0x8000000
  31661. +#define BIT28 0x10000000
  31662. +#define BIT29 0x20000000
  31663. +#define BIT30 0x40000000
  31664. +#define BIT31 0x80000000
  31665. +
  31666. +#define YES 1
  31667. +#define NO 0
  31668. +
  31669. +#define CLASS_MASK 0xE000
  31670. +#define CLASS0 0x0000
  31671. +#define CLASS1 0x2000
  31672. +#define CLASS2 0x4000
  31673. +#define CLASS3 0x6000
  31674. +#define CLASS5 0xA000
  31675. +#define CLASS6 0xC000
  31676. +#define CLASS7 0xE000 /* add tazaki 2001.09.19 */
  31677. +#define CLASS6_DATA 0x1fff
  31678. +#define EXT1 1
  31679. +#define EXT2 2
  31680. +#define EXT3 3
  31681. +#define CALC1 10
  31682. +#define CALC2 20
  31683. +#define CALC3_BYTE 31
  31684. +#define CALC3_HALF 32
  31685. +#define CALC3_WORD 33
  31686. +#define CALC4 40
  31687. +#define CALC5 50
  31688. +
  31689. +#define MASK1_0 0x3
  31690. +#define MASK7_0 0xff
  31691. +#define MASK9_4 0x3f0
  31692. +#define MASK9_5 0x3e0
  31693. +#define MASK9_6 0x3c0
  31694. +#define MASK12_0 0x1fff
  31695. +#define MASK12_3 0x1ff8
  31696. +#define MASK31_6 0xffffffc0
  31697. +#define MASK31_9 0xfffffe00
  31698. +#define MASK31_19 0xfff80000
  31699. +#define MASK31_22 0xffc00000
  31700. +
  31701. +/* #define DEBUG33 1 */
  31702. +
  31703. +/* >>>>> D.Fujimoto 2007/10/04 string buffer size for objdump output */
  31704. +#define DUMP_OUTPUT_BUF_SIZE 512
  31705. +#define SYMBOL_NAME_BUF_SIZE 256
  31706. +/* <<<<< D.Fujimoto 2007/10/04 string buffer size for objdump output */
  31707. +
  31708. +/* >>>>> D.Fujimoto 2007/10/04 declare prototypes */
  31709. +static UINT8
  31710. +fnCrGetExtType(UINT32 ulCode,int *iExtType, int *iCalcType);
  31711. +static UINT32
  31712. +fnCrCalcImmVal(int nExtInst, int iCalcType, UINT32 ulExt1, UINT32 ulExt2, UINT32 ulCode);
  31713. +static UINT8
  31714. +fnCrGetXinst(UINT32 ulCode, UINT32 ulImmVal,int iExtType, ADDR tdAddr, INT8 *szXinst, int iArraySize, INT8 *szTmp, int iExtCnt, struct disassemble_info *info);
  31715. +static void
  31716. +vfnDisasm (unsigned short uwCode, char *pszBuf);
  31717. +static void
  31718. +vfnDisasmClass0 (unsigned short uwCode, char *pszBuf);
  31719. +static void
  31720. +vfnDisasmClass1 (unsigned short uwCode, char *pszBuf);
  31721. +static void
  31722. +vfnDisasmClass2 (unsigned short uwCode, char *pszBuf);
  31723. +static void
  31724. +vfnDisasmClass3 (unsigned short uwCode, char *pszBuf);
  31725. +static void
  31726. +vfnDisasmClass4 (unsigned short uwCode, char *pszBuf);
  31727. +static void
  31728. +vfnDisasmClass5 (unsigned short uwCode, char *pszBuf);
  31729. +static void
  31730. +vfnDisasmClass6 (unsigned short uwCode, char *pszBuf);
  31731. +static void
  31732. +vfnDisasmClass7 (unsigned short uwCode, char *pszBuf);
  31733. +/* <<<<< D.Fujimoto 2007/10/04 declare prototypes */
  31734. +
  31735. +static int g_iExtCnt = 0;
  31736. +static int g_ExtImm[ 2 ];
  31737. +
  31738. +/* <<<<< add tazaki 2001.09.18 */
  31739. +/* Advanced Macro Opecode name class0 - bit5,4 = 0,1 */
  31740. +extern const char *c33_adv_opcodes[];
  31741. +
  31742. +/* Advanced Macro Opecode name class5 - bit12_8 = 111:11 */
  31743. +extern const char *c33_adv_class5_opcodes[];
  31744. +/* >>>>> add tazaki 2001.09.18 */
  31745. +
  31746. +/* <<<<< add tazaki 2002.02.29 */
  31747. +
  31748. +int g_iShiftFlag =0;
  31749. +const char szOpShift[3][4] = { "sra","sla","sll" };
  31750. +const char szCond[10][4] = { "gt","ge","lt","le","ugt","uge","ult","ule","eq","ne" };
  31751. +
  31752. +/* >>>>> ADDED D.Fujimoto 2007/10/03 for displaying symbol */
  31753. +#include <stdarg.h>
  31754. +static char dummy_buffer[4096], *dummy_p;
  31755. +static int
  31756. +dummy_sprintf (FILE *f, const char *format, ...)
  31757. +{
  31758. + char *buf;
  31759. + va_list args;
  31760. + size_t n;
  31761. +
  31762. + va_start (args, format);
  31763. +
  31764. + vasprintf (&buf, format, args);
  31765. +
  31766. + va_end (args);
  31767. +
  31768. + n = strlen (buf);
  31769. + if (dummy_p + n + 1 < dummy_buffer + sizeof(dummy_buffer)) {
  31770. + strcpy(dummy_p, buf);
  31771. + dummy_p += n;
  31772. + } else {
  31773. + n = 0;
  31774. + }
  31775. +
  31776. + free (buf);
  31777. +
  31778. + return n;
  31779. +}
  31780. +
  31781. +static char *find_symbolname_for_address(bfd_vma vma, struct disassemble_info *info)
  31782. +{
  31783. + char *name;
  31784. + fprintf_ftype saved_fprintf_func;
  31785. +
  31786. + if (!info->symbol_at_address_func(vma, info)) return NULL;
  31787. +
  31788. + dummy_p = dummy_buffer;
  31789. +
  31790. + saved_fprintf_func = info->fprintf_func;
  31791. + info->fprintf_func = (fprintf_ftype)dummy_sprintf;
  31792. +
  31793. + info->print_address_func(vma, info);
  31794. +
  31795. + info->fprintf_func = saved_fprintf_func;
  31796. +
  31797. + name = strrchr(dummy_buffer, '>');
  31798. + if (!name) return NULL;
  31799. + *name = '\0';
  31800. + name = strchr(dummy_buffer, '<');
  31801. + if (!name) return NULL;
  31802. + return name + 1;
  31803. +}
  31804. +/* <<<<< ADDED D.Fujimoto 2007/10/03 */
  31805. +
  31806. +static int
  31807. +disassemble (memaddr, info, insn)
  31808. + bfd_vma memaddr;
  31809. + struct disassemble_info *info;
  31810. + unsigned long insn;
  31811. +{
  31812. +/* struct c33_opcode * op = (struct c33_opcode *)c33_opcodes; */
  31813. + struct c33_opcode * op = (struct c33_opcode *)c33_advance_opcodes; /* tazaki 2001.12.05 */
  31814. +
  31815. + const struct c33_operand * operand;
  31816. + int match = 0;
  31817. + int bytes_read;
  31818. +
  31819. +/* add tazaki 2001.07.31 >>>>> */
  31820. + ADDR tdAddr; /* address of target instruction */
  31821. + INT8 szExtString[DUMP_OUTPUT_BUF_SIZE]; /* extended instruntion string */ // MOD D.Fujimoto 2007/10/04 string buffer size
  31822. + int nExtInst; /* number of ext-instrcution */
  31823. + int iCalcType; /* immediate value calculation type */
  31824. + int iExtType; /* extension type */
  31825. + int i;
  31826. + UINT32 ulImm; /* extended immediate value */
  31827. + UINT32 ulImm1; /* immediate value of first ext_instruction */
  31828. + UINT32 ulImm2; /* immediate value of second ext_instruction */
  31829. + UINT32 ulCode; /* target instruction code */
  31830. + INT8 szMessage[DUMP_OUTPUT_BUF_SIZE]; /* array of mnemonic or warning message */ // MOD D.Fujimoto 2007/10/04 string buffer size
  31831. + INT8 szTmp[DUMP_OUTPUT_BUF_SIZE]; // MOD D.Fujimoto 2007/10/04 string buffer size
  31832. + UINT8 ucErrFlag = NO_ERR;/* error flag */
  31833. + INT8 szDisp[DUMP_OUTPUT_BUF_SIZE]; /* for Get string length compute */ // MOD D.Fujimoto 2007/10/04 string buffer size
  31834. + INT8 szBuf[DUMP_OUTPUT_BUF_SIZE]; /* for Get string length compute work buffer */ // MOD D.Fujimoto 2007/10/04 string buffer size
  31835. + INT8 szName[DUMP_OUTPUT_BUF_SIZE]; // MOD D.Fujimoto 2007/10/04 string buffer size
  31836. + unsigned long insn_wk;
  31837. +/* <<<<< add tazaki 2001.07.31 */
  31838. +
  31839. +
  31840. + bytes_read = 2;
  31841. + insn &= 0xffff;
  31842. +
  31843. + szDisp[0] = 0; /* add tazaki 2001.08.03 */
  31844. +
  31845. + g_iShiftFlag =0;
  31846. +
  31847. +
  31848. + if ((insn & CLASS_MASK) == CLASS1) { /* class1 */
  31849. +
  31850. + g_iShiftFlag = 1;
  31851. +
  31852. + /* Convert Opecode */
  31853. + insn_wk = insn & 0xff00;
  31854. +
  31855. + switch( insn_wk ){
  31856. + case 0x2300: insn_wk = 0x8800; break; /* srl -->class 4 : srl */
  31857. + case 0x2700: insn_wk = 0x8c00; break; /* sll -->class 4 : sll */
  31858. + case 0x2b00: insn_wk = 0x9000; break; /* sra -->class 4 : sra */
  31859. + case 0x2f00: insn_wk = 0x9400; break; /* sla -->class 4 : sla */
  31860. + case 0x3300: insn_wk = 0x9800; break; /* rr -->class 4 : rr */
  31861. + case 0x3700: insn_wk = 0x9c00; break; /* rl -->class 4 : rl */
  31862. + default:
  31863. + g_iShiftFlag = 0;
  31864. + break;
  31865. + }
  31866. + insn = insn_wk | ( insn & 0x00ff );
  31867. + }
  31868. +
  31869. + /* Find the opcode. */
  31870. + while (op->name)
  31871. + {
  31872. +
  31873. + if ((op->mask & insn) == op->opcode)
  31874. + {
  31875. + const unsigned char * opindex_ptr;
  31876. + unsigned int opnum;
  31877. + unsigned int memop;
  31878. + unsigned short uwOp1;
  31879. + unsigned short uwOp2;
  31880. + int i;
  31881. + int iLength;
  31882. +
  31883. +
  31884. + strcpy( szName, op->name );
  31885. +
  31886. +
  31887. + /* Advanced Macro bit5,4 = 0,1 ? add tazaki 2001.09.12 >>> */
  31888. + /* ONLY class0 */
  31889. + if ((insn & CLASS_MASK) == CLASS0) { /* class0 */
  31890. + uwOp1 = insn & 0x1e00;
  31891. + uwOp1 >>= 9;
  31892. + if( uwOp1 < 4 ){
  31893. + if( insn & 0x0010 ){ /* bit5,4 = 0,1 ? */
  31894. + i = 0;
  31895. + while( c33_adv_opcodes[ i ] != 0 ){
  31896. + if( !strcmp( c33_adv_opcodes[ i ], szName ) ){
  31897. + break;
  31898. + }
  31899. + ++i;
  31900. + }
  31901. + if( c33_adv_opcodes[ i ] == 0 ){ /* No found ? */
  31902. + op++;
  31903. + continue; /* skip --> next search */
  31904. + }
  31905. + }
  31906. + }
  31907. + }
  31908. + /* <<< add tazaki 2001.09.12 */
  31909. +
  31910. + /* Advanced Macro bit12-8=111:11 add tazaki 2001.09.18 >>> */
  31911. + /* ONLY class5 */
  31912. + if ((insn & 0xff00) == 0xbf00) { /* class5 111:11 */
  31913. + if( (insn & 0x00c0) == 0x0000 ){ /* do.c imm6 ? */
  31914. + if( strcmp( c33_adv_class5_opcodes[ 0 ], szName )){
  31915. + op++;
  31916. + continue;
  31917. + }
  31918. + }
  31919. + if( (insn & 0x00c0) == 0x0040 ){ /* psrset imm5 ? */
  31920. + if( strcmp( c33_adv_class5_opcodes[ 1 ], szName )){
  31921. + op++;
  31922. + continue;
  31923. + }
  31924. + }
  31925. + if( (insn & 0x00c0) == 0x0080 ){ /* psrclr imm5 ? */
  31926. + if( strcmp( c33_adv_class5_opcodes[ 2 ], szName )){
  31927. + op++;
  31928. + continue;
  31929. + }
  31930. + }
  31931. +
  31932. + }
  31933. + /* <<< add tazaki 2001.09.12 */
  31934. +
  31935. + /* add tazaki 2001.08.03 >>>>> TAB数の計算 */
  31936. +
  31937. + match = 1;
  31938. +
  31939. + (*info->fprintf_func) (info->stream, " %s", szName);
  31940. + sprintf( szBuf," %s", szName );
  31941. + strcat( szDisp,szBuf );
  31942. +
  31943. + iLength = 8 - strlen( szName );
  31944. + for( i = 0; i < iLength; ++i ){
  31945. + (*info->fprintf_func) (info->stream, " ");
  31946. + strcat( szDisp," " );
  31947. + }
  31948. + /* <<<<< add tazaki 2001.08.03 */
  31949. +
  31950. +
  31951. + memop = op->memop;
  31952. + /* Now print the operands.
  31953. +
  31954. + MEMOP is the operand number at which a memory
  31955. + address specification starts, or zero if this
  31956. + instruction has no memory addresses.
  31957. +
  31958. + A memory address is always two arguments.
  31959. +
  31960. + This information allows us to determine when to
  31961. + insert commas into the output stream as well as
  31962. + when to insert disp[reg] expressions onto the
  31963. + output stream. */
  31964. +
  31965. + for (opindex_ptr = op->operands, opnum = 1;
  31966. + *opindex_ptr != 0;
  31967. + opindex_ptr++, opnum++)
  31968. + {
  31969. + long value;
  31970. + long value2;
  31971. + long value3;
  31972. + int flag;
  31973. + int status;
  31974. + bfd_byte buffer[ 4 ];
  31975. + int i_op_match;
  31976. +
  31977. + operand = &c33_operands[*opindex_ptr];
  31978. +
  31979. + if (operand->extract)
  31980. + value = (operand->extract) (insn, 0);
  31981. + else
  31982. + {
  31983. + value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
  31984. + }
  31985. +
  31986. + if (opnum > 1) {
  31987. + info->fprintf_func (info->stream, ",");
  31988. + sprintf( szBuf,"," ); /* add tazaki 2001.08.03 */
  31989. + strcat( szDisp,szBuf ); /* add tazaki 2001.08.03 */
  31990. + }
  31991. + /* extract the flags, ignorng ones which do not effect disassembly output. */
  31992. + flag = operand->flags;
  31993. +
  31994. + i_op_match = 0;
  31995. + /* >>> add tazaki 2002.02.29 */
  31996. +
  31997. + if( !strcmp( szName,"ext" ) )
  31998. + {
  31999. + if ((insn & 0xff00) == 0x3b00) { /* class1 001:11011 */
  32000. + if( (insn & 0x00f0) == 0x0000 ){
  32001. + /* ext OP,imm2 */
  32002. + value = insn & 0x000c;
  32003. + value >>= 2;
  32004. + value2 = insn & 0x0003;
  32005. + if( value > 0 ){
  32006. + info->fprintf_func (info->stream, "%s,0x%x", szOpShift[ value - 1],value2 );
  32007. + sprintf( szBuf,"%s,0x%x", szOpShift[ value - 1],value2 );
  32008. + strcat( szDisp,szBuf );
  32009. + i_op_match = 1;
  32010. + }
  32011. + }
  32012. + else
  32013. + {
  32014. + /* ext cond */
  32015. + value = insn & 0x00f0;
  32016. + value >>= 4;
  32017. +/* >>>>> MODIFIED D.Fujimoto 2008/05/22 disassemble hangs when processing with -D */
  32018. +// if( value >= 4 ){
  32019. + if( value >= 4 && value - 4 < 10 ){ // depends on szCond index
  32020. +/* <<<<< MODIFIED D.Fujimoto 2008/05/22 disassemble hangs when processing with -D */
  32021. + info->fprintf_func (info->stream, "%s", szCond[ value - 4] );
  32022. + sprintf( szBuf,"%s", szCond[ value - 4] );
  32023. + strcat( szDisp,szBuf );
  32024. + i_op_match = 1;
  32025. + }
  32026. + }
  32027. +
  32028. + }
  32029. + if ((insn & 0xff00) == 0x3f00) { /* class1 001:11111 */
  32030. + if( (insn & 0x000f) != 0x0000 ){
  32031. + /* ext %rs,OP,imm2 */
  32032. + value = insn & 0x00f0;
  32033. + value >>= 4;
  32034. + value2 = insn & 0x000c;
  32035. + value2 >>= 2;
  32036. + value3 = insn & 0x0003;
  32037. + if( value2 >= 1 ){
  32038. + info->fprintf_func (info->stream, "%s,%s,0x%x",
  32039. + c33_reg_names[value],
  32040. + szOpShift[ value2 - 1 ],
  32041. + value3
  32042. + );
  32043. + sprintf( szBuf, "%s,%s,0x%x",
  32044. + c33_reg_names[value],
  32045. + szOpShift[ value2 - 1 ],
  32046. + value3
  32047. + );
  32048. + strcat( szDisp,szBuf );
  32049. + i_op_match = 1;
  32050. + }
  32051. + }
  32052. + else
  32053. + {
  32054. + /* ext %rs */
  32055. + value = insn & 0x00f0;
  32056. + value >>= 4;
  32057. + info->fprintf_func (info->stream, "%s", c33_reg_names[value] );
  32058. + sprintf( szBuf,"%s", c33_reg_names[value] );
  32059. + strcat( szDisp,szBuf );
  32060. + i_op_match = 1;
  32061. + }
  32062. + }
  32063. + }
  32064. +
  32065. + if( i_op_match == 0 )
  32066. + {
  32067. + if( flag == C33_OPERAND_LD_SREG ){
  32068. + flag = C33_OPERAND_SREG;
  32069. + }
  32070. + if( flag == (C33_OPERAND_PUSHS_SREG | C33_OPERAND_01) ){
  32071. + flag = C33_OPERAND_SREG;
  32072. + }
  32073. + if( flag == ( C33_OPERAND_DP | C33_OPERAND_01 ) ){
  32074. + flag &= ( C33_OPERAND_01 ^ 0xffff );
  32075. + }
  32076. +
  32077. + if( flag != C33_OPERAND_DPMEM && flag != C33_OPERAND_DP ) {
  32078. + flag &= - flag;
  32079. + }
  32080. +
  32081. + switch (flag)
  32082. + {
  32083. +
  32084. + case C33_OPERAND_MEM :
  32085. + info->fprintf_func (info->stream, "[0x%x]", value);
  32086. + sprintf( szBuf,"[0x%x]", value );
  32087. + strcat( szDisp,szBuf );
  32088. + break;
  32089. +
  32090. + case C33_OPERAND_SPMEM :
  32091. + info->fprintf_func (info->stream, "[%%sp+0x%x]", value); /* [%sp+imm6] */
  32092. + sprintf( szBuf,"[%%sp+0x%x]", value );
  32093. + strcat( szDisp,szBuf );
  32094. + break;
  32095. +
  32096. + case C33_OPERAND_DPMEM :
  32097. + info->fprintf_func (info->stream, "[%%dp+0x%x]", value); /* [%dp+imm6] */
  32098. + sprintf( szBuf,"[%%dp+0x%x]", value );
  32099. + strcat( szDisp,szBuf );
  32100. + break;
  32101. +
  32102. + case C33_OPERAND_REG:
  32103. + info->fprintf_func (info->stream, "%s", c33_reg_names[value]);
  32104. + sprintf( szBuf,"%s", c33_reg_names[value] );
  32105. + strcat( szDisp,szBuf );
  32106. + break;
  32107. +
  32108. + case C33_OPERAND_SREG:
  32109. + info->fprintf_func (info->stream, "%s", c33_sreg_names[value]);
  32110. + sprintf( szBuf,"%s", c33_sreg_names[value] );
  32111. + strcat( szDisp,szBuf );
  32112. + break;
  32113. +
  32114. +
  32115. + case C33_OPERAND_REGINC :
  32116. + info->fprintf_func (info->stream, "[%s]+", c33_reg_names[value]);
  32117. + sprintf( szBuf,"[%s]+", c33_reg_names[value] );
  32118. + strcat( szDisp,szBuf );
  32119. + break;
  32120. +
  32121. + case C33_OPERAND_RB :
  32122. + info->fprintf_func (info->stream, "[%s]", c33_reg_names[value]);
  32123. + sprintf( szBuf,"[%s]", c33_reg_names[value] );
  32124. + strcat( szDisp,szBuf );
  32125. + break;
  32126. +
  32127. + case C33_OPERAND_SP :
  32128. + info->fprintf_func (info->stream, "%%sp");
  32129. + sprintf( szBuf,"%%sp" );
  32130. + strcat( szDisp,szBuf );
  32131. + break;
  32132. +
  32133. + case C33_OPERAND_DP :
  32134. + info->fprintf_func (info->stream, "%%dp");
  32135. + sprintf( szBuf,"%%dp" );
  32136. + strcat( szDisp,szBuf );
  32137. + break;
  32138. +
  32139. + case C33_OPERAND_IMM :
  32140. + if( g_iShiftFlag == 1 ){
  32141. + value += 16; /* shift : imm + 16 */
  32142. + }
  32143. + case C33_OPERAND_SIGNED :
  32144. + default:
  32145. + info->fprintf_func (info->stream, "0x%x", value);
  32146. + sprintf( szBuf,"0x%x", value );
  32147. + strcat( szDisp,szBuf );
  32148. + break;
  32149. +
  32150. + }
  32151. + }
  32152. + else
  32153. + {
  32154. + break; // exit operand loop
  32155. + }
  32156. + }
  32157. +
  32158. + /* All done. */
  32159. + break; /* exit while loop */
  32160. + }
  32161. + op++;
  32162. + }
  32163. +
  32164. + /* not found opcode ? */
  32165. + if (!match)
  32166. + {
  32167. + info->fprintf_func (info->stream, " .short\t0x%04x", insn);
  32168. + g_iExtCnt = 0;
  32169. + return bytes_read;
  32170. + }
  32171. +
  32172. +
  32173. +/* add tazaki 2001.07.31 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */
  32174. +
  32175. + /*==========================================*/
  32176. + /* Extended Instruction Display */
  32177. + /*==========================================*/
  32178. + /* insn : 16 bit */
  32179. +
  32180. + if( ( insn & CLASS_MASK ) == CLASS6 ){ /* ext ? */
  32181. + if( g_iExtCnt == 2 ){
  32182. + g_ExtImm[ 1 ] = insn & CLASS6_DATA;
  32183. + }else{
  32184. + g_ExtImm[g_iExtCnt] = insn & CLASS6_DATA;
  32185. + }
  32186. + if( g_iExtCnt < 2 ){
  32187. + ++g_iExtCnt; /* increment ext counter */
  32188. + }
  32189. + return bytes_read;
  32190. + }
  32191. +
  32192. + ulCode = insn;
  32193. + ulImm1 = ulImm2 = 0;
  32194. + if( g_iExtCnt == 2 ){
  32195. + ulImm1 = g_ExtImm[ 0 ];
  32196. + ulImm2 = g_ExtImm[ 1 ];
  32197. + }else if( g_iExtCnt == 1 ){
  32198. + ulImm2 = g_ExtImm[ 0 ];
  32199. + }
  32200. +
  32201. + nExtInst = g_iExtCnt;
  32202. +
  32203. + tdAddr = memaddr; /* offset address set */
  32204. +
  32205. +/* >>>>> DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
  32206. +// if( g_iExtCnt > 0 ){
  32207. +/* <<<<< DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
  32208. +
  32209. + /* analize instruction code */ /* extention type and calculation type */
  32210. + ucErrFlag = fnCrGetExtType(ulCode, &iExtType, &iCalcType);
  32211. +
  32212. + if (ucErrFlag == NO_ERR) { /* the target instruction is extendable */
  32213. + /* calculate extended immediate value */
  32214. + ulImm = fnCrCalcImmVal(nExtInst, iCalcType, ulImm1, ulImm2, ulCode);
  32215. +
  32216. + /* make extended instruction */
  32217. +/* >>>>> MODIFIED D.Fujimoto 2007/10/03 added info as param */
  32218. +// ucErrFlag = fnCrGetXinst(ulCode, ulImm, iExtType, tdAddr, szMessage, 256, szTmp);
  32219. + ucErrFlag = fnCrGetXinst(ulCode, ulImm, iExtType, tdAddr, szMessage, DUMP_OUTPUT_BUF_SIZE, szTmp, g_iExtCnt, info);
  32220. +/* <<<<< MODIFIED D.Fujimoto 2007/10/03 added info as param */
  32221. +
  32222. + if (ucErrFlag == NO_ERR) { /* not disassemble error */
  32223. + if( strlen( szMessage ) > 0 ){
  32224. + strcpy( (INT8 *)szExtString, szMessage );
  32225. + szExtString[ strlen(szExtString)-1 ] = 0;
  32226. +
  32227. + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
  32228. + info->fprintf_func (info->stream, " ");
  32229. + }
  32230. + info->fprintf_func (info->stream, "%s", szExtString);
  32231. + }
  32232. +/* >>>>> ADDED D.Fujimoto 2007/10/10 display plain mnemonic */
  32233. + } else if (ucErrFlag == QUIT) {
  32234. + /* get mnemonic code */
  32235. + vfnDisasm ((unsigned short)ulCode, szTmp);
  32236. + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
  32237. + info->fprintf_func (info->stream, " ");
  32238. + }
  32239. + info->fprintf_func (info->stream, "%s", szTmp);
  32240. +/* <<<<< ADDED D.Fujimoto 2007/10/10 display plain mnemonic */
  32241. + }
  32242. +/* >>>>> MODIFIED D.Fujimoto 2007/10/04 display when ERR and ERR2 */
  32243. +// }else if (ucErrFlag == ERR) {
  32244. + } else {
  32245. +/* <<<<< MODIFIED D.Fujimoto 2007/10/04 display when ERR and ERR2 */
  32246. + /* get mnemonic code */
  32247. + vfnDisasm ((unsigned short)ulCode, szTmp);
  32248. + for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
  32249. + info->fprintf_func (info->stream, " ");
  32250. + }
  32251. + info->fprintf_func (info->stream, "%s", szTmp);
  32252. + }
  32253. +
  32254. +/* >>>>> DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
  32255. +// }else{
  32256. +// /* get mnemonic code */
  32257. +// vfnDisasm ((unsigned short)ulCode, szTmp);
  32258. +// for( i = 0; i < ( 26 - strlen( szDisp ) ); ++i ){
  32259. +// info->fprintf_func (info->stream, " ");
  32260. +// }
  32261. +// info->fprintf_func (info->stream, "%s", szTmp);
  32262. +//
  32263. +// }
  32264. +/* <<<<< DELETED D.Fujimoto 2007/10/03 iExtCnt == 0 will also use these routines */
  32265. +
  32266. + g_iExtCnt = 0; /* clear ext inst counter */
  32267. +
  32268. + return bytes_read;
  32269. +}
  32270. +
  32271. +static UINT8
  32272. +fnCrGetExtType(ulCode,iExtType,iCalcType)
  32273. +
  32274. + /***************************************************************
  32275. + *
  32276. + * --- Get the extention type and
  32277. + * the immediate calculation type ---
  32278. + *
  32279. + * Check the extention type (set to the parameter2) and
  32280. + * immediate value calculation type (set to the parameter3).
  32281. + *
  32282. + * RETURN: NO_ERR: the target instruction is extendable
  32283. + * ERR : the target instruction cannot be extended
  32284. + *
  32285. + ***************************************************************/
  32286. +
  32287. + UINT32 ulCode; /* target instruction */
  32288. + int *iExtType; /* extention type, 1-3 */
  32289. + int *iCalcType; /* immediate value calculation type, 1-5 */
  32290. +
  32291. +{
  32292. + UINT32 ulOp1; /* op1 */
  32293. + UINT32 ulOp2; /* op2 */
  32294. + UINT8 ucErrFlag = ERR; /* error flag */
  32295. +
  32296. + /* get the extention type and the immediate calculation type, according to the class */
  32297. + switch (ulCode & CLASS_MASK) { /* switch by class type */
  32298. + case CLASS0:
  32299. + if ((ulCode & 0xfff0 )== 0x0350) { /* add %rd,%dp ? */
  32300. + ucErrFlag = ERR2; /* not show 3 operand. add tazaki 2001.12.21 */
  32301. + }else{
  32302. + ulOp1 = (ulCode >> 0x9) & 0xf; /* bit12:9 */
  32303. + if ((ulOp1 & 0xc) != 0x0) { /* not OP1 = 00XX, illeagal */
  32304. + ucErrFlag = NO_ERR;
  32305. + *iExtType = EXT1;
  32306. + *iCalcType = CALC1;
  32307. + }
  32308. + }
  32309. + break;
  32310. +
  32311. + case CLASS1:
  32312. + if (((ulCode & BIT8) == 0x0) && ((ulCode & BIT9) == 0x0)) { /* load/store */
  32313. + ucErrFlag = NO_ERR;
  32314. + *iExtType = EXT2;
  32315. + *iCalcType = CALC2;
  32316. + }
  32317. + else{
  32318. + if (((ulCode & BIT8) == 0x0) && ((ulCode & BIT9) != 0x0)) {/* numeric/logical/compare */
  32319. + if ( ((ulCode & BIT10) != 0x0) && ((ulCode & BIT11) != 0x0) && ((ulCode & BIT12) != 0x0)) { /* not ? */
  32320. + ulOp1 = (ulCode >> 0xa) & 0x7;
  32321. + if ((ulOp1 != 0x3) && (ulOp1 != 0x7)) {
  32322. + ucErrFlag = NO_ERR;
  32323. + *iExtType = EXT3;
  32324. + *iCalcType = CALC2;
  32325. + }
  32326. + }else{
  32327. + ucErrFlag = ERR2; /* not show 3 operand. add tazaki 2001.11.06 */
  32328. + }
  32329. + }
  32330. + }
  32331. + break;
  32332. +
  32333. + case CLASS2:
  32334. + ucErrFlag = NO_ERR;
  32335. + *iExtType = EXT1;
  32336. +
  32337. + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
  32338. + if (((ulOp1 & 0x6) == 0x0) || (ulOp1 == 0x5)) { /* byte type */
  32339. + *iCalcType = CALC3_BYTE;
  32340. + }
  32341. + else if (((ulOp1 & 0x6) == 0x2) || (ulOp1 == 0x6)) { /* half word type */
  32342. + *iCalcType = CALC3_HALF;
  32343. + }
  32344. + else { /* word type */
  32345. + *iCalcType = CALC3_WORD;
  32346. + }
  32347. + break;
  32348. +
  32349. + case CLASS3:
  32350. + ucErrFlag = NO_ERR;
  32351. + *iExtType = EXT1;
  32352. +
  32353. + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
  32354. + if ((ulOp1 & 0x6) == 0x0) { /* OP1 = 00x, imm6 type */
  32355. + *iCalcType = CALC4;
  32356. + }
  32357. + else { /* sign6 type */
  32358. + *iCalcType = CALC5;
  32359. + }
  32360. + break;
  32361. +
  32362. + case CLASS5:
  32363. + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
  32364. + ulOp2 = (ulCode >> 0x8) & 0x3; /* bit9:8 */
  32365. + if ((ulOp1 == 0x2) || (ulOp1 == 0x3) || (ulOp1 == 0x4) || (ulOp1 == 0x5)) {
  32366. + if ((ulOp2 == 0x0) && ((ulCode & BIT3) == 0x0)) {
  32367. + ucErrFlag = NO_ERR;
  32368. + *iExtType = EXT2;
  32369. + *iCalcType = CALC2;
  32370. + }
  32371. + }
  32372. + break;
  32373. +
  32374. + /* >>> add tazaki 2001.09.19 */
  32375. +
  32376. + case CLASS7:
  32377. + ucErrFlag = NO_ERR;
  32378. + *iExtType = EXT1;
  32379. +
  32380. + ulOp1 = (ulCode >> 0xa) & 0x7; /* bit12:10 */
  32381. + if (((ulOp1 & 0x6) == 0x0) || (ulOp1 == 0x5)) { /* byte type */
  32382. + *iCalcType = CALC3_BYTE;
  32383. + }
  32384. + else if (((ulOp1 & 0x6) == 0x2) || (ulOp1 == 0x6)) { /* half word type */
  32385. + *iCalcType = CALC3_HALF;
  32386. + }
  32387. + else { /* word type */
  32388. + *iCalcType = CALC3_WORD;
  32389. + }
  32390. + break;
  32391. +
  32392. + /* >>> add tazaki 2001.09.19 */
  32393. +
  32394. + }
  32395. +
  32396. + return ucErrFlag;
  32397. +}
  32398. +
  32399. +
  32400. +
  32401. +static UINT32
  32402. +fnCrCalcImmVal(nExtInst,iCalcType,ulExt1,ulExt2,ulCode)
  32403. +
  32404. + /***************************************************************
  32405. + *
  32406. + * --- Calculate the extended immediate value ---
  32407. + *
  32408. + * Calculate the extended immediate value according to the
  32409. + * extention type and the immediate value calculation type.
  32410. + *
  32411. + * RETURN: extended immediate value
  32412. + *
  32413. + ***************************************************************/
  32414. +
  32415. + int nExtInst; /* extention type, 1-3 */
  32416. + int iCalcType; /* immediate value calculation type, 1-5 */
  32417. + UINT32 ulExt1; /* immediate value of ext1 */
  32418. + UINT32 ulExt2; /* immediate value of ext2 */
  32419. + UINT32 ulCode; /* target instruction code */
  32420. +
  32421. +{
  32422. + UINT32 ulImm32; /* extended immediate value */
  32423. +
  32424. + /* clear not ext-instruction code */
  32425. + if (nExtInst == 0) {
  32426. + ulExt1 = 0x0;
  32427. + ulExt2 = 0x0;
  32428. + }
  32429. + else if (nExtInst == 1) {
  32430. + ulExt1 = 0x0;
  32431. + }
  32432. +
  32433. + /* calculate immediate value according to iCalcType */
  32434. + switch (iCalcType) {
  32435. + case CALC1: /* ext1[bit12:3] + ext2[bit12:0] + IR[bit7:0]"0" */
  32436. + ulImm32 = ((ulExt1 & MASK12_3) << 19)
  32437. + + ((ulExt2 & MASK12_0) << 9) + ((ulCode & MASK7_0) << 1);
  32438. +
  32439. + /* sign extention */
  32440. + if (nExtInst == 0) {
  32441. + if ((ulCode & BIT7) != 0x0) {
  32442. + ulImm32 |= MASK31_9;
  32443. + }
  32444. + }
  32445. + else if (nExtInst == 1) {
  32446. + if ((ulExt2 & BIT12) != 0x0) {
  32447. + ulImm32 |= MASK31_22;
  32448. + }
  32449. + }
  32450. + break;
  32451. +
  32452. + case CALC2: /* ext1[bit12:0] + ext2[bit12:0] */
  32453. + ulImm32 = ((ulExt1 & MASK12_0) << 13) + (ulExt2 & MASK12_0);
  32454. + break;
  32455. +
  32456. + case CALC3_BYTE:
  32457. + case CALC4: /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:4] */
  32458. + ulImm32 = ((ulExt1 & MASK12_0) << 19)
  32459. + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_4) >> 4);
  32460. + break;
  32461. +
  32462. + case CALC3_HALF:
  32463. + if (nExtInst == 0) { /* IR[bit9:4]"0" */
  32464. + ulImm32 = (ulCode & MASK9_4) >> 3;
  32465. + ulImm32 &= ~BIT0;
  32466. + }
  32467. + else { /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:5]"0" */
  32468. + ulImm32 =((ulExt1 & MASK12_0) << 19)
  32469. + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_5) >> 4);
  32470. + ulImm32 &= ~BIT0;
  32471. + }
  32472. + break;
  32473. +
  32474. + case CALC3_WORD:
  32475. + if (nExtInst == 0) { /* IR[bit9:4]"00" */
  32476. + ulImm32 = (ulCode & MASK9_4) >> 2;
  32477. + ulImm32 &= ~MASK1_0;
  32478. + }
  32479. + else { /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:6]"00" */
  32480. + ulImm32 =((ulExt1 & MASK12_0) << 19)
  32481. + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_6) >> 4);
  32482. + ulImm32 &= ~MASK1_0;
  32483. + }
  32484. + break;
  32485. +
  32486. + case CALC5: /* ext1[bit12:0] + ext2[bit12:0] + IR[bit9:4] */
  32487. + ulImm32 = ((ulExt1 & MASK12_0) << 19)
  32488. + + ((ulExt2 & MASK12_0) << 6) + ((ulCode & MASK9_4) >> 4);
  32489. +
  32490. + /* sign extention */
  32491. + if (nExtInst == 0) {
  32492. + if ((ulCode & BIT9) != 0x0) {
  32493. + ulImm32 |= MASK31_6;
  32494. + }
  32495. + }
  32496. + else if (nExtInst == 1) {
  32497. + if ((ulExt2 & BIT12) != 0x0) {
  32498. + ulImm32 |= MASK31_19;
  32499. + }
  32500. + }
  32501. +
  32502. + break;
  32503. +
  32504. + default: /* this may not be occured */
  32505. + ulImm32 = 0;
  32506. + break;
  32507. + } /* end of switch */
  32508. +
  32509. + return ulImm32;
  32510. +}
  32511. +
  32512. +/* >>>>> MODIFIED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32513. +//static UINT8
  32514. +//fnCrGetXinst(ulCode,ulImmVal,iExtType,tdAddr,szXinst,iArraySize,szTmp)
  32515. +static UINT8
  32516. +fnCrGetXinst(ulCode,ulImmVal,iExtType,tdAddr,szXinst,iArraySize,szTmp, iExtCnt, info)
  32517. +/* <<<<< MODIFIED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32518. +
  32519. + /***************************************************************
  32520. + *
  32521. + * --- Make output string ---
  32522. + *
  32523. + * Get extended mnemonic code from instruction code.
  32524. + * Replace extended immediate value with original immediate
  32525. + * value or add extended immediate value according to the
  32526. + * extention type.
  32527. + * If instruction is one of branch instruction, destination
  32528. + * address is added to the extended mnemonic code.
  32529. + *
  32530. + * RETURN: NO_ERR success
  32531. + * ERR cannot get correct mnemonic
  32532. + *
  32533. + ***************************************************************/
  32534. +
  32535. + UINT32 ulCode; /* target instruction code */
  32536. + UINT32 ulImmVal; /* extended immediate value */
  32537. + int iExtType; /* extention type, 1-3 */
  32538. + ADDR tdAddr; /* address of target instruction */
  32539. + INT8 *szXinst; /* extended mnemonic code */
  32540. + int iArraySize; /* size of szXinst */
  32541. + INT8 *szTmp; /* extended mnemonic code */
  32542. +/* >>>>> ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32543. + int iExtCnt; /* size of szXinst */
  32544. + struct disassemble_info *info;
  32545. +/* <<<<< ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32546. +{
  32547. +/* INT8 szTmp[256]; */ /* temporal array */
  32548. +/* >>>>> MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
  32549. +// INT8 szImm32[32]; /* immediate value */
  32550. + INT8 szImm32[DUMP_OUTPUT_BUF_SIZE]; /* immediate value */
  32551. +/* <<<<< MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
  32552. + INT8 *pchCutText; /* pointer to the character to be replaced */
  32553. + INT8 *pchNextToCutText; /* pointer next to the character to be replaced */
  32554. + INT8 *pchMnemonic; /* pointer to the extended mnemonic code */
  32555. + INT8 *pchCopyChar; /* pointer to the original memonic code */
  32556. + UINT32 ulOp1; /* OP code to check if branch instruction or not */
  32557. + UINT8 ucErrFlag = ERR; /* error flag */
  32558. + int iIsBranch = NO; /* branch instruction check flag */
  32559. +/* >>>>> ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32560. + char *name; /* symbol name for display */
  32561. + char nameBuf[SYMBOL_NAME_BUF_SIZE]; // length should be under szImm32
  32562. + int iAbbrevStrLength;
  32563. + UINT32 sign8Val = 0;
  32564. + enum eOpcode {add, sub, cmp, ld, and, or, xor, not};
  32565. + enum eOpcode opc3 = ld; // class3 opecode
  32566. +/* <<<<< ADDED D.Fujimoto 2007/10/03 added params for displaying symbols */
  32567. +
  32568. +/* >>>>> MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
  32569. +// if( iArraySize > 256){
  32570. + if( iArraySize > DUMP_OUTPUT_BUF_SIZE){
  32571. + return ucErrFlag;
  32572. + }
  32573. +/* <<<<< MOD D.Fujimoto 2007/10/03 increased buffer for long symbol names */
  32574. +
  32575. + /* get mnemonic code */
  32576. + vfnDisasm ((unsigned short)ulCode, szTmp);
  32577. +
  32578. + /* set the pointer, according to the extention type */
  32579. + switch(iExtType) {
  32580. + case EXT1: /* immediate value ---> extended immediate value */
  32581. + pchCutText = szTmp;
  32582. +
  32583. + /* search immediate value */
  32584. + while((pchCutText = strchr(pchCutText, '0')) != NULL) {
  32585. + if (strncmp(pchCutText, "0x", 2) == 0) { /* immediate value starts with "0x" */
  32586. + pchNextToCutText = pchCutText + 2;
  32587. + while (isxdigit(*pchNextToCutText) != 0) { /* search the end of immediate value */
  32588. + ++pchNextToCutText;
  32589. + }
  32590. +
  32591. + ucErrFlag = NO_ERR;
  32592. + break;
  32593. + }
  32594. + else {
  32595. + ++pchCutText; /* feed for next search */
  32596. + }
  32597. + }
  32598. + break;
  32599. +
  32600. + case EXT2: /* add displace ment */
  32601. +/* >>>>> MODIFIED D.Fujimoto 2007/10/10 display plain mnemonic */
  32602. +// pchNextToCutText = strchr(szTmp, ']');
  32603. +// if (pchNextToCutText != NULL) {
  32604. +// pchCutText = pchNextToCutText;
  32605. +// ucErrFlag = NO_ERR;
  32606. +// }
  32607. +
  32608. + if (iExtCnt != 0) {
  32609. + pchNextToCutText = strchr(szTmp, ']');
  32610. + if (pchNextToCutText != NULL) {
  32611. + pchCutText = pchNextToCutText;
  32612. + ucErrFlag = NO_ERR;
  32613. + }
  32614. + } else {
  32615. + // do not add displacement, disasm shown in disassemble()
  32616. + ucErrFlag = QUIT;
  32617. + }
  32618. +/* <<<<< MODIFIED D.Fujimoto 2007/10/10 display plain mnemonic */
  32619. +
  32620. + break;
  32621. +
  32622. + case EXT3: /* three opeland */
  32623. + pchNextToCutText = strchr(szTmp, '\0');
  32624. + if (pchNextToCutText != NULL) {
  32625. + pchCutText = pchNextToCutText;
  32626. + ucErrFlag = NO_ERR;
  32627. + }
  32628. + break;
  32629. +
  32630. + default:
  32631. + break;
  32632. + }
  32633. +
  32634. + /* get extended mnemonic code */
  32635. + if (ucErrFlag == NO_ERR) {
  32636. +/* >>>>> MODIFIED D.Fujimoto 2007/10/10 do not add 'x' when iExtCnt is 0 */
  32637. +// pchMnemonic = szXinst;
  32638. +// *pchMnemonic = 'x';
  32639. +// ++pchMnemonic;
  32640. +
  32641. + pchMnemonic = szXinst;
  32642. + if (iExtCnt != 0) {
  32643. + *pchMnemonic = 'x';
  32644. + ++pchMnemonic;
  32645. +
  32646. +
  32647. + /* special case */
  32648. + if (strncmp(szTmp, "or", 2) == 0) { /* or ---> xoor */
  32649. + *pchMnemonic = 'o';
  32650. + ++pchMnemonic;
  32651. + }
  32652. + }
  32653. +/* <<<<< MODIFIED D.Fujimoto 2007/10/10 do not add 'x' when iExtCnt is 0 */
  32654. +
  32655. + for (pchCopyChar = szTmp; pchCopyChar < pchCutText;) {
  32656. + *pchMnemonic = *pchCopyChar;
  32657. + ++pchMnemonic;
  32658. + ++pchCopyChar;
  32659. + }
  32660. +
  32661. + switch (iExtType) {
  32662. + case EXT1: /* immediate value ---> extended immediate value */
  32663. + ; /* null */
  32664. + break;
  32665. +
  32666. + case EXT2: /* add displace ment */
  32667. + *pchMnemonic = '+';
  32668. + ++pchMnemonic;
  32669. + break;
  32670. +
  32671. + case EXT3: /* three opeland */
  32672. + *pchMnemonic = ',';
  32673. + ++pchMnemonic;
  32674. + break;
  32675. +
  32676. + }
  32677. +
  32678. + /* change immediate value */
  32679. + /* set branch instruction flag, in case of branch instruction */
  32680. + if ((ulCode & CLASS_MASK) == CLASS0) { /* class0 */
  32681. + ulOp1 = (ulCode >> 0x9) & 0xf; /* bit12:9 */
  32682. + if ((ulOp1 & 0xc) != 0x0) { /* branch inst is not OP1 = 00XX, illeagal */
  32683. + iIsBranch = YES;
  32684. +/* >>>>> ADDED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
  32685. + sign8Val = ulCode & 0xff;
  32686. +/* <<<<< ADDED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
  32687. + }
  32688. + }
  32689. +
  32690. + if (iIsBranch == YES) {
  32691. + tdAddr += ulImmVal; /* destination address */
  32692. +/* >>>>> MODIFIED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
  32693. +// sprintf(szImm32, "0x%-8lx (0x%08lX)", ulImmVal, tdAddr);
  32694. + if (iExtCnt == 0) {
  32695. + // sign8
  32696. + sprintf(szImm32, "0x%-8lx (0x%08lX)", sign8Val, tdAddr);
  32697. + } else {
  32698. + sprintf(szImm32, "0x%-8lx (0x%08lX)", ulImmVal, tdAddr);
  32699. + }
  32700. +/* <<<<< MODIFIED D.Fujimoto 2007/10/04 display sign8 val for branches when ext count is 0 */
  32701. + strcpy(pchMnemonic, szImm32);
  32702. +
  32703. +/* >>>>> ADDED D.Fujimoto 2007/10/03 */
  32704. + // show symbol for branch
  32705. + name = find_symbolname_for_address((bfd_vma) tdAddr, info);
  32706. + if (name) {
  32707. + // avoid buffer overflow for szImm32
  32708. + iAbbrevStrLength = strlen("...");
  32709. + if (strlen(name) > SYMBOL_NAME_BUF_SIZE ) { // length of " <>", "..." and '\0'
  32710. + strncpy(nameBuf, name, SYMBOL_NAME_BUF_SIZE); // copy string
  32711. + strncpy(nameBuf + (SYMBOL_NAME_BUF_SIZE - iAbbrevStrLength - 1), "...", iAbbrevStrLength); // replace
  32712. + nameBuf[SYMBOL_NAME_BUF_SIZE - 1] = '\0';
  32713. + } else {
  32714. + strcpy(nameBuf, name);
  32715. + }
  32716. + sprintf(szImm32, " <%s>", nameBuf);
  32717. + strcat(pchMnemonic, szImm32);
  32718. + }
  32719. +
  32720. + strcat(pchMnemonic, pchNextToCutText); /* maybe none */
  32721. +
  32722. +/* <<<<< ADDED D.Fujimoto 2007/10/03 */
  32723. +
  32724. + } else { // not branch
  32725. +/* >>>>> ADDED D.Fujimoto 2007/10/09 */
  32726. + // determine class3 opecode
  32727. + if ((ulCode & CLASS_MASK) == CLASS3) {
  32728. + switch ((ulCode & 0xfc00)) {
  32729. + case 0x6000:
  32730. + opc3 = add;
  32731. + break;
  32732. + case 0x6400:
  32733. + opc3 = sub;
  32734. + break;
  32735. + case 0x6800:
  32736. + opc3 = cmp;
  32737. + break;
  32738. + case 0x6c00:
  32739. + opc3 = ld;
  32740. + break;
  32741. + case 0x7000:
  32742. + opc3 = and;
  32743. + break;
  32744. + case 0x7400:
  32745. + opc3 = or;
  32746. + break;
  32747. + case 0x7800:
  32748. + opc3 = xor;
  32749. + break;
  32750. + case 0x7c00:
  32751. + opc3 = not;
  32752. + break;
  32753. + }
  32754. + } else if (iExtCnt == 0) {
  32755. + // recalculate imm6 value
  32756. + if ((ulCode & CLASS_MASK) == CLASS2) {
  32757. + // ld.* %rd, [%sp+imm6]
  32758. + // ld.* [%sp+imm6], %rs
  32759. + ulImmVal = (ulCode & MASK9_4) >> 4;
  32760. + } else if ((ulCode & CLASS_MASK) == CLASS7) {
  32761. + // ld.* %rd, [%dp+imm6]
  32762. + // ld.* [%dp+imm6], %rs
  32763. + ulImmVal = (ulCode & MASK9_4) >> 4;
  32764. + }
  32765. + }
  32766. +
  32767. +/* <<<<< ADDED D.Fujimoto 2007/10/09 */
  32768. +
  32769. + sprintf(szImm32, "0x%lx", ulImmVal);
  32770. + strcpy(pchMnemonic, szImm32); /* change immediate value */
  32771. + strcat(pchMnemonic, pchNextToCutText);
  32772. +
  32773. +/* >>>>> ADDED D.Fujimoto 2007/10/09 */
  32774. + // skip insns that do not take label operands
  32775. + if ((ulCode & CLASS_MASK) == CLASS3 && opc3 == ld) {
  32776. + // show symbol for normal insn
  32777. + name = find_symbolname_for_address((bfd_vma) ulImmVal, info);
  32778. + if (name) {
  32779. + // avoid buffer overflow for szImm32
  32780. + iAbbrevStrLength = strlen("...");
  32781. + if (strlen(name) > SYMBOL_NAME_BUF_SIZE ) { // length of " <>", "..." and '\0'
  32782. + strncpy(nameBuf, name, SYMBOL_NAME_BUF_SIZE); // copy string
  32783. + strncpy(nameBuf + (SYMBOL_NAME_BUF_SIZE - iAbbrevStrLength - 1), "...", iAbbrevStrLength); // replace
  32784. + nameBuf[SYMBOL_NAME_BUF_SIZE - 1] = '\0';
  32785. + } else {
  32786. + strcpy(nameBuf, name);
  32787. + }
  32788. + sprintf(szImm32, " <%s>", nameBuf);
  32789. + strcat(pchMnemonic, szImm32);
  32790. + }
  32791. + }
  32792. +/* <<<<< ADDED D.Fujimoto 2007/10/09 */
  32793. +
  32794. + }
  32795. + strcat(pchMnemonic, "\n");
  32796. + }
  32797. +
  32798. + return ucErrFlag;
  32799. +}
  32800. +
  32801. +/************************************************
  32802. + * vfnDisasm : execute dis-assemble *
  32803. + ************************************************/
  32804. +
  32805. +static void
  32806. +vfnDisasm (uwCode, pszBuf)
  32807. + unsigned short uwCode; /* 16bit code */
  32808. + char *pszBuf;
  32809. +
  32810. +{
  32811. + unsigned short uwClass;
  32812. +
  32813. + /*@ extract class */
  32814. + uwClass = uwCode & 0xe000;
  32815. + uwClass >>= 13;
  32816. +
  32817. + switch (uwClass) { /* class */
  32818. +
  32819. + case 0: /* class 0 */
  32820. + vfnDisasmClass0 (uwCode, pszBuf);
  32821. + break;
  32822. +
  32823. + case 1: /* class 1 */
  32824. + vfnDisasmClass1 (uwCode, pszBuf);
  32825. + break;
  32826. +
  32827. + case 2: /* class 2 */
  32828. + vfnDisasmClass2 (uwCode, pszBuf);
  32829. + break;
  32830. +
  32831. + case 3: /* class 3 */
  32832. + vfnDisasmClass3 (uwCode, pszBuf);
  32833. + break;
  32834. +
  32835. + case 4: /* class 4 */
  32836. + vfnDisasmClass4 (uwCode, pszBuf);
  32837. + break;
  32838. +
  32839. + case 5: /* class 5 */
  32840. + vfnDisasmClass5 (uwCode, pszBuf);
  32841. + break;
  32842. +
  32843. + case 6: /* class 6 */
  32844. + vfnDisasmClass6 (uwCode, pszBuf);
  32845. + break;
  32846. +
  32847. + case 7: /* class 7 */
  32848. + vfnDisasmClass7 (uwCode, pszBuf);
  32849. + break;
  32850. + }
  32851. +
  32852. + return;
  32853. +}
  32854. +
  32855. +/****************************************************************
  32856. + * vfnDisasmClass0 : execute dis-assemble class0 *
  32857. + ****************************************************************/
  32858. +
  32859. +static void
  32860. +vfnDisasmClass0 (uwCode, pszBuf)
  32861. + unsigned short uwCode; /* 16bit code */
  32862. + char *pszBuf;
  32863. +
  32864. +{
  32865. + unsigned short uwOp1, uwDelay, uwOp2;
  32866. + unsigned short uwBit0_3, uwBit4_5, uwBit0_7;
  32867. + char szTmpBuf[10];
  32868. + char *spSpecialReg[16];
  32869. + int i;
  32870. + int iLoop;
  32871. +
  32872. + /*@ initialize */
  32873. + spSpecialReg[0] = "%psr";
  32874. + spSpecialReg[1] = "%sp";
  32875. + spSpecialReg[2] = "%alr";
  32876. + spSpecialReg[3] = "%ahr";
  32877. + spSpecialReg[4] = "%lco";
  32878. + spSpecialReg[5] = "%lsa";
  32879. + spSpecialReg[6] = "%lea";
  32880. + spSpecialReg[7] = "%sor";
  32881. + spSpecialReg[8] = "%ttbr";
  32882. + spSpecialReg[9] = "%dp";
  32883. + spSpecialReg[10] = "%idir"; /* "" -->"%idir" T.Tazaki 20003/11/18 */
  32884. + spSpecialReg[11] = "%dbbr"; /* "" -->"%dbbr" T.Tazaki 20003/11/18 */
  32885. + spSpecialReg[12] = "";
  32886. + spSpecialReg[13] = "%usp";
  32887. + spSpecialReg[14] = "%ssp";
  32888. + spSpecialReg[15] = "%pc";
  32889. +
  32890. + /*@ extract op1 */
  32891. + uwOp1 = uwCode & 0x1e00;
  32892. + uwOp1 >>= 9;
  32893. +
  32894. + /*@ extract "d" */
  32895. + uwDelay = uwCode & 0x0100;
  32896. + uwDelay >>= 8;
  32897. +
  32898. + if (uwOp1 < 4) {
  32899. + /*@ Yes op1 : 0000 - 0011 */
  32900. +
  32901. + /*@ extract op2 from code */
  32902. + uwOp2 = uwCode & 0x00c0;
  32903. + uwOp2 >>= 6;
  32904. + /*@ extract bit4_5 from code */
  32905. + uwBit4_5 = uwCode & 0x0030;
  32906. + uwBit4_5 >>= 4;
  32907. + /*@ extract bit0_3 from code */
  32908. + uwBit0_3 = uwCode & 0x000f;
  32909. +
  32910. + /*@ check if code is OK */
  32911. + if (uwBit4_5 == 0) {
  32912. + switch (uwOp1 << 2 | uwOp2) { /* instruction */
  32913. +
  32914. + case 0: /* 0000:00 nop */
  32915. +
  32916. + /*@ check if code is OK */
  32917. + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
  32918. + /*@ error */
  32919. + (void) sprintf (pszBuf, "***");
  32920. + }
  32921. + else {
  32922. + (void) sprintf (pszBuf, "nop");
  32923. + }
  32924. + break;
  32925. +
  32926. + case 1: /* 0000:01 slp */
  32927. +
  32928. + /*@ check if code is OK */
  32929. + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
  32930. + /*@ error */
  32931. + (void) sprintf (pszBuf, "***");
  32932. + }
  32933. + else {
  32934. + (void) sprintf (pszBuf, "slp");
  32935. + }
  32936. + break;
  32937. +
  32938. + case 2: /* 0000:10 halt */
  32939. +
  32940. + /*@ check if code is OK */
  32941. + if ((uwDelay != 0) || (uwBit0_3 != 0)) {
  32942. + /*@ error */
  32943. + (void) sprintf (pszBuf, "***");
  32944. + }
  32945. + else {
  32946. + (void) sprintf (pszBuf, "halt");
  32947. + }
  32948. + break;
  32949. +
  32950. + case 3: /* 0000:11 reserved */
  32951. +
  32952. + /*@ error */
  32953. + (void) sprintf (pszBuf, "***");
  32954. + break;
  32955. +
  32956. + case 4: /* 0001:00 pushn rs */
  32957. +
  32958. + /*@ check if code is OK */
  32959. + if (uwDelay != 0) {
  32960. + /*@ error */
  32961. + (void) sprintf (pszBuf, "***");
  32962. + }
  32963. + else {
  32964. + (void) sprintf (pszBuf, "pushn %%r%d", uwBit0_3);
  32965. + }
  32966. + break;
  32967. +
  32968. + case 5: /* 0001:01 popn %rd */
  32969. +
  32970. + /*@ check if code is OK */
  32971. + if (uwDelay != 0) {
  32972. + /*@ error */
  32973. + (void) sprintf (pszBuf, "***");
  32974. + }
  32975. + else {
  32976. + (void) sprintf (pszBuf, "popn %%r%d", uwBit0_3);
  32977. + }
  32978. + break;
  32979. +
  32980. + case 6: /* 0001:10 reserved */
  32981. + /*@ error */
  32982. + (void) sprintf (pszBuf, "***");
  32983. + break;
  32984. +
  32985. + case 7: /* 0001:11 jpr %rb */
  32986. + if (uwDelay != 0) {
  32987. + (void) sprintf (pszBuf, "jpr.d %%r%d", uwBit0_3);
  32988. + }
  32989. + else {
  32990. + (void) sprintf (pszBuf, "jpr %%r%d", uwBit0_3);
  32991. + }
  32992. + break;
  32993. +
  32994. + case 8: /* 0010:00 brk */
  32995. +
  32996. + /*@ check if code is OK */
  32997. + if (uwBit0_3 == 0) {
  32998. + if (uwDelay != 0) {
  32999. + /*@ error */
  33000. + (void) sprintf (pszBuf, "***");
  33001. + }
  33002. + else {
  33003. + (void) sprintf (pszBuf, "brk");
  33004. + }
  33005. + }
  33006. + else {
  33007. + /*@ error */
  33008. + (void) sprintf (pszBuf, "***");
  33009. + }
  33010. + break;
  33011. +
  33012. + case 9: /* 0010:01 retd */
  33013. +
  33014. + /*@ check if code is OK */
  33015. + if (uwBit0_3 == 0) {
  33016. + /*@ check if code is OK */
  33017. + if (uwDelay != 0) {
  33018. + /*@ error */
  33019. + (void) sprintf (pszBuf, "***");
  33020. + }
  33021. + else {
  33022. + (void) sprintf (pszBuf, "retd");
  33023. + }
  33024. + }
  33025. + else {
  33026. + /*@ error */
  33027. + (void) sprintf (pszBuf, "***");
  33028. + }
  33029. + break;
  33030. +
  33031. + case 10: /* 0010:10 int imm2 */
  33032. +
  33033. + /*@ check if code is OK */
  33034. + if ((uwBit0_3 & 0xc) == 0) {
  33035. + /*@ check if code is OK */
  33036. + if (uwDelay != 0) {
  33037. + /*@ error */
  33038. + (void) sprintf (pszBuf, "***");
  33039. + }
  33040. + else {
  33041. + (void) sprintf (pszBuf, "int 0x%x", uwBit0_3);
  33042. + }
  33043. + }
  33044. + else {
  33045. + /*@ error */
  33046. + (void) sprintf (pszBuf, "***");
  33047. + }
  33048. + break;
  33049. +
  33050. + case 11: /* 0010:11 reti */
  33051. +
  33052. + /*@ check if code is OK */
  33053. + if (uwBit0_3 == 0) {
  33054. + /*@ check if code is OK */
  33055. + if (uwDelay != 0) {
  33056. + /*@ error */
  33057. + (void) sprintf (pszBuf, "***");
  33058. + }
  33059. + else {
  33060. + (void) sprintf (pszBuf, "reti");
  33061. + }
  33062. + }
  33063. + else {
  33064. + /*@ error */
  33065. + (void) sprintf (pszBuf, "***");
  33066. + }
  33067. + break;
  33068. +
  33069. + case 12: /* 0011:00 call rb */
  33070. +
  33071. + if (uwDelay != 0) {
  33072. + (void) sprintf (pszBuf, "call.d %%r%d", uwBit0_3);
  33073. + }
  33074. + else {
  33075. + (void) sprintf (pszBuf, "call %%r%d", uwBit0_3);
  33076. + }
  33077. + break;
  33078. +
  33079. + case 13: /* 0011:01 ret */
  33080. +
  33081. + /*@ check if code is OK */
  33082. + if (uwBit0_3 == 0) {
  33083. + /*@ check if code is OK */
  33084. + if (uwDelay != 0) {
  33085. + (void) sprintf (pszBuf, "ret.d");
  33086. + }
  33087. + else {
  33088. + (void) sprintf (pszBuf, "ret");
  33089. + }
  33090. + }
  33091. + else {
  33092. + /*@ error */
  33093. + (void) sprintf (pszBuf, "***");
  33094. + }
  33095. + break;
  33096. +
  33097. + case 14: /* 0011:10 jp rb */
  33098. +
  33099. + if (uwDelay != 0) {
  33100. + (void) sprintf (pszBuf, "jp.d %%r%d", uwBit0_3);
  33101. + }
  33102. + else {
  33103. + (void) sprintf (pszBuf, "jp %%r%d", uwBit0_3);
  33104. + }
  33105. + break;
  33106. +
  33107. + case 15: /* 0011:11 reserved */
  33108. +
  33109. + if (uwDelay == 0) {
  33110. + (void) sprintf (pszBuf, "retm"); /* 2002/10/01 */
  33111. + }
  33112. + else {
  33113. + /*@ error */
  33114. + (void) sprintf (pszBuf, "***");
  33115. + }
  33116. + break;
  33117. + }
  33118. + }
  33119. + else if (uwBit4_5 == 1)
  33120. + {
  33121. + switch (uwOp1 << 2 | uwOp2) { /* instruction */
  33122. +
  33123. + case 0: /* 0000:00 push %rs , d=1 mac.w %rs*/
  33124. +
  33125. + if (uwDelay != 0) {
  33126. + (void) sprintf (pszBuf, "mac.w %%r%d", uwBit0_3);
  33127. + }
  33128. + else {
  33129. + (void) sprintf (pszBuf, "push %%r%d", uwBit0_3);
  33130. + }
  33131. + break;
  33132. +
  33133. + case 1: /* 0000:01 pop %rd , d=1 mac.hw %rs*/
  33134. +
  33135. + if (uwDelay != 0) {
  33136. + (void) sprintf (pszBuf, "mac.hw %%r%d", uwBit0_3);
  33137. + }
  33138. + else {
  33139. + (void) sprintf (pszBuf, "pop %%r%d", uwBit0_3);
  33140. + }
  33141. + break;
  33142. +
  33143. + case 2: /* 0000:10 pushs %ss , d=1 macclr */
  33144. + if (uwDelay != 0) {
  33145. + (void) sprintf (pszBuf, "macclr");
  33146. + }else{
  33147. +// if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){ /* change T.Tazaki 2003/11/18 */
  33148. + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 11)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
  33149. + (void) sprintf (pszBuf, "pushs %s", spSpecialReg[uwBit0_3]);
  33150. + }
  33151. + else {
  33152. + (void) sprintf (pszBuf, "***");
  33153. + }
  33154. + }
  33155. + break;
  33156. +
  33157. + case 3: /* 0000:11 pops %sd , d=1 ld.cf */
  33158. + if (uwDelay != 0) {
  33159. + (void) sprintf (pszBuf, "ld.cf");
  33160. + }else{
  33161. +// if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){ /* change T.Tazaki 2003/11/18 */
  33162. + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 11)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
  33163. + (void) sprintf (pszBuf, "pops %s", spSpecialReg[uwBit0_3]);
  33164. + }
  33165. + else {
  33166. + (void) sprintf (pszBuf, "***");
  33167. + }
  33168. + }
  33169. + break;
  33170. +
  33171. + case 4: /* 0001:00 divu.w %rb */
  33172. + (void) sprintf (pszBuf, "divu.w %%r%d", uwBit0_3);
  33173. + break;
  33174. +
  33175. + case 5: /* 0001:01 div.w %rb , d=1 add &rd,%dp */
  33176. + if (uwDelay != 0) {
  33177. + (void) sprintf (pszBuf, "add %%r%d,%%dp", uwBit0_3);
  33178. + }else {
  33179. + (void) sprintf (pszBuf, "div.w %%r%d", uwBit0_3);
  33180. + }
  33181. + break;
  33182. +
  33183. + case 6: /* 0001:10 repeat %rb */
  33184. + if (uwDelay != 0) {
  33185. + (void) sprintf (pszBuf, "***");
  33186. + }else {
  33187. + (void) sprintf (pszBuf, "repeat %%r%d", uwBit0_3);
  33188. + }
  33189. + break;
  33190. +
  33191. + case 7: /* 0001:11 repeat imm4 */
  33192. + if (uwDelay != 0) {
  33193. + (void) sprintf (pszBuf, "***");
  33194. + }else {
  33195. + (void) sprintf (pszBuf, "repeat 0x%x", uwBit0_3);
  33196. + }
  33197. + break;
  33198. +
  33199. + default:
  33200. + /*@ error */
  33201. + (void) sprintf (pszBuf, "***");
  33202. + break;
  33203. + }
  33204. + }else{
  33205. + /*@ error */
  33206. + (void) sprintf (pszBuf, "***");
  33207. + }
  33208. + }
  33209. + else {
  33210. + /*@ No op1 : 0100 - 1111 */
  33211. +
  33212. + /*@ extract bit0_7 from code */
  33213. + uwBit0_7 = uwCode & 0x00ff;
  33214. +
  33215. + switch (uwOp1) { /* instruction */
  33216. +
  33217. + case 4: /* 0100 jrgt sign9 */
  33218. + (void) sprintf (pszBuf, "jrgt");
  33219. + break;
  33220. +
  33221. + case 5: /* 0101 jrge sign9 */
  33222. +
  33223. + (void) sprintf (pszBuf, "jrge");
  33224. + break;
  33225. +
  33226. + case 6: /* 0110 jrlt sign9 */
  33227. +
  33228. + (void) sprintf (pszBuf, "jrlt");
  33229. + break;
  33230. +
  33231. + case 7: /* 0111 jrle sign9 */
  33232. +
  33233. + (void) sprintf (pszBuf, "jrle");
  33234. + break;
  33235. +
  33236. + case 8: /* 1000 jrugt sign9 */
  33237. +
  33238. + (void) sprintf (pszBuf, "jrugt");
  33239. + break;
  33240. +
  33241. + case 9: /* 1001 jruge sign9 */
  33242. +
  33243. + (void) sprintf (pszBuf, "jruge");
  33244. + break;
  33245. +
  33246. + case 10: /* 1010 jrult sign9 */
  33247. +
  33248. + (void) sprintf (pszBuf, "jrult");
  33249. + break;
  33250. +
  33251. + case 11: /* 1011 jrule sign9 */
  33252. +
  33253. + (void) sprintf (pszBuf, "jrule");
  33254. + break;
  33255. +
  33256. + case 12: /* 1100 jreq sign9 */
  33257. +
  33258. + (void) sprintf (pszBuf, "jreq");
  33259. + break;
  33260. +
  33261. + case 13: /* 1101 jrne sign9 */
  33262. +
  33263. + (void) sprintf (pszBuf, "jrne");
  33264. + break;
  33265. +
  33266. + case 14: /* 1110 call sign9 */
  33267. +
  33268. + (void) sprintf (pszBuf, "call");
  33269. + break;
  33270. +
  33271. + case 15: /* 1111 jp sign9 */
  33272. +
  33273. + (void) sprintf (pszBuf, "jp");
  33274. + break;
  33275. + }
  33276. + /*@ check if "d" bit exist */
  33277. + if (uwDelay != 0) {
  33278. + /*@ add ".d" to mnemonic */
  33279. + (void) strcat (pszBuf, ".d");
  33280. + }
  33281. + iLoop = 9 - strlen( pszBuf );
  33282. + for( i = 0; i < iLoop; ++i ){
  33283. + (void) strcat (pszBuf, " ");
  33284. + }
  33285. +
  33286. + /*@ format mnemonic */
  33287. + /* pszBuf[8] = 0; */
  33288. +
  33289. + /*@ convert immediate value to string */
  33290. + (void) sprintf (&szTmpBuf[0], "0x%x", uwBit0_7);
  33291. +
  33292. + /*@ concatenate mnemonic and string */
  33293. + (void) strcat (pszBuf, &szTmpBuf[0]);
  33294. + }
  33295. +
  33296. + return;
  33297. +}
  33298. +
  33299. +/****************************************************************
  33300. + * vfnDisasmClass1 : execute dis-assemble class1 *
  33301. + ****************************************************************/
  33302. +
  33303. +
  33304. +static void
  33305. +vfnDisasmClass1 (uwCode, pszBuf)
  33306. + unsigned short uwCode; /* 16bit code */
  33307. + char *pszBuf;
  33308. +
  33309. +
  33310. +{
  33311. + unsigned short uwOp1, uwOp2;
  33312. + unsigned short uwBit0_3, uwBit4_7, uwBit0_1, uwBit2_3;
  33313. +
  33314. + /*@ extract op1 from code */
  33315. + uwOp1 = uwCode & 0x1c00;
  33316. + uwOp1 >>= 10;
  33317. + /*@ extract op2 from code */
  33318. + uwOp2 = uwCode & 0x0300; /* uwCode[9:8] */
  33319. + uwOp2 >>= 8;
  33320. + /*@ extract bit4_7 from code */
  33321. + uwBit4_7 = uwCode & 0x00f0;
  33322. + uwBit4_7 >>= 4;
  33323. + /*@ extract bit0_3 from code */
  33324. + uwBit0_3 = uwCode & 0x000f;
  33325. +
  33326. + uwBit2_3 = uwBit0_3 & 0x000c;
  33327. + uwBit2_3 >>= 2;
  33328. + uwBit0_1 = uwBit0_3 & 0x0003;
  33329. +
  33330. + switch (uwOp2) { /* op2 */
  33331. +
  33332. + case 0: /* 00 */
  33333. +
  33334. + switch (uwOp1) { /* op1 */
  33335. +
  33336. + case 0: /* 000:00 ld.b rd,[rb] */
  33337. +
  33338. + (void) sprintf (pszBuf, "ld.b %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
  33339. + break;
  33340. +
  33341. + case 1: /* 001:00 ld.ub rd,[rb] */
  33342. +
  33343. + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
  33344. + break;
  33345. +
  33346. + case 2: /* 010:00 ld.h rd,[rb] */
  33347. +
  33348. + (void) sprintf (pszBuf, "ld.h %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
  33349. + break;
  33350. +
  33351. + case 3: /* 011:00 ld.uh rd,[rb] */
  33352. +
  33353. + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
  33354. + break;
  33355. +
  33356. + case 4: /* 100:00 ld.w rd,[rb] */
  33357. +
  33358. + (void) sprintf (pszBuf, "ld.w %%r%d,[%%r%d]", uwBit0_3, uwBit4_7);
  33359. + break;
  33360. +
  33361. + case 5: /* 101:00 ld.b [rb],rs */
  33362. +
  33363. + (void) sprintf (pszBuf, "ld.b [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
  33364. + break;
  33365. +
  33366. + case 6: /* 110:00 ld.h [rb],rs */
  33367. +
  33368. + (void) sprintf (pszBuf, "ld.h [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
  33369. + break;
  33370. +
  33371. + case 7: /* 111:00 ld.w [rb],rs */
  33372. +
  33373. + (void) sprintf (pszBuf, "ld.w [%%r%d],%%r%d", uwBit4_7, uwBit0_3);
  33374. + break;
  33375. + }
  33376. +
  33377. + break;
  33378. +
  33379. + case 1: /* 01 */
  33380. +
  33381. + switch (uwOp1) { /* op1 */
  33382. +
  33383. + case 0: /* 000:01 ld.b rd,[rb]+ */
  33384. +
  33385. + (void) sprintf (pszBuf, "ld.b %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
  33386. + break;
  33387. +
  33388. + case 1: /* 001:01 ld.ub rd,[rb]+ */
  33389. +
  33390. + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
  33391. + break;
  33392. +
  33393. + case 2: /* 010:01 ld.h rd,[rb]+ */
  33394. +
  33395. + (void) sprintf (pszBuf, "ld.h %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
  33396. + break;
  33397. +
  33398. + case 3: /* 011:01 ld.uh rd,[rb]+ */
  33399. +
  33400. + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
  33401. + break;
  33402. +
  33403. + case 4: /* 100:01 ld.w rd,[rb]+ */
  33404. +
  33405. + (void) sprintf (pszBuf, "ld.w %%r%d,[%%r%d]+", uwBit0_3, uwBit4_7);
  33406. + break;
  33407. +
  33408. + case 5: /* 101:01 ld.b [rb]+,rs */
  33409. +
  33410. + (void) sprintf (pszBuf, "ld.b [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
  33411. + break;
  33412. +
  33413. + case 6: /* 110:01 ld.h [rb]+,rs */
  33414. +
  33415. + (void) sprintf (pszBuf, "ld.h [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
  33416. + break;
  33417. +
  33418. + case 7: /* 111:01 ld.w [rb]+,rs */
  33419. +
  33420. + (void) sprintf (pszBuf, "ld.w [%%r%d]+,%%r%d", uwBit4_7, uwBit0_3);
  33421. + break;
  33422. + }
  33423. +
  33424. + break;
  33425. +
  33426. + case 2: /* 10 */
  33427. +
  33428. + switch (uwOp1) { /* op1 */
  33429. +
  33430. + case 0: /* 000:10 add rd,rs */
  33431. +
  33432. + (void) sprintf (pszBuf, "add %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33433. + break;
  33434. +
  33435. + case 1: /* 001:10 sub rd,rs */
  33436. +
  33437. + (void) sprintf (pszBuf, "sub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33438. + break;
  33439. +
  33440. + case 2: /* 010:10 cmp rd,rs */
  33441. +
  33442. + (void) sprintf (pszBuf, "cmp %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33443. + break;
  33444. +
  33445. + case 3: /* 011:10 ld.w rd,rs */
  33446. +
  33447. + (void) sprintf (pszBuf, "ld.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33448. + break;
  33449. +
  33450. + case 4: /* 100:10 and rd,rs */
  33451. +
  33452. + (void) sprintf (pszBuf, "and %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33453. + break;
  33454. +
  33455. + case 5: /* 101:10 or rd,rs */
  33456. +
  33457. + (void) sprintf (pszBuf, "or %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33458. + break;
  33459. +
  33460. + case 6: /* 110:10 xor rd,rs */
  33461. +
  33462. + (void) sprintf (pszBuf, "xor %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33463. + break;
  33464. +
  33465. + case 7: /* 111:10 not rd,rs */
  33466. +
  33467. + (void) sprintf (pszBuf, "not %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33468. + break;
  33469. + }
  33470. +
  33471. + break;
  33472. +
  33473. + case 3: /* 11 */
  33474. +
  33475. + switch (uwOp1) { /* op1 */
  33476. +
  33477. + case 0: /* 000:11 srl rd,imm4 */
  33478. +
  33479. + /* class4-->class1 convert,add 16 */
  33480. + uwBit4_7 += 16;
  33481. +
  33482. + (void) sprintf (pszBuf, "srl %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33483. + break;
  33484. +
  33485. + case 1: /* 001:11 sll rd,imm4 */
  33486. +
  33487. + /* class4-->class1 convert,add 16 */
  33488. + uwBit4_7 += 16;
  33489. +
  33490. + (void) sprintf (pszBuf, "sll %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33491. + break;
  33492. +
  33493. + case 2: /* 010:11 sra rd,imm4 */
  33494. +
  33495. + /* class4-->class1 convert,add 16 */
  33496. + uwBit4_7 += 16;
  33497. +
  33498. + (void) sprintf (pszBuf, "sra %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33499. + break;
  33500. +
  33501. + case 3: /* 011:11 sla rd,imm4 */
  33502. +
  33503. + /* class4-->class1 convert,add 16 */
  33504. + uwBit4_7 += 16;
  33505. +
  33506. + (void) sprintf (pszBuf, "sla %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33507. + break;
  33508. +
  33509. + case 4: /* 100:11 rr rd,imm4 */
  33510. +
  33511. + /* class4-->class1 convert,add 16 */
  33512. + uwBit4_7 += 16;
  33513. +
  33514. + (void) sprintf (pszBuf, "rr %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33515. + break;
  33516. +
  33517. + case 5: /* 101:11 rl rd,imm4 */
  33518. +
  33519. + /* class4-->class1 convert,add 16 */
  33520. + uwBit4_7 += 16;
  33521. +
  33522. + (void) sprintf (pszBuf, "rl %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33523. + break;
  33524. +
  33525. + case 6:
  33526. +
  33527. + if( uwBit4_7 == 0 ) {
  33528. +
  33529. + /* ext OP,imm2 */
  33530. + if( uwBit2_3 > 0 ) {
  33531. + (void) sprintf (pszBuf, "ext %s,0x%x", szOpShift[ uwBit2_3 - 1 ], uwBit0_1);
  33532. + }
  33533. + }else{
  33534. + /* ext Cond */
  33535. + if( uwBit4_7 >= 4 && uwBit4_7 <= 0x0d ) {
  33536. + (void) sprintf (pszBuf, "ext %s",szCond[ uwBit4_7 - 4 ] );
  33537. + }
  33538. + }
  33539. + break;
  33540. +
  33541. + case 7:
  33542. +
  33543. + if( uwBit0_3 == 0 ) {
  33544. +
  33545. + /* ext %rs */
  33546. + (void) sprintf (pszBuf, "ext %%r%d", uwBit4_7);
  33547. + }else{
  33548. + /* ext %rs,OP,imm2 */
  33549. + if( uwBit2_3 > 0 ) {
  33550. + (void) sprintf (pszBuf, "ext %%r%d,%s,0x%x",
  33551. + uwBit4_7,szOpShift[ uwBit2_3 - 1 ], uwBit0_1);
  33552. + }
  33553. + }
  33554. +
  33555. + break;
  33556. + }
  33557. +
  33558. + break;
  33559. + }
  33560. +
  33561. + return;
  33562. +}
  33563. +
  33564. +/****************************************************************
  33565. + * vfnDisasmClass2 : execute dis-assemble class2 *
  33566. + ****************************************************************/
  33567. +
  33568. +static void
  33569. +vfnDisasmClass2 (uwCode, pszBuf)
  33570. + unsigned short uwCode; /* 16bit code */
  33571. + char *pszBuf;
  33572. +
  33573. +
  33574. +{
  33575. + unsigned short uwOp1;
  33576. + unsigned short uwBit0_3, uwBit4_9;
  33577. +
  33578. + /*@ extract op1 from code */
  33579. + uwOp1 = uwCode & 0x1c00;
  33580. + uwOp1 >>= 10;
  33581. + /*@ extract bit4_9 from code */
  33582. + uwBit4_9 = uwCode & 0x03f0;
  33583. + uwBit4_9 >>= 4;
  33584. + /*@ extract bit0_3 from code */
  33585. + uwBit0_3 = uwCode & 0x000f;
  33586. +
  33587. + switch (uwOp1) { /* op1 */
  33588. +
  33589. + case 0: /* 000 ld.b rd,[sp+imm6] */
  33590. +
  33591. + (void) sprintf (pszBuf, "ld.b %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
  33592. + break;
  33593. +
  33594. + case 1: /* 001 ld.ub rd,[sp+imm6] */
  33595. +
  33596. + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
  33597. + break;
  33598. +
  33599. + case 2: /* 010 ld.h rd,[sp+imm7] */
  33600. +
  33601. + (void) sprintf (pszBuf, "ld.h %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
  33602. + break;
  33603. +
  33604. + case 3: /* 011 ld.uh rd,[sp+imm7] */
  33605. +
  33606. + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
  33607. + break;
  33608. +
  33609. + case 4: /* 100 ld.w rd,[sp+imm8] */
  33610. +
  33611. + (void) sprintf (pszBuf, "ld.w %%r%d,[%%sp+0x%x]", uwBit0_3, uwBit4_9);
  33612. + break;
  33613. +
  33614. + case 5: /* 101 ld.b [sp+imm6],rs */
  33615. +
  33616. + (void) sprintf (pszBuf, "ld.b [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  33617. + break;
  33618. +
  33619. + case 6: /* 110 ld.h [sp+imm7],rs */
  33620. +
  33621. + (void) sprintf (pszBuf, "ld.h [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  33622. + break;
  33623. +
  33624. + case 7: /* 111 ld.w [sp+imm8],rs */
  33625. +
  33626. + (void) sprintf (pszBuf, "ld.w [%%sp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  33627. + break;
  33628. + }
  33629. +
  33630. + return;
  33631. +}
  33632. +
  33633. +/****************************************************************
  33634. + * vfnDisasmClass3 : execute dis-assemble class3 *
  33635. + ****************************************************************/
  33636. +
  33637. +
  33638. +static void
  33639. +vfnDisasmClass3 (uwCode, pszBuf)
  33640. + unsigned short uwCode; /* 16bit code */
  33641. + char *pszBuf;
  33642. +
  33643. +
  33644. +{
  33645. + unsigned short uwOp1;
  33646. + unsigned short uwBit0_3, uwBit4_9;
  33647. + unsigned long ulSign32;
  33648. +
  33649. + /*@ extract op1 from code */
  33650. + uwOp1 = uwCode & 0x1c00;
  33651. + uwOp1 >>= 10;
  33652. + /*@ extract bit4_9 from code */
  33653. + uwBit4_9 = uwCode & 0x03f0;
  33654. + uwBit4_9 >>= 4;
  33655. + /*@ extract bit0_3 from code */
  33656. + uwBit0_3 = uwCode & 0x000f;
  33657. +
  33658. + switch (uwOp1) { /* op1 */
  33659. +
  33660. + case 0: /* 000 add rd,imm6 */
  33661. +
  33662. + (void) sprintf (pszBuf, "add %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33663. + break;
  33664. +
  33665. + case 1: /* 001 sub rd,imm6 */
  33666. +
  33667. + (void) sprintf (pszBuf, "sub %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33668. + break;
  33669. +
  33670. + case 2: /* 010 cmp rd,sign6 */
  33671. +
  33672. +/* >>>>> add tazaki 2001.10.10 */
  33673. + if( uwBit4_9 & 0x20 ){
  33674. + if( g_iExtCnt > 0 ){
  33675. + (void) sprintf (pszBuf, "cmp %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33676. + }else{
  33677. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33678. + (void) sprintf (pszBuf, "xcmp %%r%d,0x%x", uwBit0_3, ulSign32);
  33679. + }
  33680. + }else{
  33681. + (void) sprintf (pszBuf, "cmp %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33682. + }
  33683. +/* <<<<< add tazaki 2001.10.10 */
  33684. +/* (void) sprintf (pszBuf, "cmp\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33685. + break;
  33686. +
  33687. + case 3: /* 011 ld.w rd,sign6 */
  33688. +
  33689. +/* >>>>> add tazaki 2001.10.10 */
  33690. + if( uwBit4_9 & 0x20 ){
  33691. + if( g_iExtCnt > 0 ){
  33692. + (void) sprintf (pszBuf, "ld.w %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33693. + }else{
  33694. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33695. + (void) sprintf (pszBuf, "xld.w %%r%d,0x%x", uwBit0_3, ulSign32);
  33696. + }
  33697. + }else{
  33698. + (void) sprintf (pszBuf, "ld.w %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33699. + }
  33700. +/* <<<<< add tazaki 2001.10.10 */
  33701. +/* (void) sprintf (pszBuf, "ld.w\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33702. + break;
  33703. +
  33704. + case 4: /* 100 and rd,sign6 */
  33705. +/* >>>>> add tazaki 2001.10.10 */
  33706. + if( uwBit4_9 & 0x20 ){
  33707. + if( g_iExtCnt > 0 ){
  33708. + (void) sprintf (pszBuf, "and %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33709. + }else{
  33710. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33711. + (void) sprintf (pszBuf, "xand %%r%d,0x%x", uwBit0_3, ulSign32);
  33712. + }
  33713. + }else{
  33714. + (void) sprintf (pszBuf, "and %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33715. + }
  33716. +/* <<<<< add tazaki 2001.10.10 */
  33717. +
  33718. +/* (void) sprintf (pszBuf, "and\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33719. + break;
  33720. +
  33721. + case 5: /* 101 or rd,sign6 */
  33722. +
  33723. +/* >>>>> add tazaki 2001.10.10 */
  33724. + if( uwBit4_9 & 0x20 ){
  33725. + if( g_iExtCnt > 0 ){
  33726. + (void) sprintf (pszBuf, "or %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33727. + }else{
  33728. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33729. + (void) sprintf (pszBuf, "xoor %%r%d,0x%x", uwBit0_3, ulSign32);
  33730. + }
  33731. + }else{
  33732. + (void) sprintf (pszBuf, "or %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33733. + }
  33734. +/* <<<<< add tazaki 2001.10.10 */
  33735. +/* (void) sprintf (pszBuf, "or\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33736. + break;
  33737. +
  33738. + case 6: /* 110 xor rd,sign6 */
  33739. +
  33740. +/* >>>>> add tazaki 2001.10.10 */
  33741. + if( uwBit4_9 & 0x20 ){
  33742. + if( g_iExtCnt > 0 ){
  33743. + (void) sprintf (pszBuf, "xor %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33744. + }else{
  33745. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33746. + (void) sprintf (pszBuf, "xxor %%r%d,0x%x", uwBit0_3, ulSign32);
  33747. + }
  33748. + }else{
  33749. + (void) sprintf (pszBuf, "xor %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33750. + }
  33751. +/* <<<<< add tazaki 2001.10.10 */
  33752. +/* (void) sprintf (pszBuf, "xor\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33753. + break;
  33754. +
  33755. + case 7: /* 111 not rd,sign6 */
  33756. +
  33757. +/* >>>>> add tazaki 2001.10.10 */
  33758. + if( uwBit4_9 & 0x20 ){
  33759. + if( g_iExtCnt > 0 ){
  33760. + (void) sprintf (pszBuf, "not %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33761. + }else{
  33762. + ulSign32 = 0xffffffc0 + uwBit4_9; /* Mark extension */
  33763. + (void) sprintf (pszBuf, "xnot %%r%d,0x%x", uwBit0_3, ulSign32);
  33764. + }
  33765. + }else{
  33766. + (void) sprintf (pszBuf, "not %%r%d,0x%x", uwBit0_3, uwBit4_9);
  33767. + }
  33768. +/* <<<<< add tazaki 2001.10.10 */
  33769. +/* (void) sprintf (pszBuf, "not\tr%d,0x%x", uwBit0_3, uwBit4_9); del tazaki 2001.10.10 */
  33770. + break;
  33771. + }
  33772. +
  33773. + return;
  33774. +}
  33775. +
  33776. +/****************************************************************
  33777. + * vfnDisasmClass4 : execute dis-assemble class4 *
  33778. + ****************************************************************/
  33779. +
  33780. +static void
  33781. +vfnDisasmClass4 (uwCode, pszBuf)
  33782. + unsigned short uwCode; /* 16bit code */
  33783. + char *pszBuf;
  33784. +
  33785. +
  33786. +{
  33787. + unsigned short uwOp1, uwOp2;
  33788. + unsigned short uwBit0_3, uwBit4_7, uwBit0_9;
  33789. +
  33790. + /*@ extract op1 from code */
  33791. + uwOp1 = uwCode & 0x1c00;
  33792. + uwOp1 >>= 10;
  33793. + /*@ extract op2 from code */
  33794. + uwOp2 = uwCode & 0x0300;
  33795. + uwOp2 >>= 8;
  33796. + /*@ extract bit0_9 from code */
  33797. + uwBit0_9 = uwCode & 0x03ff;
  33798. + /*@ extract bit4_7 from code */
  33799. + uwBit4_7 = uwCode & 0x00f0;
  33800. + uwBit4_7 >>= 4;
  33801. + /*@ extract bit0_3 from code */
  33802. + uwBit0_3 = uwCode & 0x000f;
  33803. +
  33804. + if (uwOp1 == 0) {
  33805. + /* 000 add sp,imm12 */
  33806. + (void) sprintf (pszBuf, "add %%sp,0x%x", uwBit0_9);
  33807. + }
  33808. + else if (uwOp1 == 1) {
  33809. + /* 001 sub sp,imm12 */
  33810. + (void) sprintf (pszBuf, "sub %%sp,0x%x", uwBit0_9);
  33811. + }
  33812. + else {
  33813. + /*@ op1 : 010 - 111 */
  33814. +
  33815. + switch (uwOp2) { /* op2 */
  33816. +
  33817. + case 0: /* op2 = 00 */
  33818. +
  33819. + if( g_iShiftFlag == 1 ){
  33820. + uwBit4_7 += 16;
  33821. + }
  33822. +
  33823. + switch (uwOp1) { /* op1 */
  33824. +
  33825. + case 2: /* 010 srl rd,imm4 */
  33826. +
  33827. + (void) sprintf (pszBuf, "srl %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33828. + break;
  33829. +
  33830. + case 3: /* 011 sll rd,imm4 */
  33831. +
  33832. + (void) sprintf (pszBuf, "sll %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33833. + break;
  33834. +
  33835. + case 4: /* 100 sra rd,imm4 */
  33836. +
  33837. + (void) sprintf (pszBuf, "sra %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33838. + break;
  33839. +
  33840. + case 5: /* 101 sla rd,imm4 */
  33841. +
  33842. + (void) sprintf (pszBuf, "sla %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33843. + break;
  33844. +
  33845. + case 6: /* 110 rr rd,imm4 */
  33846. +
  33847. + (void) sprintf (pszBuf, "rr %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33848. + break;
  33849. +
  33850. + case 7: /* 111 rl rd,imm4 */
  33851. +
  33852. + (void) sprintf (pszBuf, "rl %%r%d,0x%x", uwBit0_3, uwBit4_7);
  33853. + break;
  33854. + }
  33855. +
  33856. + break;
  33857. +
  33858. + case 1: /* op2 = 01 */
  33859. +
  33860. + switch (uwOp1) { /* op1 */
  33861. +
  33862. + case 2: /* 010 srl rd,rs */
  33863. +
  33864. + (void) sprintf (pszBuf, "srl %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33865. + break;
  33866. +
  33867. + case 3: /* 011 sll rd,rs */
  33868. +
  33869. + (void) sprintf (pszBuf, "sll %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33870. + break;
  33871. +
  33872. + case 4: /* 100 sra rd,rs */
  33873. +
  33874. + (void) sprintf (pszBuf, "sra %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33875. + break;
  33876. +
  33877. + case 5: /* 101 sla rd,rs */
  33878. +
  33879. + (void) sprintf (pszBuf, "sla %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33880. + break;
  33881. +
  33882. + case 6: /* 110 rr rd,rs */
  33883. +
  33884. + (void) sprintf (pszBuf, "rr %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33885. + break;
  33886. +
  33887. + case 7: /* 111 rl rd,rs */
  33888. +
  33889. + (void) sprintf (pszBuf, "rl %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33890. + break;
  33891. + }
  33892. +
  33893. + break;
  33894. +
  33895. + case 2: /* op2 = 10 */
  33896. +
  33897. + switch (uwOp1) { /* op1 */
  33898. +
  33899. + case 2: /* scan0 rd,rs */
  33900. +
  33901. + (void) sprintf (pszBuf, "scan0 %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33902. + break;
  33903. +
  33904. + case 3: /* scan1 rd,rs */
  33905. +
  33906. + (void) sprintf (pszBuf, "scan1 %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33907. + break;
  33908. +
  33909. + case 4: /* swap rd,rs */
  33910. +
  33911. + (void) sprintf (pszBuf, "swap %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33912. + break;
  33913. +
  33914. + case 5: /* mirror rd,rs */
  33915. +
  33916. + (void) sprintf (pszBuf, "mirror %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33917. + break;
  33918. +
  33919. + case 6: /* swaph rd,rs */
  33920. +
  33921. + (void) sprintf (pszBuf, "swaph %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33922. + break;
  33923. +
  33924. + case 7: /* sat.b rd,rs */
  33925. +
  33926. + (void) sprintf (pszBuf, "sat.b %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33927. + break;
  33928. +
  33929. + /*@ error */
  33930. + (void) sprintf (pszBuf, "***");
  33931. + break;
  33932. + }
  33933. +
  33934. + break;
  33935. +
  33936. + case 3: /* op2 = 11 */
  33937. +
  33938. + switch (uwOp1) { /* op1 */
  33939. +
  33940. + case 2: /* div0s rs */
  33941. +
  33942. + (void) sprintf (pszBuf, "div0s %%r%d", uwBit4_7);
  33943. + break;
  33944. +
  33945. + case 3: /* div0u rs */
  33946. +
  33947. + (void) sprintf (pszBuf, "div0u %%r%d", uwBit4_7);
  33948. + break;
  33949. +
  33950. + case 4: /* div1 rs */
  33951. +
  33952. + (void) sprintf (pszBuf, "div1 %%r%d", uwBit4_7);
  33953. + break;
  33954. +
  33955. + case 5: /* div2s rs */
  33956. +
  33957. + (void) sprintf (pszBuf, "div2s %%r%d", uwBit4_7);
  33958. + break;
  33959. +
  33960. + case 6: /* div3s */
  33961. +
  33962. + (void) sprintf (pszBuf, "div3s");
  33963. + break;
  33964. +
  33965. + case 7: /* sat.ub rd,rs */
  33966. +
  33967. + (void) sprintf (pszBuf, "sat.ub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  33968. + break;
  33969. + }
  33970. +
  33971. + break;
  33972. + }
  33973. + }
  33974. +
  33975. + return;
  33976. +}
  33977. +
  33978. +/****************************************************************
  33979. + * vfnDisasmClass5 : execute dis-assemble class5 *
  33980. + ****************************************************************/
  33981. +
  33982. +static void
  33983. +vfnDisasmClass5 (uwCode, pszBuf)
  33984. + unsigned short uwCode; /* 16bit code */
  33985. + char *pszBuf;
  33986. +
  33987. +
  33988. +{
  33989. + unsigned short uwOp1, uwOp2, uwOp3;
  33990. + unsigned short uwBit0_3, uwBit4_7, uwBit0_5;
  33991. + char *spSpecialReg[16];
  33992. +
  33993. + /*@ initialize */
  33994. + spSpecialReg[0] = "%psr";
  33995. + spSpecialReg[1] = "%sp";
  33996. + spSpecialReg[2] = "%alr";
  33997. + spSpecialReg[3] = "%ahr";
  33998. + spSpecialReg[4] = "%lco";
  33999. + spSpecialReg[5] = "%lsa";
  34000. + spSpecialReg[6] = "%lea";
  34001. + spSpecialReg[7] = "%sor";
  34002. + spSpecialReg[8] = "%ttbr";
  34003. + spSpecialReg[9] = "%dp";
  34004. + spSpecialReg[10] = "%idir"; /* "" -->"%idir" T.Tazaki 20003/11/18 */
  34005. + spSpecialReg[11] = "%dbbr"; /* "" -->"%dbbr" T.Tazaki 20003/11/18 */
  34006. + spSpecialReg[12] = "";
  34007. + spSpecialReg[13] = "%usp";
  34008. + spSpecialReg[14] = "%ssp";
  34009. + spSpecialReg[15] = "%pc";
  34010. +
  34011. + /*@ extract op1 from code */
  34012. + uwOp1 = uwCode & 0x1c00;
  34013. + uwOp1 >>= 10;
  34014. + /*@ extract op2 from code */
  34015. + uwOp2 = uwCode & 0x0300;
  34016. + uwOp2 >>= 8;
  34017. + /*@ extract op3 from code */
  34018. + uwOp3 = uwCode & 0x00c0;
  34019. + uwOp3 >>= 6;
  34020. + /*@ extract bit4_7 from code */
  34021. + uwBit4_7 = uwCode & 0x00f0;
  34022. + uwBit4_7 >>= 4;
  34023. + /*@ extract bit0_3 from code */
  34024. + uwBit0_3 = uwCode & 0x000f;
  34025. + /*@ extract bit0_5 from code */
  34026. + uwBit0_5 = uwCode & 0x003f;
  34027. +
  34028. + switch (uwOp2) { /* op2 */
  34029. +
  34030. + case 0: /* 00 */
  34031. +
  34032. + switch (uwOp1) { /* op1 */
  34033. +
  34034. + case 0: /* 000:00 ld.w %sd,rs */
  34035. +
  34036. + /*@ check if code is OK */
  34037. + if (((uwBit0_3 >= 0) && (uwBit0_3 <= 9)) || ((uwBit0_3 >= 13) && (uwBit0_3 <= 15))){
  34038. + (void) sprintf (pszBuf, "ld.w %s,%%r%d", spSpecialReg[uwBit0_3], uwBit4_7);
  34039. + }
  34040. + else {
  34041. + /*@ error */
  34042. + (void) sprintf (pszBuf, "***");
  34043. + }
  34044. + break;
  34045. +
  34046. + case 1: /* 001:00 ld.w rd,%ss */
  34047. +
  34048. + /*@ check if code is OK */
  34049. +// if (((uwBit4_7 >= 0) && (uwBit4_7 <= 9)) || ((uwBit4_7 >= 13) && (uwBit4_7 <= 15))){ /* change T.Tazaki 2003/11/18 */
  34050. + if (((uwBit4_7 >= 0) && (uwBit4_7 <= 11)) || ((uwBit4_7 >= 13) && (uwBit4_7 <= 15))){
  34051. + (void) sprintf (pszBuf, "ld.w %%r%d,%s", uwBit0_3, spSpecialReg[uwBit4_7]);
  34052. + }
  34053. + else {
  34054. + /*@ error */
  34055. + (void) sprintf (pszBuf, "***");
  34056. + }
  34057. + break;
  34058. +
  34059. + case 2: /* 010:00 btst [rb],imm3 */
  34060. +
  34061. + /*@ check if code is OK */
  34062. + if ((uwBit0_3 & 0x8) != 0) {
  34063. + /*@ error */
  34064. + (void) sprintf (pszBuf, "***");
  34065. + }
  34066. + else {
  34067. + (void) sprintf (pszBuf, "btst [%%r%d],0x%d", uwBit4_7, uwBit0_3);
  34068. + }
  34069. + break;
  34070. +
  34071. + case 3: /* 011:00 bclr [rb],imm3 */
  34072. +
  34073. + /*@ check if code is OK */
  34074. + if ((uwBit0_3 & 0x8) != 0) {
  34075. + /*@ error */
  34076. + (void) sprintf (pszBuf, "***");
  34077. + }
  34078. + else {
  34079. + (void) sprintf (pszBuf, "bclr [%%r%d],0x%d", uwBit4_7, uwBit0_3);
  34080. + }
  34081. + break;
  34082. +
  34083. + case 4: /* 100:00 bset [rb],imm3 */
  34084. +
  34085. + /*@ check if code is OK */
  34086. + if ((uwBit0_3 & 0x8) != 0) {
  34087. + /*@ error */
  34088. + (void) sprintf (pszBuf, "***");
  34089. + }
  34090. + else {
  34091. + (void) sprintf (pszBuf, "bset [%%r%d],0x%d", uwBit4_7, uwBit0_3);
  34092. + }
  34093. + break;
  34094. +
  34095. + case 5: /* 101:00 bnot [rb],imm3 */
  34096. +
  34097. + /*@ check if code is OK */
  34098. + if ((uwBit0_3 & 0x8) != 0) {
  34099. + /*@ error */
  34100. + (void) sprintf (pszBuf, "***");
  34101. + }
  34102. + else {
  34103. + (void) sprintf (pszBuf, "bnot [%%r%d],0x%d", uwBit4_7, uwBit0_3);
  34104. + }
  34105. + break;
  34106. +
  34107. + case 6: /* 110:00 adc rd,rs */
  34108. +
  34109. + (void) sprintf (pszBuf, "adc %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34110. + break;
  34111. +
  34112. + case 7: /* 111:00 sbc rd,rs */
  34113. +
  34114. + (void) sprintf (pszBuf, "sbc %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34115. + break;
  34116. + }
  34117. +
  34118. + break;
  34119. +
  34120. + case 1: /* 01 */
  34121. +
  34122. + switch (uwOp1) { /* op1 */
  34123. +
  34124. + case 0: /* 000:01 ld.b rd,rs */
  34125. +
  34126. + (void) sprintf (pszBuf, "ld.b %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34127. + break;
  34128. +
  34129. + case 1: /* 001:01 ld.ub rd,rs */
  34130. +
  34131. + (void) sprintf (pszBuf, "ld.ub %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34132. + break;
  34133. +
  34134. + case 2: /* 010:01 ld.h rd,rs */
  34135. +
  34136. + (void) sprintf (pszBuf, "ld.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34137. + break;
  34138. +
  34139. + case 3: /* 011:01 ld.uh rd,rs */
  34140. +
  34141. + (void) sprintf (pszBuf, "ld.uh %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34142. + break;
  34143. +
  34144. + case 4: /* 100:01 ld.c rd,imm4 */
  34145. +
  34146. + (void) sprintf (pszBuf, "ld.c %%r%d,0x%x", uwBit0_3, uwBit4_7);
  34147. + break;
  34148. +
  34149. + case 5: /* 101:01 ld.c imm4,rs */
  34150. +
  34151. + (void) sprintf (pszBuf, "ld.c 0x%x,%%r%d", uwBit4_7, uwBit0_3);
  34152. + break;
  34153. +
  34154. + case 6: /* 110:01 loop rc,ra */
  34155. +
  34156. + (void) sprintf (pszBuf, "loop %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34157. + break;
  34158. +
  34159. + case 7: /* 111:01 sat.w rd,rs */
  34160. +
  34161. + (void) sprintf (pszBuf, "sat.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34162. + break;
  34163. +
  34164. + default:
  34165. + /*@ error */
  34166. + (void) sprintf (pszBuf, "***");
  34167. + break;
  34168. + }
  34169. +
  34170. + break;
  34171. +
  34172. + case 2: /* 10 */
  34173. +
  34174. + switch (uwOp1) { /* op1 */
  34175. +
  34176. + case 0: /* 000:10 mlt.h rd,rs */
  34177. +
  34178. + (void) sprintf (pszBuf, "mlt.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34179. + break;
  34180. +
  34181. + case 1: /* 001:10 mltu.h rd,rs */
  34182. +
  34183. + (void) sprintf (pszBuf, "mltu.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34184. + break;
  34185. +
  34186. + case 2: /* 010:10 mlt.w rd,rs */
  34187. +
  34188. + (void) sprintf (pszBuf, "mlt.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34189. + break;
  34190. +
  34191. + case 3: /* 011:10 mltu.w rd,rs */
  34192. +
  34193. + (void) sprintf (pszBuf, "mltu.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34194. + break;
  34195. +
  34196. + case 4: /* 100:10 mac rs */
  34197. +
  34198. + (void) sprintf (pszBuf, "mac %%r%d", uwBit4_7);
  34199. + break;
  34200. +
  34201. + case 5: /* 101:10 sat.h rd,rs */
  34202. +
  34203. + (void) sprintf (pszBuf, "sat.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34204. + break;
  34205. +
  34206. + case 6: /* 110:10 loop rc,imm4 */
  34207. +
  34208. + (void) sprintf (pszBuf, "loop %%r%d,0x%x", uwBit0_3, uwBit4_7);
  34209. + break;
  34210. +
  34211. + case 7: /* 111:10 sat.uw rd,rs */
  34212. +
  34213. + (void) sprintf (pszBuf, "sat.uw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34214. + break;
  34215. +
  34216. + default:
  34217. +
  34218. + /*@ error */
  34219. + (void) sprintf (pszBuf, "***");
  34220. + break;
  34221. + }
  34222. +
  34223. + break;
  34224. +
  34225. + case 3: /* 11 */
  34226. +
  34227. + switch (uwOp1) { /* op1 */
  34228. +
  34229. + case 0: /* 000:11 mlt.hw rd,rs */
  34230. +
  34231. + (void) sprintf (pszBuf, "mlt.hw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34232. + break;
  34233. +
  34234. + case 1: /* 001:11 mac1.h rd,rs */
  34235. +
  34236. + (void) sprintf (pszBuf, "mac1.h %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34237. + break;
  34238. +
  34239. + case 2: /* 010:11 mac1.hw rd,rs */
  34240. +
  34241. + (void) sprintf (pszBuf, "mac1.hw %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34242. + break;
  34243. +
  34244. + case 4: /* 100:11 mac1.w rd,rs */
  34245. +
  34246. + (void) sprintf (pszBuf, "mac1.w %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34247. + break;
  34248. +
  34249. + case 5: /* 101:11 sat.uh rd,rs */
  34250. +
  34251. + (void) sprintf (pszBuf, "sat.uh %%r%d,%%r%d", uwBit0_3, uwBit4_7);
  34252. + break;
  34253. +
  34254. + case 6: /* 110:11 loop imm4,imm4 */
  34255. +
  34256. + (void) sprintf (pszBuf, "loop 0x%x,0x%x", uwBit0_3, uwBit4_7);
  34257. + break;
  34258. +
  34259. + case 7: /* 111:11 */
  34260. +
  34261. + switch( uwOp3 ) { /* op3 */
  34262. +
  34263. + case 0: /* 111:11:00 do.c imm6 */
  34264. + (void) sprintf (pszBuf, "do.c 0x%x", uwBit0_5);
  34265. + break;
  34266. + case 1: /* 111:11:01 psrset imm5 */
  34267. + (void) sprintf (pszBuf, "psrset 0x%x", uwBit0_5);
  34268. + break;
  34269. + case 2: /* 111:11:10 psrclr imm5 */
  34270. + (void) sprintf (pszBuf, "psrclr 0x%x", uwBit0_5);
  34271. + break;
  34272. + default:
  34273. + /*@ error */
  34274. + (void) sprintf (pszBuf, "***");
  34275. + break;
  34276. + }
  34277. + break;
  34278. +
  34279. + default:
  34280. + /*@ error */
  34281. + (void) sprintf (pszBuf, "***");
  34282. + break;
  34283. + }
  34284. +
  34285. + break;
  34286. + }
  34287. +}
  34288. +
  34289. +/****************************************************************
  34290. + * vfnDisasmClass6 : execute dis-assemble class6 *
  34291. + ****************************************************************/
  34292. +
  34293. +static void
  34294. +vfnDisasmClass6 (uwCode, pszBuf)
  34295. + unsigned short uwCode; /* 16bit code */
  34296. + char *pszBuf;
  34297. +
  34298. +
  34299. +{
  34300. + unsigned short uwBit0_12;
  34301. +
  34302. + /*@ extract bit0_12 from code */
  34303. + uwBit0_12 = uwCode & 0x1fff;
  34304. +
  34305. + (void) sprintf (pszBuf, "ext 0x%x", uwBit0_12);
  34306. +
  34307. + return;
  34308. +}
  34309. +
  34310. +/****************************************************************
  34311. + * vfnDisasmClass7 : execute dis-assemble class7 *
  34312. + ****************************************************************/
  34313. +
  34314. +static void
  34315. +vfnDisasmClass7 (uwCode, pszBuf)
  34316. + unsigned short uwCode; /* 16bit code */
  34317. + char *pszBuf;
  34318. +
  34319. +
  34320. +{
  34321. + unsigned short uwOp1;
  34322. + unsigned short uwBit0_3, uwBit4_9;
  34323. +
  34324. + /*@ extract op1 from code */
  34325. + uwOp1 = uwCode & 0x1c00;
  34326. + uwOp1 >>= 10;
  34327. + /*@ extract bit4_9 from code */
  34328. + uwBit4_9 = uwCode & 0x03f0;
  34329. + uwBit4_9 >>= 4;
  34330. + /*@ extract bit0_3 from code */
  34331. + uwBit0_3 = uwCode & 0x000f;
  34332. +
  34333. + switch (uwOp1) { /* op1 */
  34334. +
  34335. + case 0: /* 000 ld.b rd,[dp+imm6] */
  34336. +
  34337. + (void) sprintf (pszBuf, "ld.b %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
  34338. + break;
  34339. +
  34340. + case 1: /* 001 ld.ub rd,[dp+imm6] */
  34341. +
  34342. + (void) sprintf (pszBuf, "ld.ub %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
  34343. + break;
  34344. +
  34345. + case 2: /* 010 ld.h rd,[dp+imm6] */
  34346. +
  34347. + (void) sprintf (pszBuf, "ld.h %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
  34348. + break;
  34349. +
  34350. + case 3: /* 011 ld.uh rd,[dp+imm6] */
  34351. +
  34352. + (void) sprintf (pszBuf, "ld.uh %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
  34353. + break;
  34354. +
  34355. + case 4: /* 100 ld.w rd,[dp+imm6] */
  34356. +
  34357. + (void) sprintf (pszBuf, "ld.w %%r%d,[%%dp+0x%x]", uwBit0_3, uwBit4_9);
  34358. + break;
  34359. +
  34360. + case 5: /* 101 ld.b [dp+imm6],rs */
  34361. +
  34362. + (void) sprintf (pszBuf, "ld.b [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  34363. + break;
  34364. +
  34365. + case 6: /* 110 ld.h [dp+imm6],rs */
  34366. +
  34367. + (void) sprintf (pszBuf, "ld.h [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  34368. + break;
  34369. +
  34370. + case 7: /* 111 ld.w [dp+imm6],rs */
  34371. +
  34372. + (void) sprintf (pszBuf, "ld.w [%%dp+0x%x],%%r%d", uwBit4_9, uwBit0_3);
  34373. + break;
  34374. + }
  34375. +
  34376. + return;
  34377. +}
  34378. +
  34379. +/* <<<<<<<<<<<<<<< add tazaki 2001.07.31 */
  34380. +
  34381. +
  34382. +int
  34383. +print_insn_c33 (memaddr, info)
  34384. + bfd_vma memaddr;
  34385. + struct disassemble_info * info;
  34386. +{
  34387. + int status;
  34388. + bfd_byte buffer[ 4 ];
  34389. + unsigned long insn = 0;
  34390. +
  34391. + /* First figure out how big the opcode is. */
  34392. +
  34393. + status = info->read_memory_func (memaddr, buffer, 2, info);
  34394. + if (status == 0)
  34395. + {
  34396. + insn = bfd_getl16 (buffer);
  34397. + }
  34398. +
  34399. + if (status != 0)
  34400. + {
  34401. + info->memory_error_func (status, memaddr, info);
  34402. + return -1;
  34403. + }
  34404. +
  34405. + /* Make sure we tell our caller how many bytes we consumed. */
  34406. + return disassemble (memaddr, info, insn);
  34407. +}
  34408. diff --git a/opcodes/c33-opc.c b/opcodes/c33-opc.c
  34409. new file mode 100644
  34410. index 0000000..797dd1a
  34411. --- /dev/null
  34412. +++ b/opcodes/c33-opc.c
  34413. @@ -0,0 +1,2146 @@
  34414. +/* Assemble V850 instructions.
  34415. + Copyright (C) 1996 Free Software Foundation, Inc.
  34416. +
  34417. +This program is free software; you can redistribute it and/or modify
  34418. +it under the terms of the GNU General Public License as published by
  34419. +the Free Software Foundation; either version 2 of the License, or
  34420. +(at your option) any later version.
  34421. +
  34422. +This program is distributed in the hope that it will be useful,
  34423. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  34424. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34425. +GNU General Public License for more details.
  34426. +
  34427. +You should have received a copy of the GNU General Public License
  34428. +along with this program; if not, write to the Free Software
  34429. +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  34430. +
  34431. +#include "sysdep.h"
  34432. +#include "opcode/c33.h"
  34433. +#include <stdio.h>
  34434. +#include "opintl.h"
  34435. +
  34436. +#if 0 /* c33 */
  34437. +/* regular opcode */
  34438. +#define OP(x) ((x & 0x3f) << 5)
  34439. +#define OP_MASK OP (0x3f)
  34440. +#endif /* c33 */
  34441. +
  34442. +/* c33 addition */
  34443. +#define OP_CLASS0_1(x) ((x & 0x3ff) << 6)
  34444. +#define OP_CLASS0_2(x) ((x & 0xff) << 8)
  34445. +#define OP_CLASS1(x) ((x & 0xff) << 8)
  34446. +#define OP_CLASS2(x) ((x & 0x3f) << 10)
  34447. +#define OP_CLASS3(x) ((x & 0x3f) << 10)
  34448. +#define OP_CLASS4_1(x) ((x & 0x3f) << 10)
  34449. +#define OP_CLASS4_2(x) OP_CLASS1(x) /* shift/rotate,div */
  34450. +#define OP_CLASS5(x) OP_CLASS1(x)
  34451. +#define OP_CLASS6(x) ((x & 0x7) << 13)
  34452. +#define OP_CLASS7(x) ((x & 0x3f) << 10)
  34453. +
  34454. +#define OP_CLASS0_1_MASK OP_CLASS0_1(0x3ff)
  34455. +#define OP_CLASS0_2_MASK OP_CLASS0_2(0xff)
  34456. +#define OP_CLASS1_MASK OP_CLASS1(0xff)
  34457. +#define OP_CLASS2_MASK OP_CLASS2(0x3f)
  34458. +#define OP_CLASS3_MASK OP_CLASS3(0x3f)
  34459. +#define OP_CLASS4_1_MASK OP_CLASS4_1(0xff)
  34460. +#define OP_CLASS4_2_MASK OP_CLASS4_2(0xff)
  34461. +#define OP_CLASS5_MASK OP_CLASS5(0xff)
  34462. +#define OP_CLASS6_MASK OP_CLASS6(0x7)
  34463. +#define OP_CLASS7_MASK OP_CLASS7(0x3f)
  34464. +
  34465. +
  34466. +#if 0
  34467. +/* The functions used to insert and extract complicated operands. */
  34468. +
  34469. +/* Note: There is a conspiracy between these functions and
  34470. + v850_insert_operand() in gas/config/tc-v850.c. Error messages
  34471. + containing the string 'out of range' will be ignored unless a
  34472. + specific command line option is given to GAS. */
  34473. +
  34474. +static const char * not_valid = N_ ("displacement value is not in range and is not aligned");
  34475. +static const char * out_of_range = N_ ("displacement value is out of range");
  34476. +static const char * not_aligned = N_ ("displacement value is not aligned");
  34477. +
  34478. +static const char * immediate_out_of_range = N_ ("immediate value is out of range");
  34479. +
  34480. +static unsigned long
  34481. +insert_d5_4 (insn, value, errmsg)
  34482. + unsigned long insn;
  34483. + long value;
  34484. + const char ** errmsg;
  34485. +{
  34486. + if (value > 0x1f || value < 0)
  34487. + {
  34488. + if (value & 1)
  34489. + * errmsg = _(not_valid);
  34490. + else
  34491. + *errmsg = _(out_of_range);
  34492. + }
  34493. + else if (value & 1)
  34494. + * errmsg = _(not_aligned);
  34495. +
  34496. + value >>= 1;
  34497. +
  34498. + return (insn | (value & 0x0f));
  34499. +}
  34500. +
  34501. +static unsigned long
  34502. +extract_d5_4 (insn, invalid)
  34503. + unsigned long insn;
  34504. + int * invalid;
  34505. +{
  34506. + unsigned long ret = (insn & 0x0f);
  34507. +
  34508. + return ret << 1;
  34509. +}
  34510. +#endif
  34511. +
  34512. +
  34513. +/* Warning: code in gas/config/tc-v850.c examines the contents of this array.
  34514. + If you change any of the values here, be sure to look for side effects in
  34515. + that code. */
  34516. +const struct c33_operand c33_operands[] =
  34517. +{
  34518. +#define UNUSED 0
  34519. + { 0, 0, NULL, NULL, 0, 0 },
  34520. +
  34521. +#define SP 1
  34522. + { 0, 0, NULL, NULL, C33_OPERAND_SP, 0},
  34523. +
  34524. +#define RD 2
  34525. + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0},
  34526. +
  34527. +#define RS 3
  34528. + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0 },
  34529. +
  34530. +#define RS2 4
  34531. + { 4, 4, NULL, NULL, C33_OPERAND_REG, 0},
  34532. +
  34533. +#define SD 5
  34534. + { 4, 0, NULL, NULL, C33_OPERAND_SREG, 0},
  34535. +
  34536. +#define SS 6
  34537. + { 4, 4, NULL, NULL, C33_OPERAND_SREG, 0},
  34538. +
  34539. +#define RB0 7
  34540. + { 4, 0, NULL, NULL, C33_OPERAND_REG, 0},
  34541. +
  34542. +#define RB 8
  34543. + { 4, 4, NULL, NULL, C33_OPERAND_RB, 0},
  34544. +
  34545. +#define MEM_IMM13 9 /* sld,sbit */
  34546. + { 4, 4, NULL, NULL, C33_OPERAND_MEM, 13},
  34547. +
  34548. +#define MEM_IMM26 10 /* xld,xbit */
  34549. + { 4, 4, NULL, NULL, C33_OPERAND_MEM, 26},
  34550. +
  34551. +#define REGINC 11
  34552. + { 4, 4, NULL, NULL, C33_OPERAND_REGINC, 0},
  34553. +
  34554. +#define SIGN6 12
  34555. + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED, 6},
  34556. +
  34557. +#define SIGN8 13
  34558. + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED, 8},
  34559. +
  34560. +#define SIGN32 14
  34561. + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED, 32},
  34562. +
  34563. +#define IMM2 15
  34564. + { 2, 0, NULL, NULL, C33_OPERAND_IMM, 2},
  34565. +
  34566. +#define IMM3 16
  34567. + { 3, 0, NULL, NULL, C33_OPERAND_IMM, 3},
  34568. +
  34569. +#define IMM4 17
  34570. + { 4, 4, NULL, NULL, C33_OPERAND_IMM, 4},
  34571. +
  34572. +#define IMM5 18
  34573. + { 4, 4, NULL, NULL, C33_OPERAND_IMM, 5},
  34574. +
  34575. +#define IMM6 19
  34576. + { 6, 4, NULL, NULL, C33_OPERAND_IMM, 6},
  34577. +
  34578. +#define IMM10 20
  34579. + { 10, 0, NULL, NULL, C33_OPERAND_IMM, 10},
  34580. +
  34581. +#define IMM32 21
  34582. + { 6, 4, NULL, NULL, C33_OPERAND_IMM, 32},
  34583. +
  34584. +#define SPIMM6 22
  34585. + { 6, 4, NULL, NULL, C33_OPERAND_SPMEM, 6},
  34586. +
  34587. +#define SPIMM32 23 /* xld,sld,xbit,sbit */
  34588. + { 6, 4, NULL, NULL, C33_OPERAND_SPMEM, 32},
  34589. +
  34590. +#define IMM13_LABEL 24
  34591. +// { 13, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_LABEL, 13}, /* ext */
  34592. + { 13, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL, 13}, /* ext */ /* change 2005/04/07 T.Tazaki */
  34593. +
  34594. +#define SIGN32_LABELIMM32 25
  34595. + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 32}, /* jp,call */
  34596. +
  34597. +#define SIGN32_SYMBOLIMM32 26
  34598. + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_SYMBOL, 32}, /* xld.w*/
  34599. +
  34600. +#define SIGN6_SYMBOLIMM6 27
  34601. + { 6, 4, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_SYMBOL, 6}, /* ld.w */
  34602. +
  34603. +#define SYMBOLIMM19 28
  34604. + { 6, 4, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_SYMBOL, 19}, /* sld.w */
  34605. +
  34606. +#define SIGN8_LABELIMM8 29
  34607. + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 8}, /* jp,call */
  34608. +
  34609. +#define SIGN32_LABELIMM22 30
  34610. + { 8, 0, NULL, NULL, C33_OPERAND_SIGNED | C33_OPERAND_LABEL | C33_OPERAND_PC, 22}, /* scall,sjp,sjrxx */
  34611. +
  34612. +#define RD01 31
  34613. + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
  34614. +
  34615. +#define RS01 32
  34616. + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0 }, /* Advanced macro class0 */
  34617. +
  34618. +#define SS01 33
  34619. + { 4, 0, NULL, NULL, C33_OPERAND_SREG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
  34620. +
  34621. +#define SD01 34
  34622. + { 4, 0, NULL, NULL, C33_OPERAND_SREG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
  34623. +
  34624. +#define RB01 35
  34625. + { 4, 0, NULL, NULL, C33_OPERAND_REG | C33_OPERAND_01, 0}, /* Advanced macro class0 */
  34626. +
  34627. +#define IMM4_01 36
  34628. + { 4, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_01, 5}, /* Advanced macro class0 */
  34629. +
  34630. +#define IMM5_2 37
  34631. + { 4, 0, NULL, NULL, C33_OPERAND_IMM, 5}, /* Advanced macro : loop */
  34632. +
  34633. +#define IMM6_OP3 38
  34634. + { 6, 0, NULL, NULL, C33_OPERAND_IMM, 6},
  34635. +
  34636. +#define IMM5_OP3_01 39
  34637. + { 5, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_OP3_01, 5}, /* Advanced macro : psrset */
  34638. +
  34639. +#define IMM5_OP3_10 40
  34640. + { 5, 0, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_OP3_10, 5}, /* Advanced macro : psrclr */
  34641. +
  34642. +#define DPIMM6 41
  34643. + { 6, 4, NULL, NULL, C33_OPERAND_DPMEM, 6}, /* Advanced macro : ld.x [%dp+imm6] */
  34644. +
  34645. +#define DPIMM32 42
  34646. + { 6, 4, NULL, NULL, C33_OPERAND_DPMEM, 32}, /* Advanced macro : xld.x [%dp+imm32] */
  34647. +
  34648. +#define DP_SYMBOL19 43
  34649. + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DP_SYMBOL, 19}, /* Advanced macro : ald.w [symbol+imm] */
  34650. +
  34651. +#define DP_SYMBOL32 44
  34652. + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DP_SYMBOL, 32}, /* Advanced macro : xld.w [symbol+imm] */
  34653. +
  34654. +#define DP 45
  34655. + { 4, 0, NULL, NULL, C33_OPERAND_DP | C33_OPERAND_01, 0}, /* Advanced macro : add %rd,%dp */
  34656. +
  34657. +#define DP_OFF_SYMBOL6 46
  34658. + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DPSYMBOL6, 6}, /* Advanced macro : ld.x [%dp+dpoff_l(symbol)] */
  34659. +
  34660. +#define DP_OFF_SYMBOL6_2 47
  34661. + { 6, 4, NULL, NULL, C33_OPERAND_MEM | C33_OPERAND_DPSYMBOL6_2, 6}, /* Advanced macro : ld.x [%dp+dpoff_l(symbol)] */
  34662. +
  34663. +#define COND 48
  34664. + { 4, 4, NULL, NULL, C33_OPERAND_COND, 6}, /* Advanced macro : ext condition */
  34665. +
  34666. +#define OP_SHIFT 49
  34667. + { 2, 2, NULL, NULL, C33_OPERAND_OP_SHIFT, 0}, /* Advanced macro : ext condition */
  34668. +
  34669. +#define IMM5_LABEL 50
  34670. + { 4, 4, NULL, NULL, C33_OPERAND_IMM | C33_OPERAND_LABEL, 5}, /* Advanced macro : loop */
  34671. +
  34672. +#define SD_LD 51
  34673. + { 4, 0, NULL, NULL, C33_OPERAND_LD_SREG, 0}, /* Advanced macro,PE : ld.w %sd */
  34674. +
  34675. +#define SS02 52
  34676. + { 4, 0, NULL, NULL, C33_OPERAND_PUSHS_SREG | C33_OPERAND_01, 0}, /* Advanced macro,PE : pushs */
  34677. +
  34678. +#define SD02 53
  34679. + { 4, 0, NULL, NULL, C33_OPERAND_PUSHS_SREG | C33_OPERAND_01, 0}, /* Advanced macro,PE : pops */
  34680. +
  34681. +/* add T.Tazaki 2004/07/23 >>> */
  34682. +#define XLDB_RD_MEM_IMM26 54 /* xld.b %rd,[symbol+imm32] */
  34683. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_RD, 26},
  34684. +#define XLDB_WR_MEM_IMM26 55 /* xld.b [symbol+imm32],%rs */
  34685. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_WR, 26},
  34686. +#define XLDH_RD_MEM_IMM26 56 /* xld.h %rd,[symbol+imm32] */
  34687. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_RD, 26},
  34688. +#define XLDH_WR_MEM_IMM26 57 /* xld.h [symbol+imm32],%rs */
  34689. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_WR, 26},
  34690. +#define XLDW_RD_MEM_IMM26 58 /* xld.w %rd,[symbol+imm32] */
  34691. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_RD, 26},
  34692. +#define XLDW_WR_MEM_IMM26 59 /* xld.w [symbol+imm32],%rs */
  34693. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_WR, 26},
  34694. +#define XLDUB_RD_MEM_IMM26 60 /* xld.ub %rd,[symbol+imm32] */
  34695. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUB_RD, 26},
  34696. +#define XLDUH_RD_MEM_IMM26 61 /* xld.uh %rd,[symbol+imm32] */
  34697. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUH_RD, 26},
  34698. +#define XBTST_MEM_IMM26 62 /* xbtst [symbol+imm32],imm3 */
  34699. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBTST, 26},
  34700. +#define XBCLR_MEM_IMM26 63 /* xbclr [symbol+imm32],imm3 */
  34701. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBCLR, 26},
  34702. +#define XBSET_MEM_IMM26 64 /* xbset [symbol+imm32],imm3 */
  34703. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBSET, 26},
  34704. +#define XBNOT_MEM_IMM26 65 /* xbnot [symbol+imm32],imm3 */
  34705. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XBNOT, 26},
  34706. +
  34707. +#define ALDB_RD_MEM_IMM19 66 /* ald.b %rd,[symbol+imm19] */
  34708. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_RD, 19},
  34709. +#define ALDB_WR_MEM_IMM19 67 /* ald.b [symbol+imm19],%rs */
  34710. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDB_WR, 19},
  34711. +#define ALDH_RD_MEM_IMM19 68 /* ald.h %rd,[symbol+imm19] */
  34712. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_RD, 19},
  34713. +#define ALDH_WR_MEM_IMM19 69 /* ald.h [symbol+imm19],%rs */
  34714. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDH_WR, 19},
  34715. +#define ALDW_RD_MEM_IMM19 70 /* ald.w %rd,[symbol+imm19] */
  34716. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_RD, 19},
  34717. +#define ALDW_WR_MEM_IMM19 71 /* ald.w [symbol+imm19],%rs */
  34718. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDW_WR, 19},
  34719. +#define ALDUB_RD_MEM_IMM19 72 /* ald.ub %rd,[symbol+imm19] */
  34720. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUB_RD, 19},
  34721. +#define ALDUH_RD_MEM_IMM19 73 /* ald.uh %rd,[symbol+imm19] */
  34722. + { 4, 4, NULL, NULL, C33_OPERAND_MEM | C33_XLDUH_RD, 19},
  34723. +#define RB_IMM26 74
  34724. + { 4, 4, NULL, NULL, C33_OPERAND_RB | C33_OPERAND_26, 0}, /* xld.x [%rb+imm26] */
  34725. +
  34726. +/* add T.Tazaki 2004/07/23 <<< */
  34727. +
  34728. +};
  34729. +
  34730. +
  34731. +/* The opcode table. < STANDARD MACRO >
  34732. +
  34733. + The format of the opcode table is:
  34734. +
  34735. + NAME OPCODE MASK { OPERANDS } MEMOP
  34736. +
  34737. + NAME is the name of the instruction.
  34738. + OPCODE is the instruction opcode.
  34739. + MASK is the opcode mask; this is used to tell the disassembler
  34740. + which bits in the actual opcode must match OPCODE.
  34741. + OPERANDS is the list of operands.
  34742. + MEMOP specifies which operand (if any) is a memory operand.
  34743. + PROCESSORS specifies which CPU(s) support the opcode.
  34744. +
  34745. + The disassembler reads the table in order and prints the first
  34746. + instruction which matches, so this table is sorted to put more
  34747. + specific instructions before more general instructions. It is also
  34748. + sorted by major opcode.
  34749. +
  34750. + The table is also sorted by name. This is used by the assembler.
  34751. + When parsing an instruction the assembler finds the first occurance
  34752. + of the name of the instruciton in this table and then attempts to
  34753. + match the instruction's arguments with description of the operands
  34754. + associated with the entry it has just found in this table. If the
  34755. + match fails the assembler looks at the next entry in this table.
  34756. + If that entry has the same name as the previous entry, then it
  34757. + tries to match the instruction against that entry and so on. This
  34758. + is how the assembler copes with multiple, different formats of the
  34759. + same instruction. */
  34760. +
  34761. +/* It is necessary to put in order and describe the same command. */
  34762. +/* It is meaningful in the order of the row of a command.
  34763. + REGINC is bad if there is nothing before RB. */
  34764. +/* The operand in which a symbol is possible will not become,
  34765. +if it gets used after the operand for which a symbol is improper. */
  34766. +/*************************************************************************************************/
  34767. +/* NO use default data area mode */
  34768. +/*************************************************************************************************/
  34769. +const struct c33_opcode c33_opcodes32[] =
  34770. +{
  34771. +/* class 0 */
  34772. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34773. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34774. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34775. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  34776. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  34777. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34778. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34779. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  34780. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34781. +
  34782. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  34783. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34784. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  34785. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34786. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34787. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34788. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34789. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34790. +
  34791. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34792. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  34793. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  34794. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34795. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  34796. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34797. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34798. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34799. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34800. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34801. +
  34802. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34803. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34804. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34805. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34806. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34807. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34808. +
  34809. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34810. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34811. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34812. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34813. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34814. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34815. +
  34816. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34817. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34818. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34819. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34820. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34821. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34822. +
  34823. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34824. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34825. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34826. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34827. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34828. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34829. +
  34830. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34831. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34832. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34833. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34834. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34835. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34836. +
  34837. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34838. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34839. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34840. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34841. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34842. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34843. +
  34844. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34845. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34846. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34847. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34848. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34849. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34850. +
  34851. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34852. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34853. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34854. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34855. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34856. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34857. +
  34858. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34859. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34860. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34861. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34862. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34863. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34864. +
  34865. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34866. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  34867. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34868. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  34869. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34870. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  34871. +
  34872. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  34873. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  34874. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  34875. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  34876. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  34877. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  34878. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  34879. +
  34880. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  34881. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34882. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34883. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  34884. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34885. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34886. +
  34887. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  34888. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  34889. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  34890. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  34891. +
  34892. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  34893. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34894. +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34895. +
  34896. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  34897. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  34898. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  34899. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  34900. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  34901. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  34902. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  34903. +
  34904. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  34905. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34906. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34907. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  34908. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34909. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34910. +
  34911. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  34912. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  34913. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  34914. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  34915. +
  34916. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  34917. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34918. +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34919. +
  34920. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34921. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  34922. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  34923. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  34924. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  34925. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  34926. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD,RS2}, 0, 0},
  34927. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  34928. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  34929. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  34930. +
  34931. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  34932. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  34933. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34934. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34935. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34936. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  34937. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  34938. +
  34939. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34940. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  34941. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  34942. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  34943. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  34944. +
  34945. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  34946. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34947. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  34948. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  34949. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  34950. +
  34951. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34952. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  34953. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  34954. +
  34955. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34956. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  34957. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  34958. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34959. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  34960. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  34961. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34962. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  34963. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  34964. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  34965. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  34966. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  34967. +
  34968. +/* class 4 */
  34969. +
  34970. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34971. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34972. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34973. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34974. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34975. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34976. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34977. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34978. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34979. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34980. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34981. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34982. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34983. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34984. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34985. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34986. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  34987. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  34988. +
  34989. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34990. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34991. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34992. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  34993. +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  34994. +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  34995. +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  34996. +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  34997. +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  34998. +
  34999. +/* class 5 */
  35000. +
  35001. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35002. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35003. +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35004. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35005. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35006. +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35007. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35008. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35009. +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35010. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35011. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35012. +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35013. +
  35014. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35015. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35016. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35017. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35018. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35019. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35020. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  35021. +
  35022. +/* class 6 */
  35023. +
  35024. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  35025. +
  35026. +{ 0, 0, 0, {0}, 0, 0 },
  35027. +
  35028. +} ;
  35029. +
  35030. +/* The opcode table. < ADVANCED MACRO > */
  35031. +
  35032. +const struct c33_opcode c33_advance_opcodes32[] =
  35033. +{
  35034. +/* class 0 */
  35035. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35036. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35037. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35038. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  35039. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  35040. +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
  35041. +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
  35042. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35043. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35044. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  35045. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35046. +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35047. +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* Adv */
  35048. +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* Adv */
  35049. +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* Adv */
  35050. +{ "mac.w", OP_CLASS0_1(0x04), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35051. +{ "mac.hw", OP_CLASS0_1(0x05), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35052. +{ "macclr", OP_CLASS0_1(0x06), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
  35053. +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
  35054. +{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35055. +{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35056. +{ "repeat", OP_CLASS0_1(0x0a), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35057. +{ "repeat", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {IMM4_01}, 0, 0}, /* Adv */
  35058. +
  35059. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35060. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35061. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35062. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35063. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35064. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35065. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35066. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35067. +
  35068. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35069. +{ "retm", OP_CLASS0_1(0x1b), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},/* Adv */ /* 2002/10/01 */
  35070. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35071. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35072. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35073. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35074. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35075. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35076. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35077. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35078. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35079. +
  35080. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35081. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35082. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35083. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35084. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35085. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35086. +
  35087. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35088. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35089. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35090. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35091. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35092. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35093. +
  35094. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35095. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35096. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35097. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35098. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35099. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35100. +
  35101. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35102. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35103. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35104. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35105. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35106. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35107. +
  35108. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35109. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35110. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35111. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35112. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35113. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35114. +
  35115. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35116. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35117. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35118. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35119. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35120. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35121. +
  35122. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35123. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35124. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35125. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35126. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35127. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35128. +
  35129. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35130. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35131. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35132. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35133. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35134. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35135. +
  35136. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35137. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35138. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35139. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35140. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35141. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35142. +
  35143. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35144. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35145. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35146. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35147. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35148. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35149. +
  35150. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35151. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35152. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35153. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35154. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35155. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35156. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35157. +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  35158. +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  35159. +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35160. +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  35161. +
  35162. +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
  35163. +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 1}, /* Adv */
  35164. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35165. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  35166. +//{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  35167. +//{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  35168. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35169. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35170. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35171. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35172. +
  35173. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35174. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35175. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35176. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35177. +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  35178. +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35179. +
  35180. +{ "xld.ub", OP_CLASS2(0x39), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
  35181. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35182. +//{ "xld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  35183. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35184. +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35185. +
  35186. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35187. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35188. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35189. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35190. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35191. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35192. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35193. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  35194. +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  35195. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35196. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35197. +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  35198. +
  35199. +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
  35200. +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 2}, /* Adv */
  35201. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35202. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  35203. +//{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  35204. +//{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  35205. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35206. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35207. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35208. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35209. +
  35210. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35211. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35212. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35213. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35214. +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  35215. +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35216. +
  35217. +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
  35218. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35219. +//{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  35220. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35221. +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35222. +
  35223. +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  35224. +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  35225. +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  35226. +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  35227. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35228. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  35229. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35230. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35231. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35232. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  35233. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0},
  35234. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35235. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35236. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35237. +
  35238. +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 4}, /* Adv */
  35239. +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 4}, /* Adv */
  35240. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  35241. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  35242. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  35243. +//{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  35244. +//{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  35245. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35246. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  35247. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35248. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  35249. +
  35250. +
  35251. +//{ "ald.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  35252. +//{ "ald.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  35253. +//{ "ald.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  35254. +//{ "ald.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  35255. +//{ "ald.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  35256. +//{ "ald.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  35257. +//{ "ald.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  35258. +//{ "ald.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  35259. +
  35260. +{ "ald.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDB_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35261. +{ "ald.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDB_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35262. +{ "ald.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDUB_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35263. +{ "ald.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDH_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35264. +{ "ald.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDH_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35265. +{ "ald.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDUH_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35266. +{ "ald.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,ALDW_RD_MEM_IMM19}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35267. +{ "ald.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {ALDW_WR_MEM_IMM19,RS}, 0, 0}, /* Adv */ /* change 2004/07/23 T.Tazaki */
  35268. +
  35269. +
  35270. +{ "add", OP_CLASS0_1(0x0d), OP_CLASS0_1_MASK, {RD01,DP}, 0, 0}, /* Adv */
  35271. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35272. +{ "add", OP_CLASS3(0x18), OP_CLASS1_MASK, {RD,DP_OFF_SYMBOL6_2},0,0}, /* Adv */
  35273. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35274. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35275. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35276. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35277. +
  35278. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35279. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35280. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35281. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35282. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35283. +
  35284. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35285. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35286. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35287. +
  35288. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35289. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35290. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35291. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35292. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35293. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35294. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35295. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35296. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35297. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35298. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35299. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35300. +
  35301. +/* class 4 */
  35302. +
  35303. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35304. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},/* Adv */
  35305. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35306. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35307. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  35308. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35309. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35310. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  35311. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35312. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35313. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  35314. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35315. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35316. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  35317. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35318. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35319. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  35320. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35321. +
  35322. +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35323. +{ "sat.b", OP_CLASS4_2(0x9e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35324. +{ "sat.ub", OP_CLASS4_2(0x9f), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35325. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35326. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35327. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35328. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35329. +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35330. +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35331. +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35332. +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35333. +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  35334. +
  35335. +/* class 5 */
  35336. +
  35337. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35338. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35339. +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35340. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35341. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35342. +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35343. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35344. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35345. +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35346. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35347. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35348. +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35349. +
  35350. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35351. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35352. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35353. +{ "mlt.hw", OP_CLASS5(0xa3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35354. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35355. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35356. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35357. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  35358. +{ "mac1.h", OP_CLASS5(0xa7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35359. +{ "mac1.hw",OP_CLASS5(0xab), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35360. +{ "mac1.w", OP_CLASS5(0xb3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35361. +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* Adv */
  35362. +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* Adv */
  35363. +{ "sat.h", OP_CLASS5(0xb6), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35364. +{ "sat.uh", OP_CLASS5(0xb7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35365. +{ "loop", OP_CLASS5(0xb9), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35366. +{ "loop", OP_CLASS5(0xba), OP_CLASS5_MASK, {RD,IMM5_LABEL}, 0, 0}, /* Adv */
  35367. +{ "loop", OP_CLASS5(0xbb), OP_CLASS5_MASK, {IMM5_2,IMM5_LABEL},0, 0}, /* Adv */
  35368. +{ "sat.w", OP_CLASS5(0xbd), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35369. +{ "sat.uw", OP_CLASS5(0xbe), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  35370. +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* Adv */
  35371. +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* Adv */
  35372. +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* Adv */
  35373. +
  35374. +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2,OP_SHIFT,IMM2},0, 0}, /* Adv */
  35375. +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2}, 0, 0}, /* Adv */
  35376. +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {COND}, 0, 0}, /* Adv */
  35377. +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {OP_SHIFT,IMM2}, 0, 0}, /* Adv */
  35378. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  35379. +
  35380. +{ 0, 0, 0, {0}, 0, 0 },
  35381. +
  35382. +} ;
  35383. +
  35384. +const struct c33_opcode c33_ext_opcodes[] =
  35385. +{
  35386. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  35387. +{ 0, 0, 0, {0}, 0, 0 }
  35388. +
  35389. +} ;
  35390. +
  35391. +
  35392. +/* Advanced Macro Opecode name class0 - bit5,4 = 0,1 */
  35393. +const char *c33_adv_opcodes[] =
  35394. +{
  35395. + "push",
  35396. + "pop",
  35397. + "pushs",
  35398. + "pops",
  35399. + "mac.w",
  35400. + "mac.hw",
  35401. + "macclr",
  35402. + "ld.cf",
  35403. + "div.w",
  35404. + "divu.w",
  35405. + "repeat",
  35406. + "add",
  35407. + 0
  35408. +};
  35409. +
  35410. +/* Advanced Macro Opecode name class5 - bit12_8 = 111:11 */
  35411. +const char *c33_adv_class5_opcodes[] =
  35412. +{
  35413. + "do.c",
  35414. + "psrset",
  35415. + "psrclr",
  35416. + 0
  35417. +};
  35418. +
  35419. +#if 0 /* 下へ移動 T.Tazaki 2004/07/30 */
  35420. +const int c33_num_opcodes =
  35421. + sizeof (c33_opcodes) / sizeof (c33_opcodes[0]);
  35422. +#endif
  35423. +
  35424. +
  35425. +/* The opcode table. < PE MACRO > */
  35426. +
  35427. +const struct c33_opcode c33_pe_opcodes32[] =
  35428. +{
  35429. +/* class 0 */
  35430. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35431. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35432. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35433. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  35434. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  35435. +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
  35436. +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
  35437. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35438. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35439. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  35440. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35441. +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* PE */
  35442. +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* PE */
  35443. +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* PE */
  35444. +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* PE */
  35445. +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10}, /* PE */ /* add 2004/07/07 T.Tazaki */
  35446. +//{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
  35447. +//{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
  35448. +
  35449. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35450. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35451. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35452. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35453. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35454. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35455. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35456. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35457. +
  35458. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35459. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35460. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35461. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35462. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35463. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35464. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35465. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35466. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35467. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35468. +
  35469. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35470. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35471. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35472. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35473. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35474. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35475. +
  35476. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35477. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35478. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35479. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35480. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35481. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35482. +
  35483. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35484. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35485. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35486. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35487. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35488. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35489. +
  35490. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35491. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35492. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35493. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35494. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35495. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35496. +
  35497. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35498. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35499. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35500. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35501. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35502. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35503. +
  35504. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35505. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35506. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35507. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35508. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35509. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35510. +
  35511. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35512. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35513. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35514. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35515. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35516. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35517. +
  35518. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35519. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35520. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35521. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35522. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35523. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35524. +
  35525. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35526. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35527. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35528. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35529. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35530. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35531. +
  35532. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35533. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35534. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35535. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35536. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35537. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35538. +
  35539. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35540. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35541. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35542. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35543. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35544. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35545. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35546. +
  35547. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35548. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35549. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDB_RD_MEM_IMM26}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  35550. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  35551. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35552. +{ "xld.b", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDB_WR_MEM_IMM26,RS}, 0, 0}, /* change 2004/07/23 T.Tazaki */
  35553. +
  35554. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35555. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35556. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35557. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35558. +
  35559. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35560. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35561. +{ "xld.ub", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUB_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35562. +
  35563. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35564. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35565. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35566. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35567. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35568. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35569. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35570. +
  35571. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35572. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35573. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDH_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35574. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  35575. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35576. +{ "xld.h", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDH_WR_MEM_IMM26,RS}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35577. +
  35578. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35579. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35580. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35581. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35582. +
  35583. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35584. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35585. +{ "xld.uh", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDUH_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35586. +
  35587. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35588. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  35589. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35590. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35591. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35592. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  35593. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0}, /* PE ld %sd,%rs */
  35594. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35595. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35596. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35597. +
  35598. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  35599. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  35600. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB_IMM26}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35601. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,XLDW_RD_MEM_IMM26}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35602. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB_IMM26,RS}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35603. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XLDW_WR_MEM_IMM26,RS}, 0, 0},/* change 2004/07/23 T.Tazaki */
  35604. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  35605. +
  35606. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35607. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35608. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35609. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35610. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35611. +
  35612. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35613. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35614. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35615. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35616. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35617. +
  35618. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35619. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35620. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35621. +
  35622. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35623. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35624. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35625. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35626. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35627. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35628. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35629. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35630. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35631. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35632. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35633. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35634. +
  35635. +/* class 4 */
  35636. +
  35637. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35638. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35639. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35640. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35641. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35642. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35643. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35644. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35645. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35646. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35647. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35648. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35649. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35650. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35651. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35652. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35653. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  35654. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  35655. +
  35656. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35657. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35658. +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* PE */
  35659. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35660. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35661. +//{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35662. +//{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35663. +//{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35664. +//{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35665. +//{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  35666. +
  35667. +/* class 5 */
  35668. +
  35669. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35670. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35671. +{ "xbtst", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBTST_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35672. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35673. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35674. +{ "xbclr", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBCLR_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35675. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35676. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35677. +{ "xbset", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBSET_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35678. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35679. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/26 */
  35680. +{ "xbnot", OP_CLASS3(0x1b), OP_CLASS3_MASK, {XBNOT_MEM_IMM26,IMM3}, 0, 0}, /* change T.Tazaki 2004/07/23 */
  35681. +
  35682. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35683. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35684. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35685. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35686. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35687. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35688. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  35689. +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  35690. +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  35691. +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  35692. +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* PE */
  35693. +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* PE */
  35694. +
  35695. +/* class 6 */
  35696. +
  35697. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  35698. +
  35699. +{ 0, 0, 0, {0}, 0, 0 },
  35700. +
  35701. +} ;
  35702. +
  35703. +/*************************************************************************************************/
  35704. +/* Use default data area mode */
  35705. +/*************************************************************************************************/
  35706. +const struct c33_opcode c33_opcodes[] =
  35707. +{
  35708. +/* class 0 */
  35709. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35710. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35711. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35712. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  35713. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  35714. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35715. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35716. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  35717. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35718. +
  35719. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35720. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35721. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35722. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35723. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35724. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35725. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35726. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35727. +
  35728. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35729. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35730. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35731. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35732. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35733. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35734. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35735. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35736. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35737. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35738. +
  35739. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35740. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35741. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35742. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35743. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35744. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35745. +
  35746. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35747. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35748. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35749. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35750. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35751. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35752. +
  35753. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35754. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35755. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35756. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35757. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35758. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35759. +
  35760. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35761. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35762. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35763. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35764. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35765. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35766. +
  35767. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35768. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35769. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35770. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35771. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35772. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35773. +
  35774. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35775. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35776. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35777. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35778. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35779. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35780. +
  35781. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35782. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35783. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35784. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35785. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35786. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35787. +
  35788. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35789. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35790. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35791. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35792. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35793. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35794. +
  35795. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35796. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35797. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35798. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35799. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35800. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35801. +
  35802. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35803. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35804. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35805. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35806. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35807. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35808. +
  35809. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35810. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35811. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35812. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35813. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35814. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35815. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35816. +
  35817. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35818. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  35819. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  35820. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  35821. +
  35822. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35823. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35824. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35825. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35826. +
  35827. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  35828. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  35829. +
  35830. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35831. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35832. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35833. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35834. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35835. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35836. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35837. +
  35838. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35839. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  35840. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  35841. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  35842. +
  35843. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35844. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35845. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35846. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35847. +
  35848. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  35849. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  35850. +
  35851. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35852. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  35853. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  35854. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  35855. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  35856. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  35857. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD,RS2}, 0, 0},
  35858. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  35859. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  35860. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  35861. +
  35862. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  35863. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  35864. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  35865. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  35866. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  35867. +
  35868. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35869. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35870. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35871. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35872. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35873. +
  35874. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35875. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35876. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  35877. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  35878. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  35879. +
  35880. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35881. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35882. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35883. +
  35884. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35885. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35886. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35887. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35888. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35889. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35890. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35891. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35892. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35893. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  35894. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  35895. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  35896. +
  35897. +/* class 4 */
  35898. +
  35899. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35900. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35901. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35902. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35903. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35904. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35905. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35906. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35907. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35908. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35909. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35910. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35911. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35912. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35913. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35914. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35915. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM4}, 0, 5},
  35916. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 6},
  35917. +
  35918. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35919. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35920. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35921. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  35922. +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35923. +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35924. +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35925. +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  35926. +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  35927. +
  35928. +/* class 5 */
  35929. +
  35930. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35931. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  35932. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35933. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  35934. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35935. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  35936. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  35937. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  35938. +
  35939. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35940. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35941. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35942. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35943. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35944. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  35945. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  35946. +
  35947. +/* class 6 */
  35948. +
  35949. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  35950. +
  35951. +{ 0, 0, 0, {0}, 0, 0 },
  35952. +
  35953. +} ;
  35954. +
  35955. +/* The opcode table. < ADVANCED MACRO > */
  35956. +
  35957. +const struct c33_opcode c33_advance_opcodes[] =
  35958. +{
  35959. +/* class 0 */
  35960. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35961. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35962. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35963. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  35964. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  35965. +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
  35966. +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* Adv */
  35967. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35968. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35969. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  35970. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35971. +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35972. +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* Adv */
  35973. +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* Adv */
  35974. +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* Adv */
  35975. +{ "mac.w", OP_CLASS0_1(0x04), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35976. +{ "mac.hw", OP_CLASS0_1(0x05), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* Adv */
  35977. +{ "macclr", OP_CLASS0_1(0x06), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
  35978. +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10},/* Adv */
  35979. +{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35980. +{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35981. +{ "repeat", OP_CLASS0_1(0x0a), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* Adv */
  35982. +{ "repeat", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {IMM4_01}, 0, 0}, /* Adv */
  35983. +
  35984. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35985. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35986. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35987. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35988. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35989. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  35990. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35991. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  35992. +
  35993. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35994. +{ "retm", OP_CLASS0_1(0x1b), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},/* Adv */ /* 2002/10/01 */
  35995. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  35996. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35997. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  35998. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  35999. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36000. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36001. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36002. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36003. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36004. +
  36005. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36006. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36007. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36008. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36009. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36010. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36011. +
  36012. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36013. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36014. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36015. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36016. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36017. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36018. +
  36019. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36020. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36021. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36022. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36023. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36024. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36025. +
  36026. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36027. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36028. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36029. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36030. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36031. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36032. +
  36033. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36034. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36035. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36036. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36037. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36038. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36039. +
  36040. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36041. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36042. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36043. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36044. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36045. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36046. +
  36047. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36048. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36049. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36050. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36051. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36052. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36053. +
  36054. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36055. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36056. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36057. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36058. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36059. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36060. +
  36061. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36062. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36063. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36064. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36065. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36066. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36067. +
  36068. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36069. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36070. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36071. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36072. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36073. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36074. +
  36075. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36076. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36077. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36078. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36079. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36080. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36081. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36082. +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  36083. +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  36084. +{ "ld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36085. +{ "ld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  36086. +
  36087. +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
  36088. +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 1}, /* Adv */
  36089. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  36090. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  36091. +{ "xld.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  36092. +{ "xld.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  36093. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36094. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36095. +
  36096. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36097. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36098. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36099. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36100. +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  36101. +{ "ld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36102. +
  36103. +{ "xld.ub", OP_CLASS2(0x39), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 1}, /* Adv */
  36104. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  36105. +{ "xld.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  36106. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36107. +
  36108. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36109. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36110. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36111. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36112. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36113. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36114. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36115. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  36116. +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  36117. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36118. +{ "ld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36119. +{ "ld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  36120. +
  36121. +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
  36122. +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 2}, /* Adv */
  36123. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  36124. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  36125. +{ "xld.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  36126. +{ "xld.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  36127. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36128. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36129. +
  36130. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36131. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36132. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36133. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36134. +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  36135. +{ "ld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36136. +
  36137. +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 2}, /* Adv */
  36138. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  36139. +{ "xld.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  36140. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36141. +
  36142. +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM6}, 0, 0}, /* Adv */
  36143. +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM6,RS}, 0, 0}, /* Adv */
  36144. +{ "ld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_OFF_SYMBOL6},0, 0}, /* Adv */
  36145. +{ "ld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_OFF_SYMBOL6,RS},0, 0}, /* Adv */
  36146. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36147. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  36148. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36149. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36150. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36151. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  36152. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0},
  36153. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36154. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36155. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36156. +
  36157. +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DPIMM32}, 0, 4}, /* Adv */
  36158. +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DPIMM32,RS}, 0, 4}, /* Adv */
  36159. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  36160. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  36161. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  36162. +{ "xld.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL32}, 0, 0}, /* Adv */
  36163. +{ "xld.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL32,RS}, 0, 0}, /* Adv */
  36164. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36165. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36166. +
  36167. +{ "ald.b", OP_CLASS7(0x38), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  36168. +{ "ald.b", OP_CLASS7(0x3d), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  36169. +
  36170. +{ "ald.ub", OP_CLASS7(0x39), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  36171. +
  36172. +{ "ald.h", OP_CLASS7(0x3a), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  36173. +{ "ald.h", OP_CLASS7(0x3e), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  36174. +
  36175. +{ "ald.uh", OP_CLASS7(0x3b), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  36176. +
  36177. +{ "ald.w", OP_CLASS7(0x3c), OP_CLASS7_MASK, {RD,DP_SYMBOL19}, 0, 0}, /* Adv */
  36178. +{ "ald.w", OP_CLASS7(0x3f), OP_CLASS7_MASK, {DP_SYMBOL19,RS}, 0, 0}, /* Adv */
  36179. +
  36180. +{ "add", OP_CLASS0_1(0x0d), OP_CLASS0_1_MASK, {RD01,DP}, 0, 0}, /* Adv */
  36181. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  36182. +{ "add", OP_CLASS3(0x18), OP_CLASS1_MASK, {RD,DP_OFF_SYMBOL6_2},0,0}, /* Adv */
  36183. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36184. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36185. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36186. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  36187. +
  36188. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36189. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36190. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  36191. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36192. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  36193. +
  36194. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36195. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36196. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36197. +
  36198. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36199. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36200. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36201. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36202. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36203. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36204. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36205. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36206. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36207. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36208. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36209. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36210. +
  36211. +/* class 4 */
  36212. +
  36213. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36214. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},/* Adv */
  36215. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36216. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36217. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  36218. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36219. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36220. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  36221. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36222. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36223. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  36224. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36225. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36226. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  36227. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36228. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36229. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* Adv */
  36230. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36231. +
  36232. +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36233. +{ "sat.b", OP_CLASS4_2(0x9e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36234. +{ "sat.ub", OP_CLASS4_2(0x9f), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36235. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36236. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36237. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36238. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36239. +{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36240. +{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36241. +{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36242. +{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36243. +{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  36244. +
  36245. +/* class 5 */
  36246. +
  36247. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36248. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36249. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36250. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36251. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36252. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36253. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36254. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36255. +
  36256. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36257. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36258. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36259. +{ "mlt.hw", OP_CLASS5(0xa3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36260. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36261. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36262. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36263. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  36264. +{ "mac1.h", OP_CLASS5(0xa7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36265. +{ "mac1.hw",OP_CLASS5(0xab), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36266. +{ "mac1.w", OP_CLASS5(0xb3), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36267. +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* Adv */
  36268. +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* Adv */
  36269. +{ "sat.h", OP_CLASS5(0xb6), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36270. +{ "sat.uh", OP_CLASS5(0xb7), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36271. +{ "loop", OP_CLASS5(0xb9), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36272. +{ "loop", OP_CLASS5(0xba), OP_CLASS5_MASK, {RD,IMM5_LABEL}, 0, 0}, /* Adv */
  36273. +{ "loop", OP_CLASS5(0xbb), OP_CLASS5_MASK, {IMM5_2,IMM5_LABEL},0, 0}, /* Adv */
  36274. +{ "sat.w", OP_CLASS5(0xbd), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36275. +{ "sat.uw", OP_CLASS5(0xbe), OP_CLASS5_MASK, {RD,RS2}, 0, 0}, /* Adv */
  36276. +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* Adv */
  36277. +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* Adv */
  36278. +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* Adv */
  36279. +
  36280. +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2,OP_SHIFT,IMM2},0, 0}, /* Adv */
  36281. +{ "ext", OP_CLASS1(0x3f), OP_CLASS1_MASK, {RS2}, 0, 0}, /* Adv */
  36282. +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {COND}, 0, 0}, /* Adv */
  36283. +{ "ext", OP_CLASS1(0x3b), OP_CLASS1_MASK, {OP_SHIFT,IMM2}, 0, 0}, /* Adv */
  36284. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  36285. +
  36286. +{ 0, 0, 0, {0}, 0, 0 },
  36287. +
  36288. +} ;
  36289. +
  36290. +
  36291. +/* The opcode table. < PE MACRO > */
  36292. +
  36293. +const struct c33_opcode c33_pe_opcodes[] =
  36294. +{
  36295. +/* class 0 */
  36296. +{ "nop", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36297. +{ "slp", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36298. +{ "halt", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36299. +{ "pushn", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RS}, 0, 0},
  36300. +{ "popn", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RD}, 0, 0},
  36301. +{ "jpr", OP_CLASS0_1(0x0b), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
  36302. +{ "jpr.d", OP_CLASS0_1(0x0f), OP_CLASS0_1_MASK, {RB0}, 0, 0}, /* PE */
  36303. +{ "brk", OP_CLASS0_1(0x10), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36304. +{ "retd", OP_CLASS0_1(0x11), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36305. +{ "int", OP_CLASS0_1(0x12), OP_CLASS0_1_MASK, {IMM2}, 0, 0},
  36306. +{ "reti", OP_CLASS0_1(0x13), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36307. +{ "push", OP_CLASS0_1(0x00), OP_CLASS0_1_MASK, {RS01}, 0, 0}, /* PE */
  36308. +{ "pop", OP_CLASS0_1(0x01), OP_CLASS0_1_MASK, {RD01}, 0, 0}, /* PE */
  36309. +{ "pushs", OP_CLASS0_1(0x02), OP_CLASS0_1_MASK, {SS02}, 0, 0}, /* PE */
  36310. +{ "pops", OP_CLASS0_1(0x03), OP_CLASS0_1_MASK, {SD02}, 0, 0}, /* PE */
  36311. +{ "ld.cf", OP_CLASS0_1(0x07), OP_CLASS0_1_MASK, {UNUSED}, 0, 10}, /* PE */ /* add 2004/07/07 T.Tazaki */
  36312. +//{ "div.w", OP_CLASS0_1(0x09), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
  36313. +//{ "divu.w", OP_CLASS0_1(0x08), OP_CLASS0_1_MASK, {RB01}, 0, 0}, /* PE */ /* del 2004/07/07 T.Tazaki */
  36314. +
  36315. +{ "call", OP_CLASS0_1(0x18), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  36316. +{ "call", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36317. +{ "call.d", OP_CLASS0_1(0x1c), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  36318. +{ "call.d", OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36319. +{ "scall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36320. +{ "scall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36321. +{ "xcall", OP_CLASS0_2(0x1c), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36322. +{ "xcall.d",OP_CLASS0_2(0x1d), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36323. +
  36324. +{ "ret", OP_CLASS0_1(0x19), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36325. +{ "ret.d", OP_CLASS0_1(0x1d), OP_CLASS0_1_MASK, {UNUSED}, 0, 0},
  36326. +{ "jp", OP_CLASS0_1(0x1a), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  36327. +{ "jp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36328. +{ "jp.d", OP_CLASS0_1(0x1e), OP_CLASS0_1_MASK, {RB0}, 0, 0},
  36329. +{ "jp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36330. +{ "sjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36331. +{ "sjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36332. +{ "xjp", OP_CLASS0_2(0x1e), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36333. +{ "xjp.d", OP_CLASS0_2(0x1f), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36334. +
  36335. +{ "jrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36336. +{ "jrgt.d", OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36337. +{ "sjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36338. +{ "sjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36339. +{ "xjrgt", OP_CLASS0_2(0x08), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36340. +{ "xjrgt.d",OP_CLASS0_2(0x09), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36341. +
  36342. +{ "jrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36343. +{ "jrge.d", OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36344. +{ "sjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36345. +{ "sjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36346. +{ "xjrge", OP_CLASS0_2(0x0A), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36347. +{ "xjrge.d",OP_CLASS0_2(0x0B), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36348. +
  36349. +{ "jrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36350. +{ "jrlt.d", OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36351. +{ "sjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36352. +{ "sjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36353. +{ "xjrlt", OP_CLASS0_2(0x0C), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36354. +{ "xjrlt.d",OP_CLASS0_2(0x0D), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36355. +
  36356. +{ "jrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36357. +{ "jrle.d", OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36358. +{ "sjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36359. +{ "sjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36360. +{ "xjrle", OP_CLASS0_2(0x0E), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36361. +{ "xjrle.d",OP_CLASS0_2(0x0F), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36362. +
  36363. +{ "jrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36364. +{ "jrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36365. +{ "sjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36366. +{ "sjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36367. +{ "xjrugt", OP_CLASS0_2(0x10), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36368. +{ "xjrugt.d",OP_CLASS0_2(0x11), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36369. +
  36370. +{ "jruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36371. +{ "jruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36372. +{ "sjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36373. +{ "sjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36374. +{ "xjruge", OP_CLASS0_2(0x12), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36375. +{ "xjruge.d",OP_CLASS0_2(0x13), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36376. +
  36377. +{ "jrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36378. +{ "jrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36379. +{ "sjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36380. +{ "sjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36381. +{ "xjrult", OP_CLASS0_2(0x14), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36382. +{ "xjrult.d",OP_CLASS0_2(0x15), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36383. +
  36384. +{ "jrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36385. +{ "jrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36386. +{ "sjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36387. +{ "sjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36388. +{ "xjrule", OP_CLASS0_2(0x16), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36389. +{ "xjrule.d",OP_CLASS0_2(0x17), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36390. +
  36391. +{ "jreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36392. +{ "jreq.d", OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36393. +{ "sjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36394. +{ "sjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36395. +{ "xjreq", OP_CLASS0_2(0x18), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36396. +{ "xjreq.d",OP_CLASS0_2(0x19), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36397. +
  36398. +{ "jrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36399. +{ "jrne.d", OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN8_LABELIMM8}, 0, 0},
  36400. +{ "sjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36401. +{ "sjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM22},0, 0},
  36402. +{ "xjrne", OP_CLASS0_2(0x1a), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36403. +{ "xjrne.d",OP_CLASS0_2(0x1b), OP_CLASS0_2_MASK, {SIGN32_LABELIMM32},0, 0},
  36404. +
  36405. +{ "ld.b", OP_CLASS5(0xa1), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36406. +{ "ld.b", OP_CLASS1(0x21), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36407. +{ "ld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36408. +{ "ld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36409. +{ "ld.b", OP_CLASS1(0x35), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36410. +{ "ld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36411. +{ "ld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36412. +
  36413. +{ "xld.b", OP_CLASS2(0x10), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  36414. +{ "xld.b", OP_CLASS1(0x20), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36415. +{ "xld.b", OP_CLASS2(0x15), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 1},
  36416. +{ "xld.b", OP_CLASS1(0x34), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36417. +
  36418. +{ "ld.ub", OP_CLASS5(0xa5), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36419. +{ "ld.ub", OP_CLASS1(0x25), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36420. +{ "ld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36421. +{ "ld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36422. +
  36423. +{ "xld.ub", OP_CLASS2(0x11), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 1},
  36424. +{ "xld.ub", OP_CLASS1(0x24), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36425. +
  36426. +{ "ld.h", OP_CLASS5(0xa9), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36427. +{ "ld.h", OP_CLASS1(0x29), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36428. +{ "ld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36429. +{ "ld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36430. +{ "ld.h", OP_CLASS1(0x39), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36431. +{ "ld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36432. +{ "ld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36433. +
  36434. +{ "xld.h", OP_CLASS2(0x12), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  36435. +{ "xld.h", OP_CLASS1(0x28), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36436. +{ "xld.h", OP_CLASS2(0x16), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 2},
  36437. +{ "xld.h", OP_CLASS1(0x38), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36438. +
  36439. +{ "ld.uh", OP_CLASS5(0xad), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36440. +{ "ld.uh", OP_CLASS1(0x2d), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36441. +{ "ld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36442. +{ "ld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36443. +
  36444. +{ "xld.uh", OP_CLASS2(0x13), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 2},
  36445. +{ "xld.uh", OP_CLASS1(0x2c), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36446. +
  36447. +{ "ld.w", OP_CLASS1(0x2e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36448. +{ "ld.w", OP_CLASS5(0xa4), OP_CLASS5_MASK, {RD,SS}, 0, 0},
  36449. +{ "ld.w", OP_CLASS1(0x31), OP_CLASS1_MASK, {RD,REGINC}, 0, 0},
  36450. +{ "ld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM6}, 0, 0},
  36451. +{ "ld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,RB}, 0, 0},
  36452. +{ "ld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN6_SYMBOLIMM6}, 0, 0},
  36453. +{ "ld.w", OP_CLASS5(0xa0), OP_CLASS5_MASK, {SD_LD,RS2}, 0, 0}, /* PE ld %sd,%rs */
  36454. +{ "ld.w", OP_CLASS1(0x3d), OP_CLASS1_MASK, {REGINC,RS}, 0, 0},
  36455. +{ "ld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM6,RS}, 0, 0},
  36456. +{ "ld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {RB,RS}, 0, 0},
  36457. +
  36458. +{ "xld.w", OP_CLASS2(0x14), OP_CLASS2_MASK, {RD,SPIMM32}, 0, 4},
  36459. +{ "xld.w", OP_CLASS2(0x17), OP_CLASS2_MASK, {SPIMM32,RS}, 0, 4},
  36460. +{ "xld.w", OP_CLASS1(0x30), OP_CLASS1_MASK, {RD,MEM_IMM26}, 0, 0},
  36461. +{ "xld.w", OP_CLASS1(0x3c), OP_CLASS1_MASK, {MEM_IMM26,RS}, 0, 0},
  36462. +{ "xld.w", OP_CLASS3(0x1b), OP_CLASS3_MASK, {RD,SIGN32_SYMBOLIMM32}, 0, 0},
  36463. +
  36464. +{ "add", OP_CLASS1(0x22), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36465. +{ "add", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  36466. +{ "add", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36467. +{ "xadd", OP_CLASS4_1(0x20), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36468. +{ "xadd", OP_CLASS3(0x18), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  36469. +
  36470. +{ "sub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36471. +{ "sub", OP_CLASS1(0x26), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36472. +{ "sub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM6}, 0, 0},
  36473. +{ "xsub", OP_CLASS4_1(0x21), OP_CLASS4_1_MASK, {SP,IMM10}, 0, 0},
  36474. +{ "xsub", OP_CLASS3(0x19), OP_CLASS3_MASK, {RD,IMM32}, 0, 0},
  36475. +
  36476. +{ "cmp", OP_CLASS1(0x2a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36477. +{ "cmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36478. +{ "xcmp", OP_CLASS3(0x1a), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36479. +
  36480. +{ "and", OP_CLASS1(0x32), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36481. +{ "and", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36482. +{ "xand", OP_CLASS3(0x1c), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36483. +{ "or", OP_CLASS1(0x36), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36484. +{ "or", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36485. +{ "xoor", OP_CLASS3(0x1d), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36486. +{ "xor", OP_CLASS1(0x3a), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36487. +{ "xor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36488. +{ "xxor", OP_CLASS3(0x1e), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36489. +{ "not", OP_CLASS1(0x3e), OP_CLASS1_MASK, {RD,RS2}, 0, 0},
  36490. +{ "not", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN6}, 0, 0},
  36491. +{ "xnot", OP_CLASS3(0x1f), OP_CLASS3_MASK, {RD,SIGN32}, 0, 0},
  36492. +
  36493. +/* class 4 */
  36494. +
  36495. +{ "srl", OP_CLASS4_2(0x89), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36496. +{ "srl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36497. +{ "xsrl", OP_CLASS4_2(0x88), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36498. +{ "sll", OP_CLASS4_2(0x8d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36499. +{ "sll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36500. +{ "xsll", OP_CLASS4_2(0x8C), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36501. +{ "sra", OP_CLASS4_2(0x91), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36502. +{ "sra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36503. +{ "xsra", OP_CLASS4_2(0x90), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36504. +{ "sla", OP_CLASS4_2(0x95), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36505. +{ "sla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36506. +{ "xsla", OP_CLASS4_2(0x94), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36507. +{ "rr", OP_CLASS4_2(0x99), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36508. +{ "rr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36509. +{ "xrr", OP_CLASS4_2(0x98), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36510. +{ "rl", OP_CLASS4_2(0x9d), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36511. +{ "rl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7}, /* PE */
  36512. +{ "xrl", OP_CLASS4_2(0x9c), OP_CLASS4_2_MASK, {RD,IMM5}, 0, 7},
  36513. +
  36514. +{ "scan0", OP_CLASS4_2(0x8a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36515. +{ "scan1", OP_CLASS4_2(0x8e), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36516. +{ "swaph", OP_CLASS4_2(0x9a), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0}, /* PE */
  36517. +{ "swap", OP_CLASS4_2(0x92), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36518. +{ "mirror", OP_CLASS4_2(0x96), OP_CLASS4_2_MASK, {RD,RS2}, 0, 0},
  36519. +//{ "div0s", OP_CLASS4_2(0x8b), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36520. +//{ "div0u", OP_CLASS4_2(0x8f), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36521. +//{ "div1", OP_CLASS4_2(0x93), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36522. +//{ "div2s", OP_CLASS4_2(0x97), OP_CLASS4_2_MASK, {RS2}, 0, 0},
  36523. +//{ "div3s", OP_CLASS4_2(0x9b), OP_CLASS4_2_MASK, {UNUSED}, 0, 0},
  36524. +
  36525. +/* class 5 */
  36526. +
  36527. +{ "btst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36528. +{ "xbtst", OP_CLASS5(0xa8), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36529. +{ "bclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36530. +{ "xbclr", OP_CLASS5(0xac), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36531. +{ "bset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36532. +{ "xbset", OP_CLASS5(0xb0), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36533. +{ "bnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {RB,IMM3}, 0, 0},
  36534. +{ "xbnot", OP_CLASS5(0xb4), OP_CLASS5_MASK, {MEM_IMM26,IMM3}, 0, 0},
  36535. +
  36536. +{ "adc", OP_CLASS5(0xb8), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36537. +{ "sbc", OP_CLASS5(0xbc), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36538. +{ "mlt.h", OP_CLASS5(0xa2), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36539. +{ "mltu.h", OP_CLASS5(0xa6), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36540. +{ "mlt.w", OP_CLASS5(0xaa), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36541. +{ "mltu.w", OP_CLASS5(0xae), OP_CLASS5_MASK, {RD,RS2}, 0, 0},
  36542. +{ "mac", OP_CLASS5(0xb2), OP_CLASS5_MASK, {RS2}, 0, 0},
  36543. +{ "ld.c", OP_CLASS5(0xb1), OP_CLASS5_MASK, {RD,IMM5}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  36544. +{ "ld.c", OP_CLASS5(0xb5), OP_CLASS5_MASK, {IMM5,RS}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  36545. +{ "do.c", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM6_OP3}, 0, 0}, /* PE */ /* add T.Tazaki 2004/07/07 */
  36546. +{ "psrset", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_01}, 0, 0}, /* PE */
  36547. +{ "psrclr", OP_CLASS5(0xbf), OP_CLASS5_MASK, {IMM5_OP3_10}, 0, 0}, /* PE */
  36548. +
  36549. +/* class 6 */
  36550. +
  36551. +{ "ext", OP_CLASS6(0x6), OP_CLASS6_MASK, {IMM13_LABEL}, 0, 0},
  36552. +
  36553. +{ 0, 0, 0, {0}, 0, 0 },
  36554. +
  36555. +} ;
  36556. +
  36557. +/* 上から移動 T.Tazaki 2004/07/30 */
  36558. +const int c33_num_opcodes =
  36559. + sizeof (c33_opcodes) / sizeof (c33_opcodes[0]);
  36560. diff --git a/opcodes/configure b/opcodes/configure
  36561. index 72c9726..946b73f 100755
  36562. --- a/opcodes/configure
  36563. +++ b/opcodes/configure
  36564. @@ -3948,6 +3948,7 @@ if test x${all_targets} = xfalse ; then
  36565. bfd_tahoe_arch) ;;
  36566. bfd_tic30_arch) ta="$ta tic30-dis.lo" ;;
  36567. bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;;
  36568. + bfd_c33_arch) ta="$ta c33-opc.lo c33-dis.lo" ;;
  36569. bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36570. bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36571. bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36572. diff --git a/opcodes/configure.in b/opcodes/configure.in
  36573. index 6ef461f..2efc16f 100644
  36574. --- a/opcodes/configure.in
  36575. +++ b/opcodes/configure.in
  36576. @@ -163,6 +163,7 @@ if test x${all_targets} = xfalse ; then
  36577. bfd_tahoe_arch) ;;
  36578. bfd_tic30_arch) ta="$ta tic30-dis.lo" ;;
  36579. bfd_tic80_arch) ta="$ta tic80-dis.lo tic80-opc.lo" ;;
  36580. + bfd_c33_arch) ta="$ta c33-opc.lo c33-dis.lo" ;;
  36581. bfd_v850_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36582. bfd_v850e_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36583. bfd_v850ea_arch) ta="$ta v850-opc.lo v850-dis.lo" ;;
  36584. diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
  36585. index 373b652..8784007 100644
  36586. --- a/opcodes/disassemble.c
  36587. +++ b/opcodes/disassemble.c
  36588. @@ -55,6 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  36589. #define ARCH_z8k
  36590. #endif
  36591. +#define ARCH_c33 /* 追加 2001.1.15 ide */
  36592. disassembler_ftype
  36593. disassembler (abfd)
  36594. @@ -259,6 +260,14 @@ disassembler (abfd)
  36595. disassemble = print_insn_vax;
  36596. break;
  36597. #endif
  36598. +
  36599. +#ifdef ARCH_c33 /* add */
  36600. + case bfd_arch_c33:
  36601. + disassemble = print_insn_c33;
  36602. + break;
  36603. +#endif
  36604. +
  36605. +
  36606. default:
  36607. return 0;
  36608. }
  36609. --
  36610. 1.5.4.3