GfA-buildroot-changes.patch 272 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142
  1. diff --git a/CrossCompile.sh b/CrossCompile.sh
  2. new file mode 100755
  3. index 0000000..a2feabc
  4. --- /dev/null
  5. +++ b/CrossCompile.sh
  6. @@ -0,0 +1,41 @@
  7. +#! /bin/bash
  8. +#
  9. +#
  10. +
  11. +WRKDIR=`pwd`
  12. +CMDDIR=`dirname $0`
  13. +cd $CMDDIR
  14. +
  15. +TOOLCHAIN=`grep BR2_HOST_DIR .config | awk -F\= -F\" '{print $2}'`
  16. +echo $TOOLCHAIN
  17. +
  18. +if [[ $TOOLCHAIN = *\$\(BASE_DIR\)* ]]; then
  19. + export SYSROOT=`readlink -f $CMDDIR`/output/host/usr/bin/
  20. +else
  21. + export SYSROOT=$TOOLCHAIN/usr/bin
  22. +fi
  23. +
  24. +export PATH=$PATH:$SYSROOT
  25. +
  26. +export CROSS_COMPILE=arm-buildroot-linux-gnueabihf-
  27. +export ARCH=arm
  28. +export KERNELDIR=`pwd`/output/build/linux-7f280334068b7c875ade51f8f3921ab311f0c824
  29. +export BB_KERNEL_SOURCES=$KERNELDIR
  30. +export SYSROOTARM=`grep BR2_HOST_DIR .config | awk -F\= -F\" '{print $2}'`/usr/arm-buildroot-linux-gnueabihf/sysroot
  31. +export CC_FULLPATH="${SYSROOT}${CROSS_COMPILE}"
  32. +#--- gnupru
  33. +export PASM=pasm
  34. +##export PSYSROOT=/home/ru/pru/pru-gcc/bin
  35. +export PSYSROOT=/opt/GfA/PRU-ICSS/bin/pru-gcc/bin
  36. +export PATH=$PSYSROOT:$PATH
  37. +
  38. +export PCROSS_COMPILE=pru-
  39. +export PARCH=pru
  40. +
  41. +cd $WRKDIR
  42. +if [ $# -eq "0" ]
  43. +then
  44. +PROMPT_COMMAND='PS1="\[\033[0;31m\]CROSS CC:\[\033[0;32m\]$PS1";unset PROMPT_COMMAND' bash ; reset
  45. +else
  46. +$1
  47. +fi
  48. diff --git a/MakeIMAGE.sh b/MakeIMAGE.sh
  49. new file mode 100755
  50. index 0000000..02271d3
  51. --- /dev/null
  52. +++ b/MakeIMAGE.sh
  53. @@ -0,0 +1,91 @@
  54. +#!/bin/sh
  55. +
  56. +SAVE_LC=$LC_ALL
  57. +export LC_ALL=C
  58. +
  59. +BUILD=`cat ../GfA/board/GfA/Display001/BUILD`
  60. +IMAGEFILE=../Display001_Build_$BUILD-img
  61. +
  62. +echo "Image: $IMAGEFILE"
  63. +#-- build imagefile
  64. +dd if=/dev/zero ibs=1M count=1 > $IMAGEFILE
  65. +dd if=/dev/zero ibs=1M count=2048 | tr "\000" "\377" >> $IMAGEFILE
  66. +apt-get install codelite wxcrafter
  67. +#-- create partitions BOOT rootfs !!! don't change !!!!
  68. +fdisk $IMAGEFILE << EOF
  69. +o
  70. +n
  71. +p
  72. +
  73. +
  74. ++300M
  75. +n
  76. +p
  77. +
  78. +
  79. +
  80. +t
  81. +1
  82. +c
  83. +a
  84. +1
  85. +p
  86. +w
  87. +EOF
  88. +echo "============="
  89. +#-- map partitions
  90. +DRIVE1=/dev/mapper/`kpartx -s -l $IMAGEFILE | head -n 1 | awk '{print $1}'`
  91. +DRIVE2=/dev/mapper/`kpartx -s -l $IMAGEFILE | head -n 2 | tail -n 1 | awk '{print $1}'`
  92. +
  93. +echo ">>>>>>>>>>>>>>>>>>"
  94. +echo $DRIVE1
  95. +echo $DRIVE2
  96. +echo ">>>>>>>>>>>>>>>>>>"
  97. +
  98. +kpartx -asv $IMAGEFILE
  99. +#-- mount partitions
  100. +umount /tmp/boot
  101. +umount /tmp/rootfs
  102. +
  103. +rm -rf /tmp/boot
  104. +rm -rf /tmp/rootfs
  105. +
  106. +mkdir /tmp/boot
  107. +mkdir /tmp/rootfs
  108. +
  109. +dd if=/dev/zero of=${DRIVE1} bs=1M count=1
  110. +mkfs.vfat -F 32 -n "boot" ${DRIVE1}
  111. +mount ${DRIVE1} /tmp/boot
  112. +
  113. +du -h ${DRIVE1}
  114. +
  115. +cp ./output/images/*.dtb /tmp/boot
  116. +cp ./output/images/uImage /tmp/boot
  117. +cp ./output/images/MLO /tmp/boot
  118. +cp ./output/images/u-boot.img /tmp/boot
  119. +cp ./output/images/rootfs.tar.gz /tmp/boot
  120. +
  121. +ls -alh /tmp/boot
  122. +
  123. +dd if=/dev/zero of=${DRIVE2} bs=1M count=1
  124. +mkfs.ext3 -L "rootfs" ${DRIVE2}
  125. +mount ${DRIVE2} /tmp/rootfs
  126. +
  127. +du -h ${DRIVE2}
  128. +sleep 10
  129. +tar -C /tmp/rootfs --checkpoint --checkpoint-action=dot -xzf ./output/images/rootfs.tar.gz
  130. +echo ""
  131. +
  132. +sync
  133. +sync
  134. +umount ${DRIVE1}
  135. +umount ${DRIVE2}
  136. +
  137. +#-- unmap partitions
  138. +kpartx -dsv $IMAGEFILE
  139. +#-- packen des Imagefiles
  140. +rm $IMAGEFILE.zip
  141. +zip -j $IMAGEFILE.zip $IMAGEFILE
  142. +
  143. +export LC_ALL=$SAVE_LC
  144. +
  145. \ No newline at end of file
  146. diff --git a/MakeRootfsUpdate.sh b/MakeRootfsUpdate.sh
  147. new file mode 100755
  148. index 0000000..df6e200
  149. --- /dev/null
  150. +++ b/MakeRootfsUpdate.sh
  151. @@ -0,0 +1,62 @@
  152. +#!/bin/bash
  153. +WRKDIR=/tmp/XXXUpdateRootfs
  154. +BUILD=`cat ../GfA/board/GfA/Display001/BUILD`
  155. +UPDATE_BINARY=$WRKDIR/dest/UpdateRootfs.tar.Z
  156. +UPDATE_FILENAME="../UpdateDisplay001_$BUILD.sh"
  157. +UPDATE_IN_SCRIPT="UpdateRootfs.sh.in"
  158. +
  159. +rm -rf $WRKDIR
  160. +mkdir -p $WRKDIR/dest
  161. +
  162. +cp ./output/images/*.dtb $WRKDIR
  163. +cp ./output/images/uImage $WRKDIR
  164. +cp ./output/images/MLO $WRKDIR
  165. +cp ./output/images/u-boot.img $WRKDIR
  166. +cp ./output/images/rootfs.tar.gz $WRKDIR
  167. +
  168. +tar -C $WRKDIR --exclude=./dest -czvf $WRKDIR/dest/UpdateRootfs.tar.Z ./
  169. +
  170. +# Check for payload format option (default is binary).
  171. +binary=1
  172. +uuencode=0
  173. +
  174. +if [[ "$1" == '--binary' ]]; then
  175. + binary=1
  176. + uuencode=0
  177. + shift
  178. +fi
  179. +if [[ "$1" == '--uuencode' ]]; then
  180. + binary=0
  181. + uuencode=1
  182. + shift
  183. +fi
  184. +
  185. +if [[ ! -f $UPDATE_BINARY ]]; then
  186. + echo " UPDATE_BINARY $UPDATE_BINARY doesn't exist!"
  187. + echo "Usage: $0 [--binary | --uuencode]"
  188. + exit 1
  189. +fi
  190. +
  191. +
  192. +if [[ $binary -ne 0 ]]; then
  193. + # Append binary data.
  194. + sed \
  195. + -e 's/uuencode=./uuencode=0/' \
  196. + -e 's/binary=./binary=1/' \
  197. + $UPDATE_IN_SCRIPT > $UPDATE_FILENAME
  198. + echo "PAYLOAD:" >> $UPDATE_FILENAME
  199. +
  200. + cat $UPDATE_BINARY >> $UPDATE_FILENAME
  201. +fi
  202. +if [[ $uuencode -ne 0 ]]; then
  203. + # Append uuencoded data.
  204. + sed \
  205. + -e 's/uuencode=./uuencode=1/' \
  206. + -e 's/binary=./binary=0/' \
  207. + $UPDATE_IN_SCRIPT > $UPDATE_FILENAME
  208. + echo "PAYLOAD:" >> $UPDATE_FILENAME
  209. +
  210. + cat $UPDATE_BINARY | uuencode - >> $UPDATE_FILENAME
  211. +fi
  212. +
  213. +chmod a+x $UPDATE_FILENAME
  214. diff --git a/MapImage.sh b/MapImage.sh
  215. new file mode 100755
  216. index 0000000..4905205
  217. --- /dev/null
  218. +++ b/MapImage.sh
  219. @@ -0,0 +1,41 @@
  220. +#!/bin/sh
  221. +
  222. +SAVE_LC=$LC_ALL
  223. +export LC_ALL=C
  224. +
  225. +BUILD=`cat board/GfA/Display001/BUILD`
  226. +IMAGEFILE=../Display001_Build_$BUILD-img
  227. +echo ">>> $IMAGEFILE <<<"
  228. +#-- map partitions
  229. +DRIVE1=/dev/mapper/`kpartx -s -l $IMAGEFILE | head -n 1 | awk '{print $1}'`
  230. +DRIVE2=/dev/mapper/`kpartx -s -l $IMAGEFILE | head -n 2 | tail -n 1 | awk '{print $1}'`
  231. +
  232. +echo ">>>>>>>>>>>>>>>>>>"
  233. +echo $DRIVE1
  234. +echo $DRIVE2
  235. +echo ">>>>>>>>>>>>>>>>>>"
  236. +
  237. +kpartx -asv $IMAGEFILE
  238. +#-- mount partitions
  239. +umount /tmp/boot
  240. +umount /tmp/rootfs
  241. +
  242. +rm -rf /tmp/boot
  243. +rm -rf /tmp/rootfs
  244. +
  245. +mkdir /tmp/boot
  246. +mkdir /tmp/rootfs
  247. +
  248. +mount ${DRIVE1} /tmp/boot
  249. +mount ${DRIVE2} /tmp/rootfs
  250. +
  251. +bash
  252. +
  253. +umount ${DRIVE1}
  254. +umount ${DRIVE2}
  255. +
  256. +#-- unmap partitions
  257. +kpartx -dsv $IMAGEFILE
  258. +
  259. +export LC_ALL=$SAVE_LC
  260. +
  261. \ No newline at end of file
  262. diff --git a/UpdateRootfs.sh.in b/UpdateRootfs.sh.in
  263. new file mode 100644
  264. index 0000000..4706719
  265. --- /dev/null
  266. +++ b/UpdateRootfs.sh.in
  267. @@ -0,0 +1,77 @@
  268. +#!/bin/sh
  269. +
  270. +uuencode=0
  271. +binary=1
  272. +
  273. +##TAR_PARAMETERS="-C / --exclude=./opt --exclude=./etc/inittab -xzvf -"
  274. +TMP_PATH="/__GfA_Update"
  275. +TAR_PARAMETERS="-C $TMP_PATH -xzvf -"
  276. +
  277. +untar_payload ()
  278. +{
  279. +
  280. + echo "remove $TMP_PATH : "
  281. + rm -rf $TMP_PATH
  282. + echo ">> $? "
  283. + mkdir -p $TMP_PATH
  284. +
  285. + match=$(grep -n -m 1 '^PAYLOAD:$' $0 | cut -d ':' -f 1)
  286. + payload_start=$((match + 1))
  287. + if [[ $binary -ne 0 ]]; then
  288. + tail -n +$payload_start $0 | tar $TAR_PARAMETERS
  289. + fi
  290. + if [[ $uuencode -ne 0 ]]; then
  291. + tail -n +$payload_start $0 | uudecode | tar $TAR_PARAMETERS
  292. + fi
  293. +}
  294. +
  295. +## --- Kommandos zum Installieren
  296. +## -- get bootpartition
  297. +such="root=/dev/mmcblk1"
  298. +grep -q $such /proc/cmdline
  299. +if [ $? == 0 ]
  300. +then
  301. + bootpart="/dev/mmcblk1p1"
  302. +else
  303. + bootpart="/dev/mmcblk0p1"
  304. +fi
  305. +
  306. +umount /mnt
  307. +mount $bootpart /mnt
  308. +
  309. +## -- alte Firmwarebinaries löschen
  310. +rm /root/btm*.bin
  311. +
  312. +#--- Kernel MLO und Rootfs-Tarball entpacken
  313. +untar_payload
  314. +# ---
  315. +
  316. +rm /mnt/rootfs.tar.gz
  317. +cp $TMP_PATH/MLO /mnt
  318. +cp $TMP_PATH/u-boot.img /mnt
  319. +cp $TMP_PATH/uImage /mnt
  320. +cp $TMP_PATH/*.dtb /mnt
  321. +
  322. +#rootfs auspacken
  323. +tar -C / --exclude=./opt --exclude=./etc/inittab --exclude=./etc/network/interfaces -xzvf $TMP_PATH/rootfs.tar.gz
  324. +
  325. +echo "sync mmc be patient ...."
  326. +sync
  327. +sync
  328. +
  329. +if [ -e /etc/init.d/S98usb_g_ether ]
  330. +then
  331. + cp /etc/init.d/S98usb_g_ether /etc/init.d/M98usb_g_ether
  332. + rm /etc/init.d/S98usb_g_ether
  333. +fi
  334. +
  335. +#echo "Update Firmware"
  336. +#echo "."
  337. +#/root/spi_tivia /root/btm43_0107.bin >/dev/null
  338. +#echo ".."
  339. +#echo "Update Firmware Done"
  340. +#/root/gfa_spi -v
  341. +echo "Update Done, pls. reboot System"
  342. +umount /mnt
  343. +echo "."
  344. +exit 0
  345. diff --git a/board/beaglebone/patches/linux/0002-arm-Export-cache-flush-management-symbols-when-MULTI.patch b/board/beaglebone/patches/linux/0002-arm-Export-cache-flush-management-symbols-when-MULTI.patch
  346. new file mode 100644
  347. index 0000000..1ca1e70
  348. --- /dev/null
  349. +++ b/board/beaglebone/patches/linux/0002-arm-Export-cache-flush-management-symbols-when-MULTI.patch
  350. @@ -0,0 +1,34 @@
  351. +From 29885f2f3d700341d322274db6ad085e601c0994 Mon Sep 17 00:00:00 2001
  352. +From: Pantelis Antoniou <panto@antoniou-consulting.com>
  353. +Date: Fri, 4 Jan 2013 00:32:33 +0200
  354. +Subject: [PATCH 3/3] arm: Export cache flush management symbols when
  355. + !MULTI_CACHE
  356. +
  357. +When compiling a kernel without CONFIG_MULTI_CACHE enabled the
  358. +dma access functions end up not being exported. Fix it.
  359. +
  360. +Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
  361. +---
  362. + arch/arm/kernel/setup.c | 9 +++++++++
  363. + 1 file changed, 9 insertions(+)
  364. +
  365. +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
  366. +index da1d1aa..dcb678c 100644
  367. +--- a/arch/arm/kernel/setup.c
  368. ++++ b/arch/arm/kernel/setup.c
  369. +@@ -923,3 +923,12 @@ const struct seq_operations cpuinfo_op = {
  370. + .stop = c_stop,
  371. + .show = c_show
  372. + };
  373. ++
  374. ++/* export the cache management functions */
  375. ++#ifndef MULTI_CACHE
  376. ++
  377. ++EXPORT_SYMBOL(__glue(_CACHE,_dma_map_area));
  378. ++EXPORT_SYMBOL(__glue(_CACHE,_dma_unmap_area));
  379. ++EXPORT_SYMBOL(__glue(_CACHE,_dma_flush_range));
  380. ++
  381. ++#endif
  382. +--
  383. +1.7.10.4
  384. +
  385. diff --git a/package/gcc/4.9.1/100-uclibc-conf.patch b/package/gcc/4.9.1/100-uclibc-conf.patch
  386. new file mode 100644
  387. index 0000000..d56bf0a
  388. --- /dev/null
  389. +++ b/package/gcc/4.9.1/100-uclibc-conf.patch
  390. @@ -0,0 +1,15 @@
  391. +Index: gcc-4.8.0/contrib/regression/objs-gcc.sh
  392. +===================================================================
  393. +--- gcc-4.8.0.orig/contrib/regression/objs-gcc.sh 2009-04-09 17:00:19.000000000 +0200
  394. ++++ gcc-4.8.0/contrib/regression/objs-gcc.sh 2013-03-23 17:39:04.000000000 +0100
  395. +@@ -106,6 +106,10 @@
  396. + then
  397. + make all-gdb all-dejagnu all-ld || exit 1
  398. + make install-gdb install-dejagnu install-ld || exit 1
  399. ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
  400. ++ then
  401. ++ make all-gdb all-dejagnu all-ld || exit 1
  402. ++ make install-gdb install-dejagnu install-ld || exit 1
  403. + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
  404. + make bootstrap || exit 1
  405. + make install || exit 1
  406. diff --git a/package/gcc/4.9.1/301-missing-execinfo_h.patch b/package/gcc/4.9.1/301-missing-execinfo_h.patch
  407. new file mode 100644
  408. index 0000000..00efda2
  409. --- /dev/null
  410. +++ b/package/gcc/4.9.1/301-missing-execinfo_h.patch
  411. @@ -0,0 +1,13 @@
  412. +Index: gcc-4.8.0/boehm-gc/include/gc.h
  413. +===================================================================
  414. +--- gcc-4.8.0.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200
  415. ++++ gcc-4.8.0/boehm-gc/include/gc.h 2013-03-23 17:39:20.000000000 +0100
  416. +@@ -503,7 +503,7 @@
  417. + #if defined(__linux__) || defined(__GLIBC__)
  418. + # include <features.h>
  419. + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
  420. +- && !defined(__ia64__)
  421. ++ && !defined(__ia64__) && !defined(__UCLIBC__)
  422. + # ifndef GC_HAVE_BUILTIN_BACKTRACE
  423. + # define GC_HAVE_BUILTIN_BACKTRACE
  424. + # endif
  425. diff --git a/package/gcc/4.9.1/302-c99-snprintf.patch b/package/gcc/4.9.1/302-c99-snprintf.patch
  426. new file mode 100644
  427. index 0000000..cd4d2cc
  428. --- /dev/null
  429. +++ b/package/gcc/4.9.1/302-c99-snprintf.patch
  430. @@ -0,0 +1,13 @@
  431. +Index: gcc-4.8.0/libstdc++-v3/include/c_global/cstdio
  432. +===================================================================
  433. +--- gcc-4.8.0.orig/libstdc++-v3/include/c_global/cstdio 2013-02-03 18:54:05.000000000 +0100
  434. ++++ gcc-4.8.0/libstdc++-v3/include/c_global/cstdio 2013-03-23 17:39:32.000000000 +0100
  435. +@@ -138,7 +138,7 @@
  436. + using ::vsprintf;
  437. + } // namespace
  438. +
  439. +-#if _GLIBCXX_USE_C99
  440. ++#if _GLIBCXX_USE_C99 || defined __UCLIBC__
  441. +
  442. + #undef snprintf
  443. + #undef vfscanf
  444. diff --git a/package/gcc/4.9.1/810-arm-softfloat-libgcc.patch b/package/gcc/4.9.1/810-arm-softfloat-libgcc.patch
  445. new file mode 100644
  446. index 0000000..c8cb377
  447. --- /dev/null
  448. +++ b/package/gcc/4.9.1/810-arm-softfloat-libgcc.patch
  449. @@ -0,0 +1,30 @@
  450. +Index: gcc-4.8.0/gcc/config/arm/linux-elf.h
  451. +===================================================================
  452. +--- gcc-4.8.0.orig/gcc/config/arm/linux-elf.h 2013-01-10 21:38:27.000000000 +0100
  453. ++++ gcc-4.8.0/gcc/config/arm/linux-elf.h 2013-03-23 17:40:00.000000000 +0100
  454. +@@ -55,7 +55,7 @@
  455. + %{shared:-lc} \
  456. + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
  457. +
  458. +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
  459. ++#define LIBGCC_SPEC "-lgcc"
  460. +
  461. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  462. +
  463. +Index: gcc-4.8.0/libgcc/config/arm/t-linux
  464. +===================================================================
  465. +--- gcc-4.8.0.orig/libgcc/config/arm/t-linux 2012-03-22 16:14:46.000000000 +0100
  466. ++++ gcc-4.8.0/libgcc/config/arm/t-linux 2013-03-23 17:40:54.000000000 +0100
  467. +@@ -1,6 +1,11 @@
  468. + LIB1ASMSRC = arm/lib1funcs.S
  469. + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
  470. +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
  471. ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
  472. ++ _arm_addsubdf3 _arm_addsubsf3 \
  473. ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
  474. ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
  475. ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
  476. ++ _arm_fixsfsi _arm_fixunssfsi
  477. +
  478. + # Just for these, we omit the frame pointer since it makes such a big
  479. + # difference.
  480. diff --git a/package/gcc/4.9.1/830-arm_unbreak_armv4t.patch b/package/gcc/4.9.1/830-arm_unbreak_armv4t.patch
  481. new file mode 100644
  482. index 0000000..37f8f2a
  483. --- /dev/null
  484. +++ b/package/gcc/4.9.1/830-arm_unbreak_armv4t.patch
  485. @@ -0,0 +1,13 @@
  486. +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
  487. +
  488. +--- a/gcc/config/arm/linux-eabi.h
  489. ++++ b/gcc/config/arm/linux-eabi.h
  490. +@@ -45,7 +45,7 @@
  491. + The ARM10TDMI core is the default for armv5t, so set
  492. + SUBTARGET_CPU_DEFAULT to achieve this. */
  493. + #undef SUBTARGET_CPU_DEFAULT
  494. +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
  495. ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
  496. +
  497. + /* TARGET_BIG_ENDIAN_DEFAULT is set in
  498. + config.gcc for big endian configurations. */
  499. diff --git a/package/gcc/4.9.1/840-microblaze-enable-dwarf-eh-support.patch b/package/gcc/4.9.1/840-microblaze-enable-dwarf-eh-support.patch
  500. new file mode 100644
  501. index 0000000..e116e2b
  502. --- /dev/null
  503. +++ b/package/gcc/4.9.1/840-microblaze-enable-dwarf-eh-support.patch
  504. @@ -0,0 +1,169 @@
  505. +Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc
  506. +
  507. +From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001
  508. +From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
  509. +Date: Mon, 18 Jun 2012 20:18:13 +0200
  510. +Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support.
  511. +
  512. +Changelog
  513. +
  514. +2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
  515. + David Holsgrove <david.holsgrove@xilinx.com>
  516. +
  517. + * common/config/microblaze/microblaze-common.c: Remove
  518. + TARGET_EXCEPT_UNWIND_INFO definition.
  519. + * config/microblaze/microblaze-protos.h: Add
  520. + microblaze_eh_return prototype.
  521. + * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
  522. + microblaze_expand_epilogue, microblaze_return_addr): Handle
  523. + calls_eh_return
  524. + (microblaze_eh_return): New function.
  525. + * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
  526. + EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
  527. + ASM_PREFERRED_EH_DATA_FORMAT
  528. + * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
  529. +
  530. +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
  531. +Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
  532. +---
  533. + gcc/common/config/microblaze/microblaze-common.c | 3 ---
  534. + gcc/config/microblaze/microblaze-protos.h | 1 +
  535. + gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++----
  536. + gcc/config/microblaze/microblaze.h | 15 ++++++++++++
  537. + gcc/config/microblaze/microblaze.md | 11 +++++++++
  538. + 5 files changed, 52 insertions(+), 7 deletions(-)
  539. +
  540. +diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
  541. +index 5835acc..85e6a53 100644
  542. +--- a/gcc/common/config/microblaze/microblaze-common.c
  543. ++++ b/gcc/common/config/microblaze/microblaze-common.c
  544. +@@ -39,7 +39,4 @@ static const struct default_options microblaze_option_optimization_table[] =
  545. + #undef TARGET_OPTION_OPTIMIZATION_TABLE
  546. + #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
  547. +
  548. +-#undef TARGET_EXCEPT_UNWIND_INFO
  549. +-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
  550. +-
  551. + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
  552. +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
  553. +index c30ec72..260f4e4 100644
  554. +--- a/gcc/config/microblaze/microblaze-protos.h
  555. ++++ b/gcc/config/microblaze/microblaze-protos.h
  556. +@@ -56,6 +56,7 @@ extern bool microblaze_tls_referenced_p (rtx);
  557. + extern int symbol_mentioned_p (rtx);
  558. + extern int label_mentioned_p (rtx);
  559. + extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
  560. ++extern void microblaze_eh_return (rtx op0);
  561. + #endif /* RTX_CODE */
  562. +
  563. + /* Declare functions in microblaze-c.c. */
  564. +diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
  565. +index fe61fce..15166d3 100644
  566. +--- a/gcc/config/microblaze/microblaze.c
  567. ++++ b/gcc/config/microblaze/microblaze.c
  568. +@@ -1999,6 +1999,11 @@ microblaze_must_save_register (int regno)
  569. + if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
  570. + return 1;
  571. +
  572. ++ if (crtl->calls_eh_return
  573. ++ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
  574. ++ return 1;
  575. ++ }
  576. ++
  577. + if (!crtl->is_leaf)
  578. + {
  579. + if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
  580. +@@ -2026,6 +2031,13 @@ microblaze_must_save_register (int regno)
  581. + return 1;
  582. + }
  583. +
  584. ++ if (crtl->calls_eh_return
  585. ++ && (regno == EH_RETURN_DATA_REGNO (0)
  586. ++ || regno == EH_RETURN_DATA_REGNO (1)))
  587. ++ {
  588. ++ return 1;
  589. ++ }
  590. ++
  591. + return 0;
  592. + }
  593. +
  594. +@@ -3131,6 +3143,12 @@ microblaze_expand_epilogue (void)
  595. + emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
  596. + }
  597. +
  598. ++ if (crtl->calls_eh_return)
  599. ++ emit_insn (gen_addsi3 (stack_pointer_rtx,
  600. ++ stack_pointer_rtx,
  601. ++ gen_rtx_raw_REG (SImode,
  602. ++ MB_EH_STACKADJ_REGNUM)));
  603. ++
  604. + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
  605. + MB_ABI_SUB_RETURN_ADDR_REGNUM)));
  606. + }
  607. +@@ -3427,10 +3445,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
  608. + if (count != 0)
  609. + return NULL_RTX;
  610. +
  611. +- return gen_rtx_PLUS (Pmode,
  612. +- get_hard_reg_initial_val (Pmode,
  613. +- MB_ABI_SUB_RETURN_ADDR_REGNUM),
  614. +- GEN_INT (8));
  615. ++ return get_hard_reg_initial_val (Pmode,
  616. ++ MB_ABI_SUB_RETURN_ADDR_REGNUM);
  617. ++}
  618. ++
  619. ++void microblaze_eh_return (rtx op0)
  620. ++{
  621. ++ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
  622. + }
  623. +
  624. + /* Queue an .ident string in the queue of top-level asm statements.
  625. +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
  626. +index 4072283..5e9f49c 100644
  627. +--- a/gcc/config/microblaze/microblaze.h
  628. ++++ b/gcc/config/microblaze/microblaze.h
  629. +@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
  630. + #define INCOMING_RETURN_ADDR_RTX \
  631. + gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
  632. +
  633. ++/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
  634. ++#define RETURN_ADDR_OFFSET (8)
  635. ++
  636. ++/* Describe how we implement __builtin_eh_return. */
  637. ++#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
  638. ++
  639. ++#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
  640. ++#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
  641. ++
  642. ++/* Select a format to encode pointers in exception handling data. CODE
  643. ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
  644. ++ true if the symbol may be affected by dynamic relocations. */
  645. ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
  646. ++ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
  647. ++
  648. + /* Use DWARF 2 debugging information by default. */
  649. + #define DWARF2_DEBUGGING_INFO
  650. + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  651. +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
  652. +index ed6131a..dc2405f 100644
  653. +--- a/gcc/config/microblaze/microblaze.md
  654. ++++ b/gcc/config/microblaze/microblaze.md
  655. +@@ -2327,4 +2327,15 @@
  656. + (set_attr "mode" "SI")
  657. + (set_attr "length" "4")])
  658. +
  659. ++; This is used in compiling the unwind routines.
  660. ++(define_expand "eh_return"
  661. ++ [(use (match_operand 0 "general_operand" ""))]
  662. ++ ""
  663. ++ "
  664. ++{
  665. ++ microblaze_eh_return(operands[0]);
  666. ++ DONE;
  667. ++}")
  668. ++
  669. + (include "sync.md")
  670. ++
  671. +--
  672. +1.8.3.2
  673. +
  674. diff --git a/package/gcc/4.9.1/841-PR60102.patch b/package/gcc/4.9.1/841-PR60102.patch
  675. new file mode 100644
  676. index 0000000..e34695d
  677. --- /dev/null
  678. +++ b/package/gcc/4.9.1/841-PR60102.patch
  679. @@ -0,0 +1,388 @@
  680. +From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60102
  681. +Target: 4.9.2
  682. +
  683. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  684. +
  685. +diff -Nura gcc-4.9.1.orig/gcc/config/rs6000/rs6000.c gcc-4.9.1/gcc/config/rs6000/rs6000.c
  686. +--- gcc-4.9.1.orig/gcc/config/rs6000/rs6000.c 2014-08-05 14:53:37.294498582 -0300
  687. ++++ gcc-4.9.1/gcc/config/rs6000/rs6000.c 2014-08-05 14:58:33.972555735 -0300
  688. +@@ -1221,7 +1221,12 @@
  689. + /* Soft frame pointer. */
  690. + "sfp",
  691. + /* HTM SPR registers. */
  692. +- "tfhar", "tfiar", "texasr"
  693. ++ "tfhar", "tfiar", "texasr",
  694. ++ /* SPE High registers. */
  695. ++ "0", "1", "2", "3", "4", "5", "6", "7",
  696. ++ "8", "9", "10", "11", "12", "13", "14", "15",
  697. ++ "16", "17", "18", "19", "20", "21", "22", "23",
  698. ++ "24", "25", "26", "27", "28", "29", "30", "31"
  699. + };
  700. +
  701. + #ifdef TARGET_REGNAMES
  702. +@@ -1249,7 +1254,12 @@
  703. + /* Soft frame pointer. */
  704. + "sfp",
  705. + /* HTM SPR registers. */
  706. +- "tfhar", "tfiar", "texasr"
  707. ++ "tfhar", "tfiar", "texasr",
  708. ++ /* SPE High registers. */
  709. ++ "%rh0", "%rh1", "%rh2", "%rh3", "%rh4", "%rh5", "%rh6", "%rh7",
  710. ++ "%rh8", "%rh9", "%rh10", "%r11", "%rh12", "%rh13", "%rh14", "%rh15",
  711. ++ "%rh16", "%rh17", "%rh18", "%rh19", "%rh20", "%rh21", "%rh22", "%rh23",
  712. ++ "%rh24", "%rh25", "%rh26", "%rh27", "%rh28", "%rh29", "%rh30", "%rh31"
  713. + };
  714. + #endif
  715. +
  716. +@@ -31074,13 +31084,13 @@
  717. + {
  718. + if (BYTES_BIG_ENDIAN)
  719. + {
  720. +- parts[2 * i] = gen_rtx_REG (SImode, regno + 1200);
  721. ++ parts[2 * i] = gen_rtx_REG (SImode, regno + FIRST_SPE_HIGH_REGNO);
  722. + parts[2 * i + 1] = gen_rtx_REG (SImode, regno);
  723. + }
  724. + else
  725. + {
  726. + parts[2 * i] = gen_rtx_REG (SImode, regno);
  727. +- parts[2 * i + 1] = gen_rtx_REG (SImode, regno + 1200);
  728. ++ parts[2 * i + 1] = gen_rtx_REG (SImode, regno + FIRST_SPE_HIGH_REGNO);
  729. + }
  730. + }
  731. +
  732. +@@ -31100,11 +31110,11 @@
  733. + rtx mem = gen_rtx_MEM (BLKmode, addr);
  734. + rtx value = gen_int_mode (4, mode);
  735. +
  736. +- for (i = 1201; i < 1232; i++)
  737. ++ for (i = FIRST_SPE_HIGH_REGNO; i < LAST_SPE_HIGH_REGNO+1; i++)
  738. + {
  739. +- int column = DWARF_REG_TO_UNWIND_COLUMN (i);
  740. +- HOST_WIDE_INT offset
  741. +- = DWARF_FRAME_REGNUM (column) * GET_MODE_SIZE (mode);
  742. ++ int column = DWARF_REG_TO_UNWIND_COLUMN
  743. ++ (DWARF2_FRAME_REG_OUT (DWARF_FRAME_REGNUM (i), true));
  744. ++ HOST_WIDE_INT offset = column * GET_MODE_SIZE (mode);
  745. +
  746. + emit_move_insn (adjust_address (mem, mode, offset), value);
  747. + }
  748. +@@ -31123,9 +31133,9 @@
  749. +
  750. + for (i = FIRST_ALTIVEC_REGNO; i < LAST_ALTIVEC_REGNO+1; i++)
  751. + {
  752. +- int column = DWARF_REG_TO_UNWIND_COLUMN (i);
  753. +- HOST_WIDE_INT offset
  754. +- = DWARF_FRAME_REGNUM (column) * GET_MODE_SIZE (mode);
  755. ++ int column = DWARF_REG_TO_UNWIND_COLUMN
  756. ++ (DWARF2_FRAME_REG_OUT (DWARF_FRAME_REGNUM (i), true));
  757. ++ HOST_WIDE_INT offset = column * GET_MODE_SIZE (mode);
  758. +
  759. + emit_move_insn (adjust_address (mem, mode, offset), value);
  760. + }
  761. +@@ -31157,9 +31167,8 @@
  762. + return 99;
  763. + if (regno == SPEFSCR_REGNO)
  764. + return 612;
  765. +- /* SPE high reg number. We get these values of regno from
  766. +- rs6000_dwarf_register_span. */
  767. +- gcc_assert (regno >= 1200 && regno < 1232);
  768. ++ if (SPE_HIGH_REGNO_P (regno))
  769. ++ return regno - FIRST_SPE_HIGH_REGNO + 1200;
  770. + return regno;
  771. + }
  772. +
  773. +diff -Nura gcc-4.9.1.orig/gcc/config/rs6000/rs6000.h gcc-4.9.1/gcc/config/rs6000/rs6000.h
  774. +--- gcc-4.9.1.orig/gcc/config/rs6000/rs6000.h 2014-08-05 14:53:37.291498480 -0300
  775. ++++ gcc-4.9.1/gcc/config/rs6000/rs6000.h 2014-08-05 14:58:33.974555802 -0300
  776. +@@ -930,35 +930,36 @@
  777. +
  778. + The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS. */
  779. +
  780. +-#define FIRST_PSEUDO_REGISTER 117
  781. ++#define FIRST_PSEUDO_REGISTER 149
  782. +
  783. + /* This must be included for pre gcc 3.0 glibc compatibility. */
  784. + #define PRE_GCC3_DWARF_FRAME_REGISTERS 77
  785. +
  786. +-/* Add 32 dwarf columns for synthetic SPE registers. */
  787. +-#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 4) + 32)
  788. ++/* True if register is an SPE High register. */
  789. ++#define SPE_HIGH_REGNO_P(N) \
  790. ++ ((N) >= FIRST_SPE_HIGH_REGNO && (N) <= LAST_SPE_HIGH_REGNO)
  791. ++
  792. ++/* SPE high registers added as hard regs.
  793. ++ The sfp register and 3 HTM registers
  794. ++ aren't included in DWARF_FRAME_REGISTERS. */
  795. ++#define DWARF_FRAME_REGISTERS (FIRST_PSEUDO_REGISTER - 4)
  796. +
  797. + /* The SPE has an additional 32 synthetic registers, with DWARF debug
  798. + info numbering for these registers starting at 1200. While eh_frame
  799. + register numbering need not be the same as the debug info numbering,
  800. +- we choose to number these regs for eh_frame at 1200 too. This allows
  801. +- future versions of the rs6000 backend to add hard registers and
  802. +- continue to use the gcc hard register numbering for eh_frame. If the
  803. +- extra SPE registers in eh_frame were numbered starting from the
  804. +- current value of FIRST_PSEUDO_REGISTER, then if FIRST_PSEUDO_REGISTER
  805. +- changed we'd need to introduce a mapping in DWARF_FRAME_REGNUM to
  806. +- avoid invalidating older SPE eh_frame info.
  807. ++ we choose to number these regs for eh_frame at 1200 too.
  808. +
  809. + We must map them here to avoid huge unwinder tables mostly consisting
  810. + of unused space. */
  811. + #define DWARF_REG_TO_UNWIND_COLUMN(r) \
  812. +- ((r) > 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
  813. ++ ((r) >= 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
  814. +
  815. + /* Use standard DWARF numbering for DWARF debugging information. */
  816. + #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
  817. +
  818. + /* Use gcc hard register numbering for eh_frame. */
  819. +-#define DWARF_FRAME_REGNUM(REGNO) (REGNO)
  820. ++#define DWARF_FRAME_REGNUM(REGNO) \
  821. ++ (SPE_HIGH_REGNO_P (REGNO) ? ((REGNO) - FIRST_SPE_HIGH_REGNO + 1200) : (REGNO))
  822. +
  823. + /* Map register numbers held in the call frame info that gcc has
  824. + collected using DWARF_FRAME_REGNUM to those that should be output in
  825. +@@ -992,7 +993,10 @@
  826. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  827. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  828. + 1, 1 \
  829. +- , 1, 1, 1, 1, 1, 1 \
  830. ++ , 1, 1, 1, 1, 1, 1, \
  831. ++ /* SPE High registers. */ \
  832. ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
  833. ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \
  834. + }
  835. +
  836. + /* 1 for registers not available across function calls.
  837. +@@ -1012,7 +1016,10 @@
  838. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  839. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  840. + 1, 1 \
  841. +- , 1, 1, 1, 1, 1, 1 \
  842. ++ , 1, 1, 1, 1, 1, 1, \
  843. ++ /* SPE High registers. */ \
  844. ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
  845. ++ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \
  846. + }
  847. +
  848. + /* Like `CALL_USED_REGISTERS' except this macro doesn't require that
  849. +@@ -1031,7 +1038,10 @@
  850. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  851. + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  852. + 0, 0 \
  853. +- , 0, 0, 0, 0, 0, 0 \
  854. ++ , 0, 0, 0, 0, 0, 0, \
  855. ++ /* SPE High registers. */ \
  856. ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  857. ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
  858. + }
  859. +
  860. + #define TOTAL_ALTIVEC_REGS (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1)
  861. +@@ -1114,7 +1124,10 @@
  862. + 96, 95, 94, 93, 92, 91, \
  863. + 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, \
  864. + 109, 110, \
  865. +- 111, 112, 113, 114, 115, 116 \
  866. ++ 111, 112, 113, 114, 115, 116, \
  867. ++ 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, \
  868. ++ 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, \
  869. ++ 141, 142, 143, 144, 145, 146, 147, 148 \
  870. + }
  871. +
  872. + /* True if register is floating-point. */
  873. +@@ -1349,6 +1362,7 @@
  874. + CR_REGS,
  875. + NON_FLOAT_REGS,
  876. + CA_REGS,
  877. ++ SPE_HIGH_REGS,
  878. + ALL_REGS,
  879. + LIM_REG_CLASSES
  880. + };
  881. +@@ -1380,6 +1394,7 @@
  882. + "CR_REGS", \
  883. + "NON_FLOAT_REGS", \
  884. + "CA_REGS", \
  885. ++ "SPE_HIGH_REGS", \
  886. + "ALL_REGS" \
  887. + }
  888. +
  889. +@@ -1387,30 +1402,54 @@
  890. + This is an initializer for a vector of HARD_REG_SET
  891. + of length N_REG_CLASSES. */
  892. +
  893. +-#define REG_CLASS_CONTENTS \
  894. +-{ \
  895. +- { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \
  896. +- { 0xfffffffe, 0x00000000, 0x00000008, 0x00020000 }, /* BASE_REGS */ \
  897. +- { 0xffffffff, 0x00000000, 0x00000008, 0x00020000 }, /* GENERAL_REGS */ \
  898. +- { 0x00000000, 0xffffffff, 0x00000000, 0x00000000 }, /* FLOAT_REGS */ \
  899. +- { 0x00000000, 0x00000000, 0xffffe000, 0x00001fff }, /* ALTIVEC_REGS */ \
  900. +- { 0x00000000, 0xffffffff, 0xffffe000, 0x00001fff }, /* VSX_REGS */ \
  901. +- { 0x00000000, 0x00000000, 0x00000000, 0x00002000 }, /* VRSAVE_REGS */ \
  902. +- { 0x00000000, 0x00000000, 0x00000000, 0x00004000 }, /* VSCR_REGS */ \
  903. +- { 0x00000000, 0x00000000, 0x00000000, 0x00008000 }, /* SPE_ACC_REGS */ \
  904. +- { 0x00000000, 0x00000000, 0x00000000, 0x00010000 }, /* SPEFSCR_REGS */ \
  905. +- { 0x00000000, 0x00000000, 0x00000000, 0x00040000 }, /* SPR_REGS */ \
  906. +- { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000 }, /* NON_SPECIAL_REGS */ \
  907. +- { 0x00000000, 0x00000000, 0x00000002, 0x00000000 }, /* LINK_REGS */ \
  908. +- { 0x00000000, 0x00000000, 0x00000004, 0x00000000 }, /* CTR_REGS */ \
  909. +- { 0x00000000, 0x00000000, 0x00000006, 0x00000000 }, /* LINK_OR_CTR_REGS */ \
  910. +- { 0x00000000, 0x00000000, 0x00000006, 0x00002000 }, /* SPECIAL_REGS */ \
  911. +- { 0xffffffff, 0x00000000, 0x0000000e, 0x00022000 }, /* SPEC_OR_GEN_REGS */ \
  912. +- { 0x00000000, 0x00000000, 0x00000010, 0x00000000 }, /* CR0_REGS */ \
  913. +- { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */ \
  914. +- { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000 }, /* NON_FLOAT_REGS */ \
  915. +- { 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* CA_REGS */ \
  916. +- { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0007ffff } /* ALL_REGS */ \
  917. ++#define REG_CLASS_CONTENTS \
  918. ++{ \
  919. ++ /* NO_REGS. */ \
  920. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, \
  921. ++ /* BASE_REGS. */ \
  922. ++ { 0xfffffffe, 0x00000000, 0x00000008, 0x00020000, 0x00000000 }, \
  923. ++ /* GENERAL_REGS. */ \
  924. ++ { 0xffffffff, 0x00000000, 0x00000008, 0x00020000, 0x00000000 }, \
  925. ++ /* FLOAT_REGS. */ \
  926. ++ { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000 }, \
  927. ++ /* ALTIVEC_REGS. */ \
  928. ++ { 0x00000000, 0x00000000, 0xffffe000, 0x00001fff, 0x00000000 }, \
  929. ++ /* VSX_REGS. */ \
  930. ++ { 0x00000000, 0xffffffff, 0xffffe000, 0x00001fff, 0x00000000 }, \
  931. ++ /* VRSAVE_REGS. */ \
  932. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00002000, 0x00000000 }, \
  933. ++ /* VSCR_REGS. */ \
  934. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000 }, \
  935. ++ /* SPE_ACC_REGS. */ \
  936. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000 }, \
  937. ++ /* SPEFSCR_REGS. */ \
  938. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000 }, \
  939. ++ /* SPR_REGS. */ \
  940. ++ { 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0x00000000 }, \
  941. ++ /* NON_SPECIAL_REGS. */ \
  942. ++ { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000, 0x00000000 }, \
  943. ++ /* LINK_REGS. */ \
  944. ++ { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000 }, \
  945. ++ /* CTR_REGS. */ \
  946. ++ { 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000 }, \
  947. ++ /* LINK_OR_CTR_REGS. */ \
  948. ++ { 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000 }, \
  949. ++ /* SPECIAL_REGS. */ \
  950. ++ { 0x00000000, 0x00000000, 0x00000006, 0x00002000, 0x00000000 }, \
  951. ++ /* SPEC_OR_GEN_REGS. */ \
  952. ++ { 0xffffffff, 0x00000000, 0x0000000e, 0x00022000, 0x00000000 }, \
  953. ++ /* CR0_REGS. */ \
  954. ++ { 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0x00000000 }, \
  955. ++ /* CR_REGS. */ \
  956. ++ { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000, 0x00000000 }, \
  957. ++ /* NON_FLOAT_REGS. */ \
  958. ++ { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000, 0x00000000 }, \
  959. ++ /* CA_REGS. */ \
  960. ++ { 0x00000000, 0x00000000, 0x00001000, 0x00000000, 0x00000000 }, \
  961. ++ /* SPE_HIGH_REGS. */ \
  962. ++ { 0x00000000, 0x00000000, 0x00000000, 0xffe00000, 0x001fffff }, \
  963. ++ /* ALL_REGS. */ \
  964. ++ { 0xffffffff, 0xffffffff, 0xfffffffe, 0xffe7ffff, 0x001fffff } \
  965. + }
  966. +
  967. + /* The same information, inverted:
  968. +@@ -2349,6 +2388,39 @@
  969. + &rs6000_reg_names[114][0], /* tfhar */ \
  970. + &rs6000_reg_names[115][0], /* tfiar */ \
  971. + &rs6000_reg_names[116][0], /* texasr */ \
  972. ++ \
  973. ++ &rs6000_reg_names[117][0], /* SPE rh0. */ \
  974. ++ &rs6000_reg_names[118][0], /* SPE rh1. */ \
  975. ++ &rs6000_reg_names[119][0], /* SPE rh2. */ \
  976. ++ &rs6000_reg_names[120][0], /* SPE rh3. */ \
  977. ++ &rs6000_reg_names[121][0], /* SPE rh4. */ \
  978. ++ &rs6000_reg_names[122][0], /* SPE rh5. */ \
  979. ++ &rs6000_reg_names[123][0], /* SPE rh6. */ \
  980. ++ &rs6000_reg_names[124][0], /* SPE rh7. */ \
  981. ++ &rs6000_reg_names[125][0], /* SPE rh8. */ \
  982. ++ &rs6000_reg_names[126][0], /* SPE rh9. */ \
  983. ++ &rs6000_reg_names[127][0], /* SPE rh10. */ \
  984. ++ &rs6000_reg_names[128][0], /* SPE rh11. */ \
  985. ++ &rs6000_reg_names[129][0], /* SPE rh12. */ \
  986. ++ &rs6000_reg_names[130][0], /* SPE rh13. */ \
  987. ++ &rs6000_reg_names[131][0], /* SPE rh14. */ \
  988. ++ &rs6000_reg_names[132][0], /* SPE rh15. */ \
  989. ++ &rs6000_reg_names[133][0], /* SPE rh16. */ \
  990. ++ &rs6000_reg_names[134][0], /* SPE rh17. */ \
  991. ++ &rs6000_reg_names[135][0], /* SPE rh18. */ \
  992. ++ &rs6000_reg_names[136][0], /* SPE rh19. */ \
  993. ++ &rs6000_reg_names[137][0], /* SPE rh20. */ \
  994. ++ &rs6000_reg_names[138][0], /* SPE rh21. */ \
  995. ++ &rs6000_reg_names[139][0], /* SPE rh22. */ \
  996. ++ &rs6000_reg_names[140][0], /* SPE rh22. */ \
  997. ++ &rs6000_reg_names[141][0], /* SPE rh24. */ \
  998. ++ &rs6000_reg_names[142][0], /* SPE rh25. */ \
  999. ++ &rs6000_reg_names[143][0], /* SPE rh26. */ \
  1000. ++ &rs6000_reg_names[144][0], /* SPE rh27. */ \
  1001. ++ &rs6000_reg_names[145][0], /* SPE rh28. */ \
  1002. ++ &rs6000_reg_names[146][0], /* SPE rh29. */ \
  1003. ++ &rs6000_reg_names[147][0], /* SPE rh30. */ \
  1004. ++ &rs6000_reg_names[148][0], /* SPE rh31. */ \
  1005. + }
  1006. +
  1007. + /* Table of additional register names to use in user input. */
  1008. +@@ -2404,7 +2476,17 @@
  1009. + {"vs56", 101},{"vs57", 102},{"vs58", 103},{"vs59", 104}, \
  1010. + {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108}, \
  1011. + /* Transactional Memory Facility (HTM) Registers. */ \
  1012. +- {"tfhar", 114}, {"tfiar", 115}, {"texasr", 116} }
  1013. ++ {"tfhar", 114}, {"tfiar", 115}, {"texasr", 116}, \
  1014. ++ /* SPE high registers. */ \
  1015. ++ {"rh0", 117}, {"rh1", 118}, {"rh2", 119}, {"rh3", 120}, \
  1016. ++ {"rh4", 121}, {"rh5", 122}, {"rh6", 123}, {"rh7", 124}, \
  1017. ++ {"rh8", 125}, {"rh9", 126}, {"rh10", 127}, {"rh11", 128}, \
  1018. ++ {"rh12", 129}, {"rh13", 130}, {"rh14", 131}, {"rh15", 132}, \
  1019. ++ {"rh16", 133}, {"rh17", 134}, {"rh18", 135}, {"rh19", 136}, \
  1020. ++ {"rh20", 137}, {"rh21", 138}, {"rh22", 139}, {"rh23", 140}, \
  1021. ++ {"rh24", 141}, {"rh25", 142}, {"rh26", 143}, {"rh27", 144}, \
  1022. ++ {"rh28", 145}, {"rh29", 146}, {"rh30", 147}, {"rh31", 148}, \
  1023. ++}
  1024. +
  1025. + /* This is how to output an element of a case-vector that is relative. */
  1026. +
  1027. +diff -Nura gcc-4.9.1.orig/gcc/config/rs6000/rs6000.md gcc-4.9.1/gcc/config/rs6000/rs6000.md
  1028. +--- gcc-4.9.1.orig/gcc/config/rs6000/rs6000.md 2014-08-05 14:53:37.292498514 -0300
  1029. ++++ gcc-4.9.1/gcc/config/rs6000/rs6000.md 2014-08-05 14:58:33.977555904 -0300
  1030. +@@ -56,6 +56,8 @@
  1031. + (TFHAR_REGNO 114)
  1032. + (TFIAR_REGNO 115)
  1033. + (TEXASR_REGNO 116)
  1034. ++ (FIRST_SPE_HIGH_REGNO 117)
  1035. ++ (LAST_SPE_HIGH_REGNO 148)
  1036. + ])
  1037. +
  1038. + ;;
  1039. +diff -Nura gcc-4.9.1.orig/gcc/testsuite/gcc.target/powerpc/pr60102.c gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/pr60102.c
  1040. +--- gcc-4.9.1.orig/gcc/testsuite/gcc.target/powerpc/pr60102.c 1969-12-31 21:00:00.000000000 -0300
  1041. ++++ gcc-4.9.1/gcc/testsuite/gcc.target/powerpc/pr60102.c 2014-08-05 14:58:13.847873524 -0300
  1042. +@@ -0,0 +1,11 @@
  1043. ++/* { dg-do compile } */
  1044. ++/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
  1045. ++/* { dg-options "-mcpu=8548 -mspe -mabi=spe -g -mfloat-gprs=double" } */
  1046. ++
  1047. ++double
  1048. ++pr60102 (double x, int m)
  1049. ++{
  1050. ++ double y;
  1051. ++ y = m % 2 ? x : 1;
  1052. ++ return y;
  1053. ++}
  1054. +diff -Nura gcc-4.9.1.orig/libgcc/config/rs6000/linux-unwind.h gcc-4.9.1/libgcc/config/rs6000/linux-unwind.h
  1055. +--- gcc-4.9.1.orig/libgcc/config/rs6000/linux-unwind.h 2014-08-05 14:53:48.900892029 -0300
  1056. ++++ gcc-4.9.1/libgcc/config/rs6000/linux-unwind.h 2014-08-05 14:58:33.979555972 -0300
  1057. +@@ -274,8 +274,8 @@
  1058. + #ifdef __SPE__
  1059. + for (i = 14; i < 32; i++)
  1060. + {
  1061. +- fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
  1062. +- fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset
  1063. ++ fs->regs.reg[i + FIRST_SPE_HIGH_REGNO - 4].how = REG_SAVED_OFFSET;
  1064. ++ fs->regs.reg[i + FIRST_SPE_HIGH_REGNO - 4].loc.offset
  1065. + = (long) &regs->vregs - new_cfa + 4 * i;
  1066. + }
  1067. + #endif
  1068. diff --git a/package/gcc/4.9.1/900-musl-support.patch b/package/gcc/4.9.1/900-musl-support.patch
  1069. new file mode 100644
  1070. index 0000000..5b3dfa5
  1071. --- /dev/null
  1072. +++ b/package/gcc/4.9.1/900-musl-support.patch
  1073. @@ -0,0 +1,696 @@
  1074. +Add musl support to gcc
  1075. +
  1076. +This patch comes from the musl-cross project at
  1077. +https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version:
  1078. +
  1079. + * the config.sub modifications have been removed, because Buildroot
  1080. + already overwrites all config.sub with a more recent config.sub
  1081. + that has musl support.
  1082. +
  1083. + * change to ensure that a dummy dynamic linker path
  1084. + MUSL_DYNAMIC_LINKER<foo> is defined for all architectures,
  1085. + otherwise building gcc for architectures not supported by musl was
  1086. + causing build failure. Bug reported upstream at
  1087. + https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on.
  1088. +
  1089. +[Gustavo: remove upstream applied gcc/config/sh/sh.c chunk for 4.9.1]
  1090. +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  1091. +---
  1092. +
  1093. +Index: b/fixincludes/mkfixinc.sh
  1094. +===================================================================
  1095. +--- a/fixincludes/mkfixinc.sh
  1096. ++++ b/fixincludes/mkfixinc.sh
  1097. +@@ -19,7 +19,8 @@
  1098. + powerpc-*-eabi* | \
  1099. + powerpc-*-rtems* | \
  1100. + powerpcle-*-eabisim* | \
  1101. +- powerpcle-*-eabi* )
  1102. ++ powerpcle-*-eabi* | \
  1103. ++ *-musl* )
  1104. + # IF there is no include fixing,
  1105. + # THEN create a no-op fixer and exit
  1106. + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
  1107. +Index: b/gcc/config.gcc
  1108. +===================================================================
  1109. +--- a/gcc/config.gcc
  1110. ++++ b/gcc/config.gcc
  1111. +@@ -594,7 +594,7 @@
  1112. + esac
  1113. +
  1114. + # Common C libraries.
  1115. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
  1116. ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
  1117. +
  1118. + # 32-bit x86 processors supported by --with-arch=. Each processor
  1119. + # MUST be separated by exactly one space.
  1120. +@@ -719,6 +719,9 @@
  1121. + *-*-*uclibc*)
  1122. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
  1123. + ;;
  1124. ++ *-*-*musl*)
  1125. ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
  1126. ++ ;;
  1127. + *)
  1128. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
  1129. + ;;
  1130. +@@ -2323,6 +2326,10 @@
  1131. + powerpc*-*-linux*paired*)
  1132. + tm_file="${tm_file} rs6000/750cl.h" ;;
  1133. + esac
  1134. ++ case ${target} in
  1135. ++ *-linux*-musl*)
  1136. ++ enable_secureplt=yes ;;
  1137. ++ esac
  1138. + if test x${enable_secureplt} = xyes; then
  1139. + tm_file="rs6000/secureplt.h ${tm_file}"
  1140. + fi
  1141. +Index: b/gcc/config/aarch64/aarch64-linux.h
  1142. +===================================================================
  1143. +--- a/gcc/config/aarch64/aarch64-linux.h
  1144. ++++ b/gcc/config/aarch64/aarch64-linux.h
  1145. +@@ -22,6 +22,8 @@
  1146. + #define GCC_AARCH64_LINUX_H
  1147. +
  1148. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
  1149. ++#undef MUSL_DYNAMIC_LINKER
  1150. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
  1151. +
  1152. + #define CPP_SPEC "%{pthread:-D_REENTRANT}"
  1153. +
  1154. +Index: b/gcc/config/arm/linux-eabi.h
  1155. +===================================================================
  1156. +--- a/gcc/config/arm/linux-eabi.h
  1157. ++++ b/gcc/config/arm/linux-eabi.h
  1158. +@@ -77,6 +77,23 @@
  1159. + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
  1160. + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
  1161. +
  1162. ++/* For ARM musl currently supports four dynamic linkers:
  1163. ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
  1164. ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
  1165. ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
  1166. ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
  1167. ++ musl does not support the legacy OABI mode.
  1168. ++ All the dynamic linkers live in /lib.
  1169. ++ We default to soft-float, EL. */
  1170. ++#undef MUSL_DYNAMIC_LINKER
  1171. ++#if TARGET_BIG_ENDIAN_DEFAULT
  1172. ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
  1173. ++#else
  1174. ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
  1175. ++#endif
  1176. ++#define MUSL_DYNAMIC_LINKER \
  1177. ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
  1178. ++
  1179. + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
  1180. + use the GNU/Linux version, not the generic BPABI version. */
  1181. + #undef LINK_SPEC
  1182. +Index: b/gcc/config/i386/linux.h
  1183. +===================================================================
  1184. +--- a/gcc/config/i386/linux.h
  1185. ++++ b/gcc/config/i386/linux.h
  1186. +@@ -21,3 +21,5 @@
  1187. +
  1188. + #define GNU_USER_LINK_EMULATION "elf_i386"
  1189. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  1190. ++#undef MUSL_DYNAMIC_LINKER
  1191. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
  1192. +Index: b/gcc/config/i386/linux64.h
  1193. +===================================================================
  1194. +--- a/gcc/config/i386/linux64.h
  1195. ++++ b/gcc/config/i386/linux64.h
  1196. +@@ -30,3 +30,10 @@
  1197. + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
  1198. + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
  1199. + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
  1200. ++
  1201. ++#undef MUSL_DYNAMIC_LINKER32
  1202. ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
  1203. ++#undef MUSL_DYNAMIC_LINKER64
  1204. ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
  1205. ++#undef MUSL_DYNAMIC_LINKERX32
  1206. ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
  1207. +Index: b/gcc/config/linux.h
  1208. +===================================================================
  1209. +--- a/gcc/config/linux.h
  1210. ++++ b/gcc/config/linux.h
  1211. +@@ -32,10 +32,12 @@
  1212. + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  1213. + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  1214. + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  1215. ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  1216. + #else
  1217. + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  1218. + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  1219. + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  1220. ++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  1221. + #endif
  1222. +
  1223. + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
  1224. +@@ -53,18 +55,21 @@
  1225. + uClibc or Bionic is the default C library and whether
  1226. + -muclibc or -mglibc or -mbionic has been passed to change the default. */
  1227. +
  1228. +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
  1229. +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
  1230. ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
  1231. ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
  1232. +
  1233. + #if DEFAULT_LIBC == LIBC_GLIBC
  1234. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  1235. +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
  1236. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  1237. ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
  1238. + #elif DEFAULT_LIBC == LIBC_UCLIBC
  1239. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  1240. +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
  1241. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  1242. ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
  1243. + #elif DEFAULT_LIBC == LIBC_BIONIC
  1244. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  1245. +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
  1246. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  1247. ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
  1248. ++#elif DEFAULT_LIBC == LIBC_MUSL
  1249. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  1250. ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
  1251. + #else
  1252. + #error "Unsupported DEFAULT_LIBC"
  1253. + #endif /* DEFAULT_LIBC */
  1254. +@@ -82,23 +87,103 @@
  1255. + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
  1256. + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
  1257. +
  1258. ++/* Musl dynamic linker paths must be defined on a per-architecture
  1259. ++ basis, for each architecture supported by Musl. However, in order
  1260. ++ to let other architectures continue to build with other C
  1261. ++ libraries, we provide a dummy definition of the following defines. */
  1262. ++#define MUSL_DYNAMIC_LINKER "invalid"
  1263. ++#define MUSL_DYNAMIC_LINKER32 "invalid"
  1264. ++#define MUSL_DYNAMIC_LINKER64 "invalid"
  1265. ++#define MUSL_DYNAMIC_LINKERX32 "invalid"
  1266. ++
  1267. + #define GNU_USER_DYNAMIC_LINKER \
  1268. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
  1269. +- BIONIC_DYNAMIC_LINKER)
  1270. ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  1271. + #define GNU_USER_DYNAMIC_LINKER32 \
  1272. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
  1273. +- BIONIC_DYNAMIC_LINKER32)
  1274. ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  1275. + #define GNU_USER_DYNAMIC_LINKER64 \
  1276. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
  1277. +- BIONIC_DYNAMIC_LINKER64)
  1278. ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  1279. + #define GNU_USER_DYNAMIC_LINKERX32 \
  1280. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
  1281. +- BIONIC_DYNAMIC_LINKERX32)
  1282. ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKER32)
  1283. +
  1284. + /* Whether we have Bionic libc runtime */
  1285. + #undef TARGET_HAS_BIONIC
  1286. + #define TARGET_HAS_BIONIC (OPTION_BIONIC)
  1287. +
  1288. ++/* musl avoids problematic includes by rearranging the include directories.
  1289. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */
  1290. ++#if DEFAULT_LIBC == LIBC_MUSL
  1291. ++#define INCLUDE_DEFAULTS_MUSL_GPP \
  1292. ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
  1293. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
  1294. ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
  1295. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
  1296. ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
  1297. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
  1298. ++
  1299. ++#ifdef LOCAL_INCLUDE_DIR
  1300. ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \
  1301. ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
  1302. ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
  1303. ++#else
  1304. ++#define INCLUDE_DEFAULTS_MUSL_LOCAL
  1305. ++#endif
  1306. ++
  1307. ++#ifdef PREFIX_INCLUDE_DIR
  1308. ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \
  1309. ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
  1310. ++#else
  1311. ++#define INCLUDE_DEFAULTS_MUSL_PREFIX
  1312. ++#endif
  1313. ++
  1314. ++#ifdef CROSS_INCLUDE_DIR
  1315. ++#define INCLUDE_DEFAULTS_MUSL_CROSS \
  1316. ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
  1317. ++#else
  1318. ++#define INCLUDE_DEFAULTS_MUSL_CROSS
  1319. ++#endif
  1320. ++
  1321. ++#ifdef TOOL_INCLUDE_DIR
  1322. ++#define INCLUDE_DEFAULTS_MUSL_TOOL \
  1323. ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
  1324. ++#else
  1325. ++#define INCLUDE_DEFAULTS_MUSL_TOOL
  1326. ++#endif
  1327. ++
  1328. ++#ifdef NATIVE_SYSTEM_HEADER_DIR
  1329. ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \
  1330. ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  1331. ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
  1332. ++#else
  1333. ++#define INCLUDE_DEFAULTS_MUSL_NATIVE
  1334. ++#endif
  1335. ++
  1336. ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
  1337. ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
  1338. ++# define INCLUDE_DEFAULTS_MUSL_LOCAL
  1339. ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
  1340. ++# define INCLUDE_DEFAULTS_MUSL_NATIVE
  1341. ++#else
  1342. ++# undef INCLUDE_DEFAULTS_MUSL_CROSS
  1343. ++# define INCLUDE_DEFAULTS_MUSL_CROSS
  1344. ++#endif
  1345. ++
  1346. ++#undef INCLUDE_DEFAULTS
  1347. ++#define INCLUDE_DEFAULTS \
  1348. ++ { \
  1349. ++ INCLUDE_DEFAULTS_MUSL_GPP \
  1350. ++ INCLUDE_DEFAULTS_MUSL_PREFIX \
  1351. ++ INCLUDE_DEFAULTS_MUSL_CROSS \
  1352. ++ INCLUDE_DEFAULTS_MUSL_TOOL \
  1353. ++ INCLUDE_DEFAULTS_MUSL_NATIVE \
  1354. ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  1355. ++ { 0, 0, 0, 0, 0, 0 } \
  1356. ++ }
  1357. ++#endif
  1358. ++
  1359. + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
  1360. + /* This is a *uclinux* target. We don't define below macros to normal linux
  1361. + versions, because doing so would require *uclinux* targets to include
  1362. +Index: b/gcc/config/linux.opt
  1363. +===================================================================
  1364. +--- a/gcc/config/linux.opt
  1365. ++++ b/gcc/config/linux.opt
  1366. +@@ -30,3 +30,7 @@
  1367. + muclibc
  1368. + Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
  1369. + Use uClibc C library
  1370. ++
  1371. ++mmusl
  1372. ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
  1373. ++Use musl C library
  1374. +Index: b/gcc/config/microblaze/linux.h
  1375. +===================================================================
  1376. +--- a/gcc/config/microblaze/linux.h
  1377. ++++ b/gcc/config/microblaze/linux.h
  1378. +@@ -25,7 +25,23 @@
  1379. + #undef TLS_NEEDS_GOT
  1380. + #define TLS_NEEDS_GOT 1
  1381. +
  1382. +-#define DYNAMIC_LINKER "/lib/ld.so.1"
  1383. ++#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
  1384. ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  1385. ++#else
  1386. ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  1387. ++#endif
  1388. ++
  1389. ++#undef MUSL_DYNAMIC_LINKER
  1390. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
  1391. ++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  1392. ++
  1393. ++#if DEFAULT_LIBC == LIBC_MUSL
  1394. ++#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
  1395. ++#else
  1396. ++#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
  1397. ++#endif
  1398. ++
  1399. ++
  1400. + #undef SUBTARGET_EXTRA_SPECS
  1401. + #define SUBTARGET_EXTRA_SPECS \
  1402. + { "dynamic_linker", DYNAMIC_LINKER }
  1403. +Index: b/gcc/config/rs6000/linux64.h
  1404. +===================================================================
  1405. +--- a/gcc/config/rs6000/linux64.h
  1406. ++++ b/gcc/config/rs6000/linux64.h
  1407. +@@ -375,17 +375,23 @@
  1408. + #endif
  1409. + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
  1410. + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
  1411. ++#undef MUSL_DYNAMIC_LINKER32
  1412. ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
  1413. ++#undef MUSL_DYNAMIC_LINKER64
  1414. ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
  1415. + #if DEFAULT_LIBC == LIBC_UCLIBC
  1416. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  1417. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  1418. + #elif DEFAULT_LIBC == LIBC_GLIBC
  1419. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  1420. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  1421. ++#elif DEFAULT_LIBC == LIBC_MUSL
  1422. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  1423. + #else
  1424. + #error "Unsupported DEFAULT_LIBC"
  1425. + #endif
  1426. + #define GNU_USER_DYNAMIC_LINKER32 \
  1427. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
  1428. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  1429. + #define GNU_USER_DYNAMIC_LINKER64 \
  1430. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
  1431. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  1432. +
  1433. + #undef DEFAULT_ASM_ENDIAN
  1434. + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
  1435. +Index: b/gcc/config/rs6000/secureplt.h
  1436. +===================================================================
  1437. +--- a/gcc/config/rs6000/secureplt.h
  1438. ++++ b/gcc/config/rs6000/secureplt.h
  1439. +@@ -18,3 +18,4 @@
  1440. + <http://www.gnu.org/licenses/>. */
  1441. +
  1442. + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
  1443. ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
  1444. +Index: b/gcc/config/rs6000/sysv4.h
  1445. +===================================================================
  1446. +--- a/gcc/config/rs6000/sysv4.h
  1447. ++++ b/gcc/config/rs6000/sysv4.h
  1448. +@@ -537,6 +537,9 @@
  1449. + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
  1450. + #define CC1_SECURE_PLT_DEFAULT_SPEC ""
  1451. + #endif
  1452. ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
  1453. ++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
  1454. ++#endif
  1455. +
  1456. + /* Pass -G xxx to the compiler. */
  1457. + #define CC1_SPEC "%{G*} %(cc1_cpu)" \
  1458. +@@ -585,7 +588,8 @@
  1459. +
  1460. + /* Override the default target of the linker. */
  1461. + #define LINK_TARGET_SPEC \
  1462. +- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
  1463. ++ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
  1464. ++ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
  1465. +
  1466. + /* Any specific OS flags. */
  1467. + #define LINK_OS_SPEC "\
  1468. +@@ -763,15 +767,18 @@
  1469. +
  1470. + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  1471. + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
  1472. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
  1473. + #if DEFAULT_LIBC == LIBC_UCLIBC
  1474. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  1475. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  1476. ++#elif DEFAULT_LIBC == LIBC_MUSL
  1477. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  1478. + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
  1479. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  1480. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  1481. + #else
  1482. + #error "Unsupported DEFAULT_LIBC"
  1483. + #endif
  1484. + #define GNU_USER_DYNAMIC_LINKER \
  1485. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
  1486. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  1487. +
  1488. + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
  1489. + %{rdynamic:-export-dynamic} \
  1490. +@@ -894,6 +901,7 @@
  1491. + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
  1492. + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
  1493. + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
  1494. ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
  1495. + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
  1496. + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
  1497. + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
  1498. +Index: b/gcc/config/sh/linux.h
  1499. +===================================================================
  1500. +--- a/gcc/config/sh/linux.h
  1501. ++++ b/gcc/config/sh/linux.h
  1502. +@@ -43,7 +43,15 @@
  1503. +
  1504. + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  1505. +
  1506. ++#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
  1507. ++#define MUSL_DYNAMIC_LINKER_E "eb"
  1508. ++#else
  1509. ++#define MUSL_DYNAMIC_LINKER_E
  1510. ++#endif
  1511. ++
  1512. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  1513. ++#undef MUSL_DYNAMIC_LINKER
  1514. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
  1515. +
  1516. + #undef SUBTARGET_LINK_EMUL_SUFFIX
  1517. + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
  1518. +Index: b/gcc/configure
  1519. +===================================================================
  1520. +--- a/gcc/configure
  1521. ++++ b/gcc/configure
  1522. +@@ -27300,6 +27300,9 @@
  1523. + else
  1524. + gcc_cv_libc_provides_ssp=no
  1525. + case "$target" in
  1526. ++ *-*-musl*)
  1527. ++ # All versions of musl provide stack protector
  1528. ++ gcc_cv_libc_provides_ssp=yes;;
  1529. + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
  1530. + # glibc 2.4 and later provides __stack_chk_fail and
  1531. + # either __stack_chk_guard, or TLS access to stack guard canary.
  1532. +@@ -27332,6 +27335,7 @@
  1533. + # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  1534. + # simply assert that glibc does provide this, which is true for all
  1535. + # realistically usable GNU/Hurd configurations.
  1536. ++ # All supported versions of musl provide it as well
  1537. + gcc_cv_libc_provides_ssp=yes;;
  1538. + *-*-darwin* | *-*-freebsd*)
  1539. + ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
  1540. +@@ -27421,6 +27425,9 @@
  1541. + gcc_cv_target_dl_iterate_phdr=no
  1542. + fi
  1543. + ;;
  1544. ++ *-linux-musl*)
  1545. ++ gcc_cv_target_dl_iterate_phdr=yes
  1546. ++ ;;
  1547. + esac
  1548. +
  1549. + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  1550. +Index: b/gcc/configure.ac
  1551. +===================================================================
  1552. +--- a/gcc/configure.ac
  1553. ++++ b/gcc/configure.ac
  1554. +@@ -5001,6 +5001,9 @@
  1555. + gcc_cv_libc_provides_ssp,
  1556. + [gcc_cv_libc_provides_ssp=no
  1557. + case "$target" in
  1558. ++ *-*-musl*)
  1559. ++ # All versions of musl provide stack protector
  1560. ++ gcc_cv_libc_provides_ssp=yes;;
  1561. + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
  1562. + # glibc 2.4 and later provides __stack_chk_fail and
  1563. + # either __stack_chk_guard, or TLS access to stack guard canary.
  1564. +@@ -5027,6 +5030,7 @@
  1565. + # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
  1566. + # simply assert that glibc does provide this, which is true for all
  1567. + # realistically usable GNU/Hurd configurations.
  1568. ++ # All supported versions of musl provide it as well
  1569. + gcc_cv_libc_provides_ssp=yes;;
  1570. + *-*-darwin* | *-*-freebsd*)
  1571. + AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
  1572. +@@ -5093,6 +5097,9 @@
  1573. + gcc_cv_target_dl_iterate_phdr=no
  1574. + fi
  1575. + ;;
  1576. ++ *-linux-musl*)
  1577. ++ gcc_cv_target_dl_iterate_phdr=yes
  1578. ++ ;;
  1579. + esac
  1580. + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
  1581. + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  1582. +Index: b/gcc/ginclude/stddef.h
  1583. +===================================================================
  1584. +--- a/gcc/ginclude/stddef.h
  1585. ++++ b/gcc/ginclude/stddef.h
  1586. +@@ -181,6 +181,7 @@
  1587. + #ifndef _GCC_SIZE_T
  1588. + #ifndef _SIZET_
  1589. + #ifndef __size_t
  1590. ++#ifndef __DEFINED_size_t /* musl */
  1591. + #define __size_t__ /* BeOS */
  1592. + #define __SIZE_T__ /* Cray Unicos/Mk */
  1593. + #define _SIZE_T
  1594. +@@ -197,6 +198,7 @@
  1595. + #define ___int_size_t_h
  1596. + #define _GCC_SIZE_T
  1597. + #define _SIZET_
  1598. ++#define __DEFINED_size_t /* musl */
  1599. + #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
  1600. + || defined(__FreeBSD_kernel__)
  1601. + /* __size_t is a typedef on FreeBSD 5, must not trash it. */
  1602. +@@ -214,6 +216,7 @@
  1603. + typedef long ssize_t;
  1604. + #endif /* __BEOS__ */
  1605. + #endif /* !(defined (__GNUG__) && defined (size_t)) */
  1606. ++#endif /* __DEFINED_size_t */
  1607. + #endif /* __size_t */
  1608. + #endif /* _SIZET_ */
  1609. + #endif /* _GCC_SIZE_T */
  1610. +Index: b/libgcc/unwind-dw2-fde-dip.c
  1611. +===================================================================
  1612. +--- a/libgcc/unwind-dw2-fde-dip.c
  1613. ++++ b/libgcc/unwind-dw2-fde-dip.c
  1614. +@@ -46,33 +46,13 @@
  1615. + #include "unwind-compat.h"
  1616. + #include "gthr.h"
  1617. +
  1618. +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  1619. +- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
  1620. +- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
  1621. +-# define USE_PT_GNU_EH_FRAME
  1622. +-#endif
  1623. +-
  1624. +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  1625. +- && defined(__BIONIC__)
  1626. +-# define USE_PT_GNU_EH_FRAME
  1627. +-#endif
  1628. +-
  1629. +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  1630. +- && defined(__FreeBSD__) && __FreeBSD__ >= 7
  1631. +-# define ElfW __ElfN
  1632. +-# define USE_PT_GNU_EH_FRAME
  1633. +-#endif
  1634. +-
  1635. +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  1636. +- && defined(__OpenBSD__)
  1637. +-# define ElfW(type) Elf_##type
  1638. +-# define USE_PT_GNU_EH_FRAME
  1639. +-#endif
  1640. +-
  1641. +-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  1642. +- && defined(TARGET_DL_ITERATE_PHDR) \
  1643. +- && defined(__sun__) && defined(__svr4__)
  1644. ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
  1645. + # define USE_PT_GNU_EH_FRAME
  1646. ++# ifdef __OpenBSD__
  1647. ++# define ElfW(type) Elf_##type
  1648. ++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
  1649. ++# define ElfW __ElfN
  1650. ++# endif
  1651. + #endif
  1652. +
  1653. + #if defined(USE_PT_GNU_EH_FRAME)
  1654. +Index: b/libgomp/config/posix/time.c
  1655. +===================================================================
  1656. +--- a/libgomp/config/posix/time.c
  1657. ++++ b/libgomp/config/posix/time.c
  1658. +@@ -28,6 +28,8 @@
  1659. + The following implementation uses the most simple POSIX routines.
  1660. + If present, POSIX 4 clocks should be used instead. */
  1661. +
  1662. ++#define _POSIX_C_SOURCE 199309L /* for clocks */
  1663. ++
  1664. + #include "libgomp.h"
  1665. + #include <unistd.h>
  1666. + #if TIME_WITH_SYS_TIME
  1667. +Index: b/libitm/config/arm/hwcap.cc
  1668. +===================================================================
  1669. +--- a/libitm/config/arm/hwcap.cc
  1670. ++++ b/libitm/config/arm/hwcap.cc
  1671. +@@ -40,7 +40,11 @@
  1672. +
  1673. + #ifdef __linux__
  1674. + #include <unistd.h>
  1675. ++#ifdef __GLIBC__
  1676. + #include <sys/fcntl.h>
  1677. ++#else
  1678. ++#include <fcntl.h>
  1679. ++#endif
  1680. + #include <elf.h>
  1681. +
  1682. + static void __attribute__((constructor))
  1683. +Index: b/libitm/config/linux/x86/tls.h
  1684. +===================================================================
  1685. +--- a/libitm/config/linux/x86/tls.h
  1686. ++++ b/libitm/config/linux/x86/tls.h
  1687. +@@ -25,16 +25,19 @@
  1688. + #ifndef LIBITM_X86_TLS_H
  1689. + #define LIBITM_X86_TLS_H 1
  1690. +
  1691. +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  1692. ++#if defined(__GLIBC_PREREQ)
  1693. ++#if __GLIBC_PREREQ(2, 10)
  1694. + /* Use slots in the TCB head rather than __thread lookups.
  1695. + GLIBC has reserved words 10 through 13 for TM. */
  1696. + #define HAVE_ARCH_GTM_THREAD 1
  1697. + #define HAVE_ARCH_GTM_THREAD_DISP 1
  1698. + #endif
  1699. ++#endif
  1700. +
  1701. + #include "config/generic/tls.h"
  1702. +
  1703. +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  1704. ++#if defined(__GLIBC_PREREQ)
  1705. ++#if __GLIBC_PREREQ(2, 10)
  1706. + namespace GTM HIDDEN {
  1707. +
  1708. + #ifdef __x86_64__
  1709. +@@ -101,5 +104,6 @@
  1710. +
  1711. + } // namespace GTM
  1712. + #endif /* >= GLIBC 2.10 */
  1713. ++#endif
  1714. +
  1715. + #endif // LIBITM_X86_TLS_H
  1716. +Index: b/libstdc++-v3/configure.host
  1717. +===================================================================
  1718. +--- a/libstdc++-v3/configure.host
  1719. ++++ b/libstdc++-v3/configure.host
  1720. +@@ -264,6 +264,13 @@
  1721. + os_include_dir="os/bsd/freebsd"
  1722. + ;;
  1723. + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
  1724. ++ # check for musl by target
  1725. ++ case "${host_os}" in
  1726. ++ *-musl*)
  1727. ++ os_include_dir="os/generic"
  1728. ++ ;;
  1729. ++ *)
  1730. ++
  1731. + if [ "$uclibc" = "yes" ]; then
  1732. + os_include_dir="os/uclibc"
  1733. + elif [ "$bionic" = "yes" ]; then
  1734. +@@ -272,6 +279,9 @@
  1735. + os_include_dir="os/gnu-linux"
  1736. + fi
  1737. + ;;
  1738. ++
  1739. ++ esac
  1740. ++ ;;
  1741. + hpux*)
  1742. + os_include_dir="os/hpux"
  1743. + ;;
  1744. +Index: b/gcc/config/mips/linux64.h
  1745. +===================================================================
  1746. +--- a/gcc/config/mips/linux64.h
  1747. ++++ b/gcc/config/mips/linux64.h
  1748. +@@ -41,4 +41,4 @@
  1749. + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
  1750. + #define GNU_USER_DYNAMIC_LINKERN32 \
  1751. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
  1752. +- BIONIC_DYNAMIC_LINKERN32)
  1753. ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKER)
  1754. +Index: b/gcc/config/mips/linux.h
  1755. +===================================================================
  1756. +--- a/gcc/config/mips/linux.h
  1757. ++++ b/gcc/config/mips/linux.h
  1758. +@@ -23,3 +23,11 @@
  1759. + #undef UCLIBC_DYNAMIC_LINKER
  1760. + #define UCLIBC_DYNAMIC_LINKER \
  1761. + "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
  1762. ++
  1763. ++#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
  1764. ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  1765. ++#else
  1766. ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  1767. ++#endif
  1768. ++#undef MUSL_DYNAMIC_LINKER
  1769. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1"
  1770. diff --git a/package/gcc/4.9.1/powerpc-link-with-math-lib.patch.conditional b/package/gcc/4.9.1/powerpc-link-with-math-lib.patch.conditional
  1771. new file mode 100644
  1772. index 0000000..b7094fe
  1773. --- /dev/null
  1774. +++ b/package/gcc/4.9.1/powerpc-link-with-math-lib.patch.conditional
  1775. @@ -0,0 +1,122 @@
  1776. +http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html
  1777. +
  1778. +On glibc the libc.so carries a copy of the math function copysignl() but
  1779. +on uClibc math functions like copysignl() live in libm. Since libgcc_s
  1780. +contains unresolved symbols, any attempt to link against libgcc_s
  1781. +without explicitely specifying -lm fails, resulting in a broken
  1782. +bootstrap of the compiler.
  1783. +
  1784. +Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>
  1785. +
  1786. +---
  1787. + libgcc/Makefile.in | 4 +++-
  1788. + libgcc/configure | 32 ++++++++++++++++++++++++++++++++
  1789. + libgcc/configure.ac | 21 +++++++++++++++++++++
  1790. + 3 files changed, 56 insertions(+), 1 deletion(-)
  1791. +
  1792. +Index: gcc-4.8.0/libgcc/Makefile.in
  1793. +===================================================================
  1794. +--- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100
  1795. ++++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100
  1796. +@@ -41,6 +41,7 @@
  1797. + decimal_float = @decimal_float@
  1798. + enable_decimal_float = @enable_decimal_float@
  1799. + fixed_point = @fixed_point@
  1800. ++LIBGCC_LIBM = @LIBGCC_LIBM@
  1801. +
  1802. + host_noncanonical = @host_noncanonical@
  1803. + target_noncanonical = @target_noncanonical@
  1804. +@@ -927,9 +928,10 @@
  1805. + @multilib_dir@,$(MULTIDIR),$(subst \
  1806. + @shlib_objs@,$(objects) libgcc.a,$(subst \
  1807. + @shlib_base_name@,libgcc_s,$(subst \
  1808. ++ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
  1809. + @shlib_map_file@,$(mapfile),$(subst \
  1810. + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
  1811. +- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
  1812. ++ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))
  1813. +
  1814. + libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
  1815. + # @multilib_flags@ is still needed because this may use
  1816. +Index: gcc-4.8.0/libgcc/configure
  1817. +===================================================================
  1818. +--- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100
  1819. ++++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100
  1820. +@@ -564,6 +564,7 @@
  1821. + tmake_file
  1822. + sfp_machine_header
  1823. + set_use_emutls
  1824. ++LIBGCC_LIBM
  1825. + set_have_cc_tls
  1826. + vis_hide
  1827. + fixed_point
  1828. +@@ -4481,6 +4482,37 @@
  1829. + fi
  1830. + fi
  1831. +
  1832. ++# On powerpc libgcc_s references copysignl which is a libm function but
  1833. ++# glibc apparently also provides it via libc as opposed to uClibc where
  1834. ++# it lives in libm.
  1835. ++echo "$as_me:$LINENO: checking for library containing copysignl" >&5
  1836. ++echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
  1837. ++if test "${libgcc_cv_copysignl_lib+set}" = set; then
  1838. ++ echo $ECHO_N "(cached) $ECHO_C" >&6
  1839. ++else
  1840. ++
  1841. ++ echo '#include <features.h>' > conftest.c
  1842. ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
  1843. ++ libgcc_cv_copysignl_lib="-lc"
  1844. ++ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
  1845. ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  1846. ++ (eval $ac_try) 2>&5
  1847. ++ ac_status=$?
  1848. ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
  1849. ++ (exit $ac_status); }; }
  1850. ++ then
  1851. ++ libgcc_cv_copysignl_lib="-lm"
  1852. ++ fi
  1853. ++ rm -f conftest.*
  1854. ++
  1855. ++fi
  1856. ++echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
  1857. ++echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
  1858. ++
  1859. ++case /${libgcc_cv_copysignl_lib}/ in
  1860. ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
  1861. ++ *) LIBGCC_LIBM= ;;
  1862. ++esac
  1863. +
  1864. + # Conditionalize the makefile for this target machine.
  1865. + tmake_file_=
  1866. +Index: gcc-4.8.0/libgcc/configure.ac
  1867. +===================================================================
  1868. +--- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200
  1869. ++++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100
  1870. +@@ -326,6 +326,27 @@
  1871. + fi
  1872. + AC_SUBST(set_have_cc_tls)
  1873. +
  1874. ++# On powerpc libgcc_s references copysignl which is a libm function but
  1875. ++# glibc apparently also provides it via libc as opposed to uClibc where
  1876. ++# it lives in libm.
  1877. ++AC_CACHE_CHECK
  1878. ++ libgcc_cv_copysignl_lib,
  1879. ++ echo '#include <features.h>' > conftest.c
  1880. ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
  1881. ++ libgcc_cv_copysignl_lib="-lc"
  1882. ++ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
  1883. ++ then
  1884. ++ libgcc_cv_copysignl_lib="-lm"
  1885. ++ fi
  1886. ++ rm -f conftest.*
  1887. ++ ])
  1888. ++
  1889. ++case /${libgcc_cv_copysignl_lib}/ in
  1890. ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
  1891. ++ *) LIBGCC_LIBM= ;;
  1892. ++esac
  1893. ++AC_SUBST(LIBGCC_LIBM)
  1894. ++
  1895. + # See if we have emulated thread-local storage.
  1896. + GCC_CHECK_EMUTLS
  1897. + set_use_emutls=
  1898. diff --git a/package/gcc/4.9.3/100-uclibc-conf.patch b/package/gcc/4.9.3/100-uclibc-conf.patch
  1899. new file mode 100644
  1900. index 0000000..d56bf0a
  1901. --- /dev/null
  1902. +++ b/package/gcc/4.9.3/100-uclibc-conf.patch
  1903. @@ -0,0 +1,15 @@
  1904. +Index: gcc-4.8.0/contrib/regression/objs-gcc.sh
  1905. +===================================================================
  1906. +--- gcc-4.8.0.orig/contrib/regression/objs-gcc.sh 2009-04-09 17:00:19.000000000 +0200
  1907. ++++ gcc-4.8.0/contrib/regression/objs-gcc.sh 2013-03-23 17:39:04.000000000 +0100
  1908. +@@ -106,6 +106,10 @@
  1909. + then
  1910. + make all-gdb all-dejagnu all-ld || exit 1
  1911. + make install-gdb install-dejagnu install-ld || exit 1
  1912. ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
  1913. ++ then
  1914. ++ make all-gdb all-dejagnu all-ld || exit 1
  1915. ++ make install-gdb install-dejagnu install-ld || exit 1
  1916. + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
  1917. + make bootstrap || exit 1
  1918. + make install || exit 1
  1919. diff --git a/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional b/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional
  1920. new file mode 100644
  1921. index 0000000..b7094fe
  1922. --- /dev/null
  1923. +++ b/package/gcc/4.9.3/1000-powerpc-link-with-math-lib.patch.conditional
  1924. @@ -0,0 +1,122 @@
  1925. +http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html
  1926. +
  1927. +On glibc the libc.so carries a copy of the math function copysignl() but
  1928. +on uClibc math functions like copysignl() live in libm. Since libgcc_s
  1929. +contains unresolved symbols, any attempt to link against libgcc_s
  1930. +without explicitely specifying -lm fails, resulting in a broken
  1931. +bootstrap of the compiler.
  1932. +
  1933. +Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>
  1934. +
  1935. +---
  1936. + libgcc/Makefile.in | 4 +++-
  1937. + libgcc/configure | 32 ++++++++++++++++++++++++++++++++
  1938. + libgcc/configure.ac | 21 +++++++++++++++++++++
  1939. + 3 files changed, 56 insertions(+), 1 deletion(-)
  1940. +
  1941. +Index: gcc-4.8.0/libgcc/Makefile.in
  1942. +===================================================================
  1943. +--- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100
  1944. ++++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100
  1945. +@@ -41,6 +41,7 @@
  1946. + decimal_float = @decimal_float@
  1947. + enable_decimal_float = @enable_decimal_float@
  1948. + fixed_point = @fixed_point@
  1949. ++LIBGCC_LIBM = @LIBGCC_LIBM@
  1950. +
  1951. + host_noncanonical = @host_noncanonical@
  1952. + target_noncanonical = @target_noncanonical@
  1953. +@@ -927,9 +928,10 @@
  1954. + @multilib_dir@,$(MULTIDIR),$(subst \
  1955. + @shlib_objs@,$(objects) libgcc.a,$(subst \
  1956. + @shlib_base_name@,libgcc_s,$(subst \
  1957. ++ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
  1958. + @shlib_map_file@,$(mapfile),$(subst \
  1959. + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
  1960. +- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
  1961. ++ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))
  1962. +
  1963. + libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
  1964. + # @multilib_flags@ is still needed because this may use
  1965. +Index: gcc-4.8.0/libgcc/configure
  1966. +===================================================================
  1967. +--- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100
  1968. ++++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100
  1969. +@@ -564,6 +564,7 @@
  1970. + tmake_file
  1971. + sfp_machine_header
  1972. + set_use_emutls
  1973. ++LIBGCC_LIBM
  1974. + set_have_cc_tls
  1975. + vis_hide
  1976. + fixed_point
  1977. +@@ -4481,6 +4482,37 @@
  1978. + fi
  1979. + fi
  1980. +
  1981. ++# On powerpc libgcc_s references copysignl which is a libm function but
  1982. ++# glibc apparently also provides it via libc as opposed to uClibc where
  1983. ++# it lives in libm.
  1984. ++echo "$as_me:$LINENO: checking for library containing copysignl" >&5
  1985. ++echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
  1986. ++if test "${libgcc_cv_copysignl_lib+set}" = set; then
  1987. ++ echo $ECHO_N "(cached) $ECHO_C" >&6
  1988. ++else
  1989. ++
  1990. ++ echo '#include <features.h>' > conftest.c
  1991. ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
  1992. ++ libgcc_cv_copysignl_lib="-lc"
  1993. ++ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
  1994. ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  1995. ++ (eval $ac_try) 2>&5
  1996. ++ ac_status=$?
  1997. ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
  1998. ++ (exit $ac_status); }; }
  1999. ++ then
  2000. ++ libgcc_cv_copysignl_lib="-lm"
  2001. ++ fi
  2002. ++ rm -f conftest.*
  2003. ++
  2004. ++fi
  2005. ++echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
  2006. ++echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
  2007. ++
  2008. ++case /${libgcc_cv_copysignl_lib}/ in
  2009. ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
  2010. ++ *) LIBGCC_LIBM= ;;
  2011. ++esac
  2012. +
  2013. + # Conditionalize the makefile for this target machine.
  2014. + tmake_file_=
  2015. +Index: gcc-4.8.0/libgcc/configure.ac
  2016. +===================================================================
  2017. +--- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200
  2018. ++++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100
  2019. +@@ -326,6 +326,27 @@
  2020. + fi
  2021. + AC_SUBST(set_have_cc_tls)
  2022. +
  2023. ++# On powerpc libgcc_s references copysignl which is a libm function but
  2024. ++# glibc apparently also provides it via libc as opposed to uClibc where
  2025. ++# it lives in libm.
  2026. ++AC_CACHE_CHECK
  2027. ++ libgcc_cv_copysignl_lib,
  2028. ++ echo '#include <features.h>' > conftest.c
  2029. ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
  2030. ++ libgcc_cv_copysignl_lib="-lc"
  2031. ++ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
  2032. ++ then
  2033. ++ libgcc_cv_copysignl_lib="-lm"
  2034. ++ fi
  2035. ++ rm -f conftest.*
  2036. ++ ])
  2037. ++
  2038. ++case /${libgcc_cv_copysignl_lib}/ in
  2039. ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
  2040. ++ *) LIBGCC_LIBM= ;;
  2041. ++esac
  2042. ++AC_SUBST(LIBGCC_LIBM)
  2043. ++
  2044. + # See if we have emulated thread-local storage.
  2045. + GCC_CHECK_EMUTLS
  2046. + set_use_emutls=
  2047. diff --git a/package/gcc/4.9.3/111-pr65730.patch b/package/gcc/4.9.3/111-pr65730.patch
  2048. new file mode 100644
  2049. index 0000000..f195e30
  2050. --- /dev/null
  2051. +++ b/package/gcc/4.9.3/111-pr65730.patch
  2052. @@ -0,0 +1,37 @@
  2053. +From b9a7775674d91c7af8043a83211ffeaa576327d7 Mon Sep 17 00:00:00 2001
  2054. +From: Max Filippov <jcmvbkbc@gmail.com>
  2055. +Date: Fri, 10 Apr 2015 17:46:30 +0300
  2056. +Subject: [PATCH] Fix PR target/65730
  2057. +
  2058. +2015-05-20 Max Filippov <jcmvbkbc@gmail.com>
  2059. +gcc/
  2060. + * config/xtensa/xtensa.c (init_alignment_context): Replace MULT
  2061. + by BITS_PER_UNIT with ASHIFT by exact_log2 (BITS_PER_UNIT).
  2062. +
  2063. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  2064. +---
  2065. +Backported from: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223452
  2066. +Changes to ChangeLog are dropped.
  2067. +
  2068. + gcc/config/xtensa/xtensa.c | 5 +++--
  2069. + 1 file changed, 3 insertions(+), 2 deletions(-)
  2070. +
  2071. +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
  2072. +index eb039ba..7296e36 100644
  2073. +--- a/gcc/config/xtensa/xtensa.c
  2074. ++++ b/gcc/config/xtensa/xtensa.c
  2075. +@@ -1461,8 +1461,9 @@ init_alignment_context (struct alignment_context *ac, rtx mem)
  2076. + if (ac->shift != NULL_RTX)
  2077. + {
  2078. + /* Shift is the byte count, but we need the bitcount. */
  2079. +- ac->shift = expand_simple_binop (SImode, MULT, ac->shift,
  2080. +- GEN_INT (BITS_PER_UNIT),
  2081. ++ gcc_assert (exact_log2 (BITS_PER_UNIT) >= 0);
  2082. ++ ac->shift = expand_simple_binop (SImode, ASHIFT, ac->shift,
  2083. ++ GEN_INT (exact_log2 (BITS_PER_UNIT)),
  2084. + NULL_RTX, 1, OPTAB_DIRECT);
  2085. + ac->modemask = expand_simple_binop (SImode, ASHIFT,
  2086. + GEN_INT (GET_MODE_MASK (mode)),
  2087. +--
  2088. +1.8.1.4
  2089. +
  2090. diff --git a/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch b/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
  2091. new file mode 100644
  2092. index 0000000..c11ad35
  2093. --- /dev/null
  2094. +++ b/package/gcc/4.9.3/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
  2095. @@ -0,0 +1,29 @@
  2096. +From 9bf6066d588632dab9f78932df15b5b4140f31f3 Mon Sep 17 00:00:00 2001
  2097. +From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
  2098. +Date: Fri, 6 Nov 2015 14:27:23 +0100
  2099. +Subject: [PATCH] gcc/config.gcc: fix typo for powerpc e6500 cpu_is_64bit
  2100. +
  2101. +Otherwise it is not recognized as a 64-bit powerpc and gcc will not generate
  2102. +64-bit binaries by default.
  2103. +
  2104. +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  2105. +---
  2106. + gcc/config.gcc | 2 +-
  2107. + 2 files changed, 4 insertions(+), 1 deletion(-)
  2108. +
  2109. +diff --git a/gcc/config.gcc b/gcc/config.gcc
  2110. +index 4a7cbd2..9cc765e 100644
  2111. +--- a/gcc/config.gcc
  2112. ++++ b/gcc/config.gcc
  2113. +@@ -439,7 +439,7 @@ powerpc*-*-*)
  2114. + cpu_type=rs6000
  2115. + extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h"
  2116. + case x$with_cpu in
  2117. +- xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
  2118. ++ xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
  2119. + cpu_is_64bit=yes
  2120. + ;;
  2121. + esac
  2122. +--
  2123. +2.6.2
  2124. +
  2125. diff --git a/package/gcc/4.9.3/130-pr43538.patch b/package/gcc/4.9.3/130-pr43538.patch
  2126. new file mode 100644
  2127. index 0000000..19e57bb
  2128. --- /dev/null
  2129. +++ b/package/gcc/4.9.3/130-pr43538.patch
  2130. @@ -0,0 +1,25 @@
  2131. +From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
  2132. +From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
  2133. +Date: Fri, 25 Apr 2014 08:03:08 +0000
  2134. +Subject: [PATCH] 2014-04-25 Marc Glisse <marc.glisse@inria.fr>
  2135. +
  2136. + PR target/43538
  2137. + * mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
  2138. +
  2139. +
  2140. +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
  2141. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  2142. +---
  2143. + config/mt-gnu | 2 +-
  2144. + 1 file changed, 1 insertion(+), 1 deletion(-)
  2145. +
  2146. +diff --git a/config/mt-gnu b/config/mt-gnu
  2147. +index 15bf417..5c696f5 100644
  2148. +--- a/config/mt-gnu
  2149. ++++ b/config/mt-gnu
  2150. +@@ -1 +1 @@
  2151. +-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
  2152. ++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
  2153. +--
  2154. +2.1.4
  2155. +
  2156. diff --git a/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch b/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch
  2157. new file mode 100644
  2158. index 0000000..55f3228
  2159. --- /dev/null
  2160. +++ b/package/gcc/4.9.3/140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch
  2161. @@ -0,0 +1,37 @@
  2162. +From 3c536954a67a883630f4a7513a27f02a892c3dcb Mon Sep 17 00:00:00 2001
  2163. +From: Evgeniy Stepanov <eugeni.stepanov@gmail.com>
  2164. +Date: Tue, 21 Oct 2014 21:08:13 +0000
  2165. +Subject: [PATCH] [sanitizer] Fix build with _FILE_OFFSET_BITS=64.
  2166. +
  2167. +Sanitizer source is not affected by _FILE_OFFSET_BITS in general,
  2168. +but this one file must be built with 32-bit off_t. More details in the code.
  2169. +
  2170. +git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220328 91177308-0d34-0410-b5e6-96231b3b80d8
  2171. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  2172. +---
  2173. + lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 8 ++++++++
  2174. + 1 file changed, 8 insertions(+)
  2175. +
  2176. +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  2177. +index bbc1108..fc09522 100644
  2178. +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  2179. ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  2180. +@@ -13,7 +13,15 @@
  2181. +
  2182. + #include "sanitizer_platform.h"
  2183. + #if SANITIZER_LINUX || SANITIZER_MAC
  2184. ++// Tests in this file assume that off_t-dependent data structures match the
  2185. ++// libc ABI. For example, struct dirent here is what readdir() function (as
  2186. ++// exported from libc) returns, and not the user-facing "dirent", which
  2187. ++// depends on _FILE_OFFSET_BITS setting.
  2188. ++// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
  2189. ++#ifdef _FILE_OFFSET_BITS
  2190. ++#undef _FILE_OFFSET_BITS
  2191. ++#endif
  2192. +
  2193. + #include "sanitizer_internal_defs.h"
  2194. + #include "sanitizer_platform_limits_posix.h"
  2195. +
  2196. +--
  2197. +2.1.4
  2198. +
  2199. diff --git a/package/gcc/4.9.3/301-missing-execinfo_h.patch b/package/gcc/4.9.3/301-missing-execinfo_h.patch
  2200. new file mode 100644
  2201. index 0000000..00efda2
  2202. --- /dev/null
  2203. +++ b/package/gcc/4.9.3/301-missing-execinfo_h.patch
  2204. @@ -0,0 +1,13 @@
  2205. +Index: gcc-4.8.0/boehm-gc/include/gc.h
  2206. +===================================================================
  2207. +--- gcc-4.8.0.orig/boehm-gc/include/gc.h 2007-04-23 23:10:09.000000000 +0200
  2208. ++++ gcc-4.8.0/boehm-gc/include/gc.h 2013-03-23 17:39:20.000000000 +0100
  2209. +@@ -503,7 +503,7 @@
  2210. + #if defined(__linux__) || defined(__GLIBC__)
  2211. + # include <features.h>
  2212. + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
  2213. +- && !defined(__ia64__)
  2214. ++ && !defined(__ia64__) && !defined(__UCLIBC__)
  2215. + # ifndef GC_HAVE_BUILTIN_BACKTRACE
  2216. + # define GC_HAVE_BUILTIN_BACKTRACE
  2217. + # endif
  2218. diff --git a/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch b/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch
  2219. new file mode 100644
  2220. index 0000000..c8cb377
  2221. --- /dev/null
  2222. +++ b/package/gcc/4.9.3/810-arm-softfloat-libgcc.patch
  2223. @@ -0,0 +1,30 @@
  2224. +Index: gcc-4.8.0/gcc/config/arm/linux-elf.h
  2225. +===================================================================
  2226. +--- gcc-4.8.0.orig/gcc/config/arm/linux-elf.h 2013-01-10 21:38:27.000000000 +0100
  2227. ++++ gcc-4.8.0/gcc/config/arm/linux-elf.h 2013-03-23 17:40:00.000000000 +0100
  2228. +@@ -55,7 +55,7 @@
  2229. + %{shared:-lc} \
  2230. + %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
  2231. +
  2232. +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
  2233. ++#define LIBGCC_SPEC "-lgcc"
  2234. +
  2235. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  2236. +
  2237. +Index: gcc-4.8.0/libgcc/config/arm/t-linux
  2238. +===================================================================
  2239. +--- gcc-4.8.0.orig/libgcc/config/arm/t-linux 2012-03-22 16:14:46.000000000 +0100
  2240. ++++ gcc-4.8.0/libgcc/config/arm/t-linux 2013-03-23 17:40:54.000000000 +0100
  2241. +@@ -1,6 +1,11 @@
  2242. + LIB1ASMSRC = arm/lib1funcs.S
  2243. + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
  2244. +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
  2245. ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
  2246. ++ _arm_addsubdf3 _arm_addsubsf3 \
  2247. ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
  2248. ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
  2249. ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
  2250. ++ _arm_fixsfsi _arm_fixunssfsi
  2251. +
  2252. + # Just for these, we omit the frame pointer since it makes such a big
  2253. + # difference.
  2254. diff --git a/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch b/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch
  2255. new file mode 100644
  2256. index 0000000..37f8f2a
  2257. --- /dev/null
  2258. +++ b/package/gcc/4.9.3/830-arm_unbreak_armv4t.patch
  2259. @@ -0,0 +1,13 @@
  2260. +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
  2261. +
  2262. +--- a/gcc/config/arm/linux-eabi.h
  2263. ++++ b/gcc/config/arm/linux-eabi.h
  2264. +@@ -45,7 +45,7 @@
  2265. + The ARM10TDMI core is the default for armv5t, so set
  2266. + SUBTARGET_CPU_DEFAULT to achieve this. */
  2267. + #undef SUBTARGET_CPU_DEFAULT
  2268. +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
  2269. ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
  2270. +
  2271. + /* TARGET_BIG_ENDIAN_DEFAULT is set in
  2272. + config.gcc for big endian configurations. */
  2273. diff --git a/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch b/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch
  2274. new file mode 100644
  2275. index 0000000..e116e2b
  2276. --- /dev/null
  2277. +++ b/package/gcc/4.9.3/840-microblaze-enable-dwarf-eh-support.patch
  2278. @@ -0,0 +1,169 @@
  2279. +Fetched from Xilinx gcc git at https://github.com/Xilinx/gcc
  2280. +
  2281. +From 23c35173490ac2d6348a668dfc9c1a6eb62171f2 Mon Sep 17 00:00:00 2001
  2282. +From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
  2283. +Date: Mon, 18 Jun 2012 20:18:13 +0200
  2284. +Subject: [PATCH] [Patch, microblaze]: Enable DWARF exception handling support.
  2285. +
  2286. +Changelog
  2287. +
  2288. +2013-03-18 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
  2289. + David Holsgrove <david.holsgrove@xilinx.com>
  2290. +
  2291. + * common/config/microblaze/microblaze-common.c: Remove
  2292. + TARGET_EXCEPT_UNWIND_INFO definition.
  2293. + * config/microblaze/microblaze-protos.h: Add
  2294. + microblaze_eh_return prototype.
  2295. + * gcc/config/microblaze/microblaze.c: (microblaze_must_save_register,
  2296. + microblaze_expand_epilogue, microblaze_return_addr): Handle
  2297. + calls_eh_return
  2298. + (microblaze_eh_return): New function.
  2299. + * gcc/config/microblaze/microblaze.h: Define RETURN_ADDR_OFFSET,
  2300. + EH_RETURN_DATA_REGNO, MB_EH_STACKADJ_REGNUM, EH_RETURN_STACKADJ_RTX,
  2301. + ASM_PREFERRED_EH_DATA_FORMAT
  2302. + * gcc/config/microblaze/microblaze.md: Define eh_return pattern.
  2303. +
  2304. +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
  2305. +Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
  2306. +---
  2307. + gcc/common/config/microblaze/microblaze-common.c | 3 ---
  2308. + gcc/config/microblaze/microblaze-protos.h | 1 +
  2309. + gcc/config/microblaze/microblaze.c | 29 ++++++++++++++++++++----
  2310. + gcc/config/microblaze/microblaze.h | 15 ++++++++++++
  2311. + gcc/config/microblaze/microblaze.md | 11 +++++++++
  2312. + 5 files changed, 52 insertions(+), 7 deletions(-)
  2313. +
  2314. +diff --git a/gcc/common/config/microblaze/microblaze-common.c b/gcc/common/config/microblaze/microblaze-common.c
  2315. +index 5835acc..85e6a53 100644
  2316. +--- a/gcc/common/config/microblaze/microblaze-common.c
  2317. ++++ b/gcc/common/config/microblaze/microblaze-common.c
  2318. +@@ -39,7 +39,4 @@ static const struct default_options microblaze_option_optimization_table[] =
  2319. + #undef TARGET_OPTION_OPTIMIZATION_TABLE
  2320. + #define TARGET_OPTION_OPTIMIZATION_TABLE microblaze_option_optimization_table
  2321. +
  2322. +-#undef TARGET_EXCEPT_UNWIND_INFO
  2323. +-#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info
  2324. +-
  2325. + struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER;
  2326. +diff --git a/gcc/config/microblaze/microblaze-protos.h b/gcc/config/microblaze/microblaze-protos.h
  2327. +index c30ec72..260f4e4 100644
  2328. +--- a/gcc/config/microblaze/microblaze-protos.h
  2329. ++++ b/gcc/config/microblaze/microblaze-protos.h
  2330. +@@ -56,6 +56,7 @@ extern bool microblaze_tls_referenced_p (rtx);
  2331. + extern int symbol_mentioned_p (rtx);
  2332. + extern int label_mentioned_p (rtx);
  2333. + extern bool microblaze_cannot_force_const_mem (enum machine_mode, rtx);
  2334. ++extern void microblaze_eh_return (rtx op0);
  2335. + #endif /* RTX_CODE */
  2336. +
  2337. + /* Declare functions in microblaze-c.c. */
  2338. +diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
  2339. +index fe61fce..15166d3 100644
  2340. +--- a/gcc/config/microblaze/microblaze.c
  2341. ++++ b/gcc/config/microblaze/microblaze.c
  2342. +@@ -1999,6 +1999,11 @@ microblaze_must_save_register (int regno)
  2343. + if (frame_pointer_needed && (regno == HARD_FRAME_POINTER_REGNUM))
  2344. + return 1;
  2345. +
  2346. ++ if (crtl->calls_eh_return
  2347. ++ && regno == MB_ABI_SUB_RETURN_ADDR_REGNUM) {
  2348. ++ return 1;
  2349. ++ }
  2350. ++
  2351. + if (!crtl->is_leaf)
  2352. + {
  2353. + if (regno == MB_ABI_SUB_RETURN_ADDR_REGNUM)
  2354. +@@ -2026,6 +2031,13 @@ microblaze_must_save_register (int regno)
  2355. + return 1;
  2356. + }
  2357. +
  2358. ++ if (crtl->calls_eh_return
  2359. ++ && (regno == EH_RETURN_DATA_REGNO (0)
  2360. ++ || regno == EH_RETURN_DATA_REGNO (1)))
  2361. ++ {
  2362. ++ return 1;
  2363. ++ }
  2364. ++
  2365. + return 0;
  2366. + }
  2367. +
  2368. +@@ -3131,6 +3143,12 @@ microblaze_expand_epilogue (void)
  2369. + emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, fsiz_rtx));
  2370. + }
  2371. +
  2372. ++ if (crtl->calls_eh_return)
  2373. ++ emit_insn (gen_addsi3 (stack_pointer_rtx,
  2374. ++ stack_pointer_rtx,
  2375. ++ gen_rtx_raw_REG (SImode,
  2376. ++ MB_EH_STACKADJ_REGNUM)));
  2377. ++
  2378. + emit_jump_insn (gen_return_internal (gen_rtx_REG (Pmode, GP_REG_FIRST +
  2379. + MB_ABI_SUB_RETURN_ADDR_REGNUM)));
  2380. + }
  2381. +@@ -3427,10 +3445,13 @@ microblaze_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
  2382. + if (count != 0)
  2383. + return NULL_RTX;
  2384. +
  2385. +- return gen_rtx_PLUS (Pmode,
  2386. +- get_hard_reg_initial_val (Pmode,
  2387. +- MB_ABI_SUB_RETURN_ADDR_REGNUM),
  2388. +- GEN_INT (8));
  2389. ++ return get_hard_reg_initial_val (Pmode,
  2390. ++ MB_ABI_SUB_RETURN_ADDR_REGNUM);
  2391. ++}
  2392. ++
  2393. ++void microblaze_eh_return (rtx op0)
  2394. ++{
  2395. ++ emit_insn (gen_movsi(gen_rtx_MEM(Pmode, stack_pointer_rtx), op0));
  2396. + }
  2397. +
  2398. + /* Queue an .ident string in the queue of top-level asm statements.
  2399. +diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
  2400. +index 4072283..5e9f49c 100644
  2401. +--- a/gcc/config/microblaze/microblaze.h
  2402. ++++ b/gcc/config/microblaze/microblaze.h
  2403. +@@ -184,6 +184,21 @@ extern enum pipeline_type microblaze_pipe;
  2404. + #define INCOMING_RETURN_ADDR_RTX \
  2405. + gen_rtx_REG (VOIDmode, GP_REG_FIRST + MB_ABI_SUB_RETURN_ADDR_REGNUM)
  2406. +
  2407. ++/* Specifies the offset from INCOMING_RETURN_ADDR_RTX and the actual return PC. */
  2408. ++#define RETURN_ADDR_OFFSET (8)
  2409. ++
  2410. ++/* Describe how we implement __builtin_eh_return. */
  2411. ++#define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? MB_ABI_FIRST_ARG_REGNUM + (N) : INVALID_REGNUM)
  2412. ++
  2413. ++#define MB_EH_STACKADJ_REGNUM MB_ABI_INT_RETURN_VAL2_REGNUM
  2414. ++#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, MB_EH_STACKADJ_REGNUM)
  2415. ++
  2416. ++/* Select a format to encode pointers in exception handling data. CODE
  2417. ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
  2418. ++ true if the symbol may be affected by dynamic relocations. */
  2419. ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
  2420. ++ ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
  2421. ++
  2422. + /* Use DWARF 2 debugging information by default. */
  2423. + #define DWARF2_DEBUGGING_INFO
  2424. + #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  2425. +diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
  2426. +index ed6131a..dc2405f 100644
  2427. +--- a/gcc/config/microblaze/microblaze.md
  2428. ++++ b/gcc/config/microblaze/microblaze.md
  2429. +@@ -2327,4 +2327,15 @@
  2430. + (set_attr "mode" "SI")
  2431. + (set_attr "length" "4")])
  2432. +
  2433. ++; This is used in compiling the unwind routines.
  2434. ++(define_expand "eh_return"
  2435. ++ [(use (match_operand 0 "general_operand" ""))]
  2436. ++ ""
  2437. ++ "
  2438. ++{
  2439. ++ microblaze_eh_return(operands[0]);
  2440. ++ DONE;
  2441. ++}")
  2442. ++
  2443. + (include "sync.md")
  2444. ++
  2445. +--
  2446. +1.8.3.2
  2447. +
  2448. diff --git a/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch b/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch
  2449. new file mode 100644
  2450. index 0000000..d103af1
  2451. --- /dev/null
  2452. +++ b/package/gcc/4.9.3/850-libstdcxx-uclibc-c99.patch
  2453. @@ -0,0 +1,255 @@
  2454. +Allow C99-depending features of libstdc++ with uClibc
  2455. +
  2456. +The libstdc++ code is fairly restrictive on how it checks for C99
  2457. +compatibility: it requires *complete* C99 support to enable certain
  2458. +features. For example, uClibc provides a good number of C99 features,
  2459. +but not C99 complex number support. For this reason, libstdc++
  2460. +completely disables many the standard C++ methods that can in fact
  2461. +work because uClibc provides the necessary functions.
  2462. +
  2463. +This patch is similar and highly inspired from
  2464. +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58393, but implemented in
  2465. +a way that doesn't involve changing the configure.ac script, as
  2466. +autoreconfiguring gcc is complicated. It simply relies on the fact
  2467. +that uClibc defines the __UCLIBC__ definition.
  2468. +
  2469. +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  2470. +[Gustavo: update for 4.9.3]
  2471. +
  2472. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h
  2473. +--- gcc-4.9.3.orig/libstdc++-v3/config/locale/generic/c_locale.h 2014-01-02 19:30:10.000000000 -0300
  2474. ++++ gcc-4.9.3/libstdc++-v3/config/locale/generic/c_locale.h 2015-06-27 06:46:04.420022179 -0300
  2475. +@@ -70,7 +70,7 @@
  2476. + __builtin_va_list __args;
  2477. + __builtin_va_start(__args, __fmt);
  2478. +
  2479. +-#ifdef _GLIBCXX_USE_C99
  2480. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2481. + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
  2482. + #else
  2483. + const int __ret = __builtin_vsprintf(__out, __fmt, __args);
  2484. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h
  2485. +--- gcc-4.9.3.orig/libstdc++-v3/config/locale/gnu/c_locale.h 2014-01-02 19:30:10.000000000 -0300
  2486. ++++ gcc-4.9.3/libstdc++-v3/config/locale/gnu/c_locale.h 2015-06-27 06:46:04.465023743 -0300
  2487. +@@ -88,7 +88,7 @@
  2488. + __builtin_va_list __args;
  2489. + __builtin_va_start(__args, __fmt);
  2490. +
  2491. +-#ifdef _GLIBCXX_USE_C99
  2492. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2493. + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
  2494. + #else
  2495. + const int __ret = __builtin_vsprintf(__out, __fmt, __args);
  2496. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h
  2497. +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/basic_string.h 2015-05-28 13:27:46.000000000 -0300
  2498. ++++ gcc-4.9.3/libstdc++-v3/include/bits/basic_string.h 2015-06-27 06:49:04.741284648 -0300
  2499. +@@ -2844,7 +2844,7 @@
  2500. + _GLIBCXX_END_NAMESPACE_VERSION
  2501. + } // namespace
  2502. +
  2503. +-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99)
  2504. ++#if __cplusplus >= 201103L && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__))
  2505. +
  2506. + #include <ext/string_conversions.h>
  2507. +
  2508. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc
  2509. +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2014-01-02 19:30:10.000000000 -0300
  2510. ++++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets_nonio.tcc 2015-06-27 06:46:04.466023777 -0300
  2511. +@@ -572,7 +572,7 @@
  2512. + {
  2513. + const locale __loc = __io.getloc();
  2514. + const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
  2515. +-#ifdef _GLIBCXX_USE_C99
  2516. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2517. + // First try a buffer perhaps big enough.
  2518. + int __cs_size = 64;
  2519. + char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
  2520. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc
  2521. +--- gcc-4.9.3.orig/libstdc++-v3/include/bits/locale_facets.tcc 2014-01-02 19:30:10.000000000 -0300
  2522. ++++ gcc-4.9.3/libstdc++-v3/include/bits/locale_facets.tcc 2015-06-27 06:46:04.466023777 -0300
  2523. +@@ -987,7 +987,7 @@
  2524. + char __fbuf[16];
  2525. + __num_base::_S_format_float(__io, __fbuf, __mod);
  2526. +
  2527. +-#ifdef _GLIBCXX_USE_C99
  2528. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2529. + // First try a buffer perhaps big enough (most probably sufficient
  2530. + // for non-ios_base::fixed outputs)
  2531. + int __cs_size = __max_digits * 3;
  2532. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h
  2533. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/math.h 2014-01-02 19:30:10.000000000 -0300
  2534. ++++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/math.h 2015-06-27 06:46:04.466023777 -0300
  2535. +@@ -56,7 +56,7 @@
  2536. + using std::floor;
  2537. + using std::fmod;
  2538. +
  2539. +-#if _GLIBCXX_USE_C99
  2540. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2541. + using std::fpclassify;
  2542. + using std::isfinite;
  2543. + using std::isinf;
  2544. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h
  2545. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_compatibility/wchar.h 2014-01-02 19:30:10.000000000 -0300
  2546. ++++ gcc-4.9.3/libstdc++-v3/include/c_compatibility/wchar.h 2015-06-27 06:46:04.466023777 -0300
  2547. +@@ -103,7 +103,7 @@
  2548. + using std::wmemset;
  2549. + using std::wcsftime;
  2550. +
  2551. +-#if _GLIBCXX_USE_C99
  2552. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2553. + using std::wcstold;
  2554. + using std::wcstoll;
  2555. + using std::wcstoull;
  2556. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio gcc-4.9.3/libstdc++-v3/include/c_global/cstdio
  2557. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdio 2014-01-23 18:17:15.000000000 -0300
  2558. ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdio 2015-06-27 06:46:04.481024298 -0300
  2559. +@@ -146,7 +146,7 @@
  2560. + using ::vsprintf;
  2561. + } // namespace
  2562. +
  2563. +-#if _GLIBCXX_USE_C99
  2564. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2565. +
  2566. + #undef snprintf
  2567. + #undef vfscanf
  2568. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib
  2569. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cstdlib 2014-01-02 19:30:10.000000000 -0300
  2570. ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cstdlib 2015-06-27 06:46:04.466023777 -0300
  2571. +@@ -182,7 +182,7 @@
  2572. + _GLIBCXX_END_NAMESPACE_VERSION
  2573. + } // namespace
  2574. +
  2575. +-#if _GLIBCXX_USE_C99
  2576. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2577. +
  2578. + #undef _Exit
  2579. + #undef llabs
  2580. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar gcc-4.9.3/libstdc++-v3/include/c_global/cwchar
  2581. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_global/cwchar 2014-01-02 19:30:10.000000000 -0300
  2582. ++++ gcc-4.9.3/libstdc++-v3/include/c_global/cwchar 2015-06-27 06:46:04.466023777 -0300
  2583. +@@ -232,7 +232,7 @@
  2584. + _GLIBCXX_END_NAMESPACE_VERSION
  2585. + } // namespace
  2586. +
  2587. +-#if _GLIBCXX_USE_C99
  2588. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2589. +
  2590. + #undef wcstold
  2591. + #undef wcstoll
  2592. +@@ -289,7 +289,7 @@
  2593. + using std::vwscanf;
  2594. + #endif
  2595. +
  2596. +-#if _GLIBCXX_USE_C99
  2597. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2598. + using std::wcstold;
  2599. + using std::wcstoll;
  2600. + using std::wcstoull;
  2601. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio gcc-4.9.3/libstdc++-v3/include/c_std/cstdio
  2602. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdio 2014-01-02 19:30:10.000000000 -0300
  2603. ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdio 2015-06-27 06:46:04.480024263 -0300
  2604. +@@ -144,7 +144,7 @@
  2605. + using ::vsprintf;
  2606. + } // namespace std
  2607. +
  2608. +-#if _GLIBCXX_USE_C99
  2609. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2610. +
  2611. + #undef snprintf
  2612. + #undef vfscanf
  2613. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib
  2614. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cstdlib 2014-01-02 19:30:10.000000000 -0300
  2615. ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cstdlib 2015-06-27 06:46:04.480024263 -0300
  2616. +@@ -180,7 +180,7 @@
  2617. + _GLIBCXX_END_NAMESPACE_VERSION
  2618. + } // namespace
  2619. +
  2620. +-#if _GLIBCXX_USE_C99
  2621. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2622. +
  2623. + #undef _Exit
  2624. + #undef llabs
  2625. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar gcc-4.9.3/libstdc++-v3/include/c_std/cwchar
  2626. +--- gcc-4.9.3.orig/libstdc++-v3/include/c_std/cwchar 2014-01-02 19:30:10.000000000 -0300
  2627. ++++ gcc-4.9.3/libstdc++-v3/include/c_std/cwchar 2015-06-27 06:46:04.480024263 -0300
  2628. +@@ -228,7 +228,7 @@
  2629. + _GLIBCXX_END_NAMESPACE_VERSION
  2630. + } // namespace
  2631. +
  2632. +-#if _GLIBCXX_USE_C99
  2633. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2634. +
  2635. + #undef wcstold
  2636. + #undef wcstoll
  2637. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h gcc-4.9.3/libstdc++-v3/include/ext/vstring.h
  2638. +--- gcc-4.9.3.orig/libstdc++-v3/include/ext/vstring.h 2014-01-02 19:30:10.000000000 -0300
  2639. ++++ gcc-4.9.3/libstdc++-v3/include/ext/vstring.h 2015-06-27 06:46:04.480024263 -0300
  2640. +@@ -2680,7 +2680,7 @@
  2641. + _GLIBCXX_END_NAMESPACE_VERSION
  2642. + } // namespace
  2643. +
  2644. +-#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
  2645. ++#if ((__cplusplus >= 201103L) && (defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)))
  2646. +
  2647. + #include <ext/string_conversions.h>
  2648. +
  2649. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio gcc-4.9.3/libstdc++-v3/include/tr1/cstdio
  2650. +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdio 2014-01-02 19:30:10.000000000 -0300
  2651. ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdio 2015-06-27 06:46:04.480024263 -0300
  2652. +@@ -33,7 +33,7 @@
  2653. +
  2654. + #include <cstdio>
  2655. +
  2656. +-#if _GLIBCXX_USE_C99
  2657. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2658. +
  2659. + namespace std _GLIBCXX_VISIBILITY(default)
  2660. + {
  2661. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib
  2662. +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cstdlib 2014-01-02 19:30:10.000000000 -0300
  2663. ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cstdlib 2015-06-27 06:46:04.480024263 -0300
  2664. +@@ -35,7 +35,7 @@
  2665. +
  2666. + #if _GLIBCXX_HOSTED
  2667. +
  2668. +-#if _GLIBCXX_USE_C99
  2669. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2670. +
  2671. + namespace std _GLIBCXX_VISIBILITY(default)
  2672. + {
  2673. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar gcc-4.9.3/libstdc++-v3/include/tr1/cwchar
  2674. +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/cwchar 2014-01-02 19:30:10.000000000 -0300
  2675. ++++ gcc-4.9.3/libstdc++-v3/include/tr1/cwchar 2015-06-27 06:46:04.480024263 -0300
  2676. +@@ -52,7 +52,7 @@
  2677. + using std::vwscanf;
  2678. + #endif
  2679. +
  2680. +-#if _GLIBCXX_USE_C99
  2681. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2682. + using std::wcstold;
  2683. + using std::wcstoll;
  2684. + using std::wcstoull;
  2685. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h
  2686. +--- gcc-4.9.3.orig/libstdc++-v3/include/tr1/stdlib.h 2014-01-02 19:30:10.000000000 -0300
  2687. ++++ gcc-4.9.3/libstdc++-v3/include/tr1/stdlib.h 2015-06-27 06:46:04.481024298 -0300
  2688. +@@ -33,7 +33,7 @@
  2689. +
  2690. + #if _GLIBCXX_HOSTED
  2691. +
  2692. +-#if _GLIBCXX_USE_C99
  2693. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2694. +
  2695. + using std::tr1::atoll;
  2696. + using std::tr1::strtoll;
  2697. +diff -Nura gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc
  2698. +--- gcc-4.9.3.orig/libstdc++-v3/src/c++11/debug.cc 2014-01-02 19:30:10.000000000 -0300
  2699. ++++ gcc-4.9.3/libstdc++-v3/src/c++11/debug.cc 2015-06-27 06:46:04.481024298 -0300
  2700. +@@ -788,7 +788,7 @@
  2701. + int __n __attribute__ ((__unused__)),
  2702. + const char* __fmt, _Tp __s) const throw ()
  2703. + {
  2704. +-#ifdef _GLIBCXX_USE_C99
  2705. ++#if defined(_GLIBCXX_USE_C99) || defined(__UCLIBC__)
  2706. + std::snprintf(__buf, __n, __fmt, __s);
  2707. + #else
  2708. + std::sprintf(__buf, __fmt, __s);
  2709. diff --git a/package/gcc/4.9.3/860-cilk-wchar.patch b/package/gcc/4.9.3/860-cilk-wchar.patch
  2710. new file mode 100644
  2711. index 0000000..1837405
  2712. --- /dev/null
  2713. +++ b/package/gcc/4.9.3/860-cilk-wchar.patch
  2714. @@ -0,0 +1,56 @@
  2715. +[PATCH] cilk: fix build without wchar
  2716. +
  2717. +When building against uClibc with wchar support disabled, WCHAR_MIN and
  2718. +WCHAR_MAX are not defined leading to compilation errors.
  2719. +
  2720. +Fix it by only including the wchar code if available.
  2721. +
  2722. +Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  2723. +---
  2724. + libcilkrts/include/cilk/reducer_min_max.h | 8 ++++++++
  2725. + 1 file changed, 8 insertions(+)
  2726. +
  2727. +Index: host-gcc-final-4.9.2/libcilkrts/include/cilk/reducer_min_max.h
  2728. +===================================================================
  2729. +--- host-gcc-final-4.9.2.orig/libcilkrts/include/cilk/reducer_min_max.h
  2730. ++++ host-gcc-final-4.9.2/libcilkrts/include/cilk/reducer_min_max.h
  2731. +@@ -3154,7 +3154,9 @@
  2732. + CILK_C_REDUCER_MAX_INSTANCE(char, char, CHAR_MIN)
  2733. + CILK_C_REDUCER_MAX_INSTANCE(unsigned char, uchar, 0)
  2734. + CILK_C_REDUCER_MAX_INSTANCE(signed char, schar, SCHAR_MIN)
  2735. ++#ifdef WCHAR_MIN
  2736. + CILK_C_REDUCER_MAX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
  2737. ++#endif
  2738. + CILK_C_REDUCER_MAX_INSTANCE(short, short, SHRT_MIN)
  2739. + CILK_C_REDUCER_MAX_INSTANCE(unsigned short, ushort, 0)
  2740. + CILK_C_REDUCER_MAX_INSTANCE(int, int, INT_MIN)
  2741. +@@ -3306,7 +3308,9 @@
  2742. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(char, char, CHAR_MIN)
  2743. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned char, uchar, 0)
  2744. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(signed char, schar, SCHAR_MIN)
  2745. ++#ifdef WCHAR_MIN
  2746. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MIN)
  2747. ++#endif
  2748. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(short, short, SHRT_MIN)
  2749. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(unsigned short, ushort, 0)
  2750. + CILK_C_REDUCER_MAX_INDEX_INSTANCE(int, int, INT_MIN)
  2751. +@@ -3432,7 +3436,9 @@
  2752. + CILK_C_REDUCER_MIN_INSTANCE(char, char, CHAR_MAX)
  2753. + CILK_C_REDUCER_MIN_INSTANCE(unsigned char, uchar, CHAR_MAX)
  2754. + CILK_C_REDUCER_MIN_INSTANCE(signed char, schar, SCHAR_MAX)
  2755. ++#ifdef WCHAR_MAX
  2756. + CILK_C_REDUCER_MIN_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
  2757. ++#endif
  2758. + CILK_C_REDUCER_MIN_INSTANCE(short, short, SHRT_MAX)
  2759. + CILK_C_REDUCER_MIN_INSTANCE(unsigned short, ushort, USHRT_MAX)
  2760. + CILK_C_REDUCER_MIN_INSTANCE(int, int, INT_MAX)
  2761. +@@ -3584,7 +3590,9 @@
  2762. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(char, char, CHAR_MAX)
  2763. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned char, uchar, CHAR_MAX)
  2764. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(signed char, schar, SCHAR_MAX)
  2765. ++#ifdef WCHAR_MAX
  2766. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(wchar_t, wchar_t, WCHAR_MAX)
  2767. ++#endif
  2768. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(short, short, SHRT_MAX)
  2769. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(unsigned short, ushort, USHRT_MAX)
  2770. + CILK_C_REDUCER_MIN_INDEX_INSTANCE(int, int, INT_MAX)
  2771. diff --git a/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch b/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch
  2772. new file mode 100644
  2773. index 0000000..aa1376c
  2774. --- /dev/null
  2775. +++ b/package/gcc/4.9.3/870-xtensa-add-mauto-litpools-option.patch
  2776. @@ -0,0 +1,290 @@
  2777. +From 6d852ffb43b111a39162135c95249e749c4e285b Mon Sep 17 00:00:00 2001
  2778. +From: Max Filippov <jcmvbkbc@gmail.com>
  2779. +Date: Thu, 6 Aug 2015 01:16:02 +0300
  2780. +Subject: [PATCH] xtensa: add -mauto-litpools option
  2781. +
  2782. +With support from assembler this option allows compiling huge functions,
  2783. +where single literal pool at the beginning of a function may not be
  2784. +reachable by L32R instructions at its end.
  2785. +
  2786. +Currently assembler --auto-litpools option cannot deal with literals
  2787. +used from multiple locations separated by more than 256 KBytes of code.
  2788. +Don't turn constants into literals, instead use MOVI instruction to load
  2789. +them into registers and let the assembler turn them into literals as
  2790. +necessary.
  2791. +
  2792. +2015-08-12 Max Filippov <jcmvbkbc@gmail.com>
  2793. +gcc/
  2794. + * config/xtensa/constraints.md (define_constraint "Y"): New
  2795. + constraint.
  2796. + * config/xtensa/elf.h (ASM_SPEC): Add m(no-)auto-litpools.
  2797. + * config/xtensa/linux.h (ASM_SPEC): Likewise.
  2798. + * config/xtensa/predicates.md (move_operand): Match constants
  2799. + and symbols in the presence of TARGET_AUTO_LITPOOLS.
  2800. + * config/xtensa/xtensa.c (xtensa_valid_move): Don't allow
  2801. + immediate references to TLS data.
  2802. + (xtensa_emit_move_sequence): Don't force constants to memory in
  2803. + the presence of TARGET_AUTO_LITPOOLS.
  2804. + (print_operand): Add 'y' format, same as default, but capable of
  2805. + printing SF mode constants as well.
  2806. + * config/xtensa/xtensa.md (movsi_internal, movhi_internal)
  2807. + (movsf_internal): Add movi pattern that loads literal.
  2808. + (movsf, movdf): Don't force constants to memory in the presence
  2809. + of TARGET_AUTO_LITPOOLS.
  2810. + (movdf_internal): Add 'Y' constraint.
  2811. + * config/xtensa/xtensa.opt (mauto-litpools): New option.
  2812. +
  2813. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  2814. +---
  2815. +Backported from: r226828
  2816. +Changes to ChangeLogs and documentation are dropped.
  2817. +
  2818. + gcc/config/xtensa/constraints.md | 5 +++++
  2819. + gcc/config/xtensa/elf.h | 4 +++-
  2820. + gcc/config/xtensa/linux.h | 4 +++-
  2821. + gcc/config/xtensa/predicates.md | 3 ++-
  2822. + gcc/config/xtensa/xtensa.c | 19 ++++++++++++++++++-
  2823. + gcc/config/xtensa/xtensa.md | 35 +++++++++++++++++++----------------
  2824. + gcc/config/xtensa/xtensa.opt | 4 ++++
  2825. + 7 files changed, 54 insertions(+), 20 deletions(-)
  2826. +
  2827. +diff --git a/gcc/config/xtensa/constraints.md b/gcc/config/xtensa/constraints.md
  2828. +index 30f4c1f..773d4f9 100644
  2829. +--- a/gcc/config/xtensa/constraints.md
  2830. ++++ b/gcc/config/xtensa/constraints.md
  2831. +@@ -111,6 +111,11 @@
  2832. + (and (match_code "const_int")
  2833. + (match_test "xtensa_mask_immediate (ival)")))
  2834. +
  2835. ++(define_constraint "Y"
  2836. ++ "A constant that can be used in relaxed MOVI instructions."
  2837. ++ (and (match_code "const_int,const_double,const,symbol_ref,label_ref")
  2838. ++ (match_test "TARGET_AUTO_LITPOOLS")))
  2839. ++
  2840. + ;; Memory constraints. Do not use define_memory_constraint here. Doing so
  2841. + ;; causes reload to force some constants into the constant pool, but since
  2842. + ;; the Xtensa constant pool can only be accessed with L32R instructions, it
  2843. +diff --git a/gcc/config/xtensa/elf.h b/gcc/config/xtensa/elf.h
  2844. +index e59bede..12056f7 100644
  2845. +--- a/gcc/config/xtensa/elf.h
  2846. ++++ b/gcc/config/xtensa/elf.h
  2847. +@@ -48,7 +48,9 @@ along with GCC; see the file COPYING3. If not see
  2848. + %{mtarget-align:--target-align} \
  2849. + %{mno-target-align:--no-target-align} \
  2850. + %{mlongcalls:--longcalls} \
  2851. +- %{mno-longcalls:--no-longcalls}"
  2852. ++ %{mno-longcalls:--no-longcalls} \
  2853. ++ %{mauto-litpools:--auto-litpools} \
  2854. ++ %{mno-auto-litpools:--no-auto-litpools}"
  2855. +
  2856. + #undef LIB_SPEC
  2857. + #define LIB_SPEC "-lc -lsim -lc -lhandlers-sim -lhal"
  2858. +diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
  2859. +index 675aacf..5b0243a 100644
  2860. +--- a/gcc/config/xtensa/linux.h
  2861. ++++ b/gcc/config/xtensa/linux.h
  2862. +@@ -42,7 +42,9 @@ along with GCC; see the file COPYING3. If not see
  2863. + %{mtarget-align:--target-align} \
  2864. + %{mno-target-align:--no-target-align} \
  2865. + %{mlongcalls:--longcalls} \
  2866. +- %{mno-longcalls:--no-longcalls}"
  2867. ++ %{mno-longcalls:--no-longcalls} \
  2868. ++ %{mauto-litpools:--auto-litpools} \
  2869. ++ %{mno-auto-litpools:--no-auto-litpools}"
  2870. +
  2871. + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  2872. +
  2873. +diff --git a/gcc/config/xtensa/predicates.md b/gcc/config/xtensa/predicates.md
  2874. +index e02209e..d7dfa11 100644
  2875. +--- a/gcc/config/xtensa/predicates.md
  2876. ++++ b/gcc/config/xtensa/predicates.md
  2877. +@@ -142,7 +142,8 @@
  2878. + (match_test "GET_MODE_CLASS (mode) == MODE_INT
  2879. + && xtensa_simm12b (INTVAL (op))"))
  2880. + (and (match_code "const_int,const_double,const,symbol_ref,label_ref")
  2881. +- (match_test "TARGET_CONST16 && CONSTANT_P (op)
  2882. ++ (match_test "(TARGET_CONST16 || TARGET_AUTO_LITPOOLS)
  2883. ++ && CONSTANT_P (op)
  2884. + && GET_MODE_SIZE (mode) % UNITS_PER_WORD == 0")))))
  2885. +
  2886. + ;; Accept the floating point constant 1 in the appropriate mode.
  2887. +diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
  2888. +index eb039ba..206ff80 100644
  2889. +--- a/gcc/config/xtensa/xtensa.c
  2890. ++++ b/gcc/config/xtensa/xtensa.c
  2891. +@@ -501,6 +501,9 @@ xtensa_valid_move (machine_mode mode, rtx *operands)
  2892. + {
  2893. + int dst_regnum = xt_true_regnum (operands[0]);
  2894. +
  2895. ++ if (xtensa_tls_referenced_p (operands[1]))
  2896. ++ return FALSE;
  2897. ++
  2898. + /* The stack pointer can only be assigned with a MOVSP opcode. */
  2899. + if (dst_regnum == STACK_POINTER_REGNUM)
  2900. + return !TARGET_WINDOWED_ABI
  2901. +@@ -1069,7 +1072,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
  2902. + return 1;
  2903. + }
  2904. +
  2905. +- if (! TARGET_CONST16)
  2906. ++ if (! TARGET_AUTO_LITPOOLS && ! TARGET_CONST16)
  2907. + {
  2908. + src = force_const_mem (SImode, src);
  2909. + operands[1] = src;
  2910. +@@ -2449,6 +2452,20 @@ print_operand (FILE *file, rtx x, int letter)
  2911. + }
  2912. + break;
  2913. +
  2914. ++ case 'y':
  2915. ++ if (GET_CODE (x) == CONST_DOUBLE &&
  2916. ++ GET_MODE (x) == SFmode)
  2917. ++ {
  2918. ++ REAL_VALUE_TYPE r;
  2919. ++ long l;
  2920. ++ REAL_VALUE_FROM_CONST_DOUBLE (r, x);
  2921. ++ REAL_VALUE_TO_TARGET_SINGLE (r, l);
  2922. ++ fprintf (file, "0x%08lx", l);
  2923. ++ break;
  2924. ++ }
  2925. ++
  2926. ++ /* fall through */
  2927. ++
  2928. + default:
  2929. + if (GET_CODE (x) == REG || GET_CODE (x) == SUBREG)
  2930. + fprintf (file, "%s", reg_names[xt_true_regnum (x)]);
  2931. +diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
  2932. +index 6d84384..0e673a3 100644
  2933. +--- a/gcc/config/xtensa/xtensa.md
  2934. ++++ b/gcc/config/xtensa/xtensa.md
  2935. +@@ -761,8 +761,8 @@
  2936. + })
  2937. +
  2938. + (define_insn "movsi_internal"
  2939. +- [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,W,a,a,U,*a,*A")
  2940. +- (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,i,T,U,r,*A,*r"))]
  2941. ++ [(set (match_operand:SI 0 "nonimmed_operand" "=D,D,D,D,R,R,a,q,a,a,W,a,a,U,*a,*A")
  2942. ++ (match_operand:SI 1 "move_operand" "M,D,d,R,D,d,r,r,I,Y,i,T,U,r,*A,*r"))]
  2943. + "xtensa_valid_move (SImode, operands)"
  2944. + "@
  2945. + movi.n\t%0, %x1
  2946. +@@ -774,15 +774,16 @@
  2947. + mov\t%0, %1
  2948. + movsp\t%0, %1
  2949. + movi\t%0, %x1
  2950. ++ movi\t%0, %1
  2951. + const16\t%0, %t1\;const16\t%0, %b1
  2952. + %v1l32r\t%0, %1
  2953. + %v1l32i\t%0, %1
  2954. + %v0s32i\t%1, %0
  2955. + rsr\t%0, ACCLO
  2956. + wsr\t%1, ACCLO"
  2957. +- [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,load,load,store,rsr,wsr")
  2958. ++ [(set_attr "type" "move,move,move,load,store,store,move,move,move,move,move,load,load,store,rsr,wsr")
  2959. + (set_attr "mode" "SI")
  2960. +- (set_attr "length" "2,2,2,2,2,2,3,3,3,6,3,3,3,3,3")])
  2961. ++ (set_attr "length" "2,2,2,2,2,2,3,3,3,3,6,3,3,3,3,3")])
  2962. +
  2963. + ;; 16-bit Integer moves
  2964. +
  2965. +@@ -796,21 +797,22 @@
  2966. + })
  2967. +
  2968. + (define_insn "movhi_internal"
  2969. +- [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,U,*a,*A")
  2970. +- (match_operand:HI 1 "move_operand" "M,d,r,I,U,r,*A,*r"))]
  2971. ++ [(set (match_operand:HI 0 "nonimmed_operand" "=D,D,a,a,a,a,U,*a,*A")
  2972. ++ (match_operand:HI 1 "move_operand" "M,d,r,I,Y,U,r,*A,*r"))]
  2973. + "xtensa_valid_move (HImode, operands)"
  2974. + "@
  2975. + movi.n\t%0, %x1
  2976. + mov.n\t%0, %1
  2977. + mov\t%0, %1
  2978. + movi\t%0, %x1
  2979. ++ movi\t%0, %1
  2980. + %v1l16ui\t%0, %1
  2981. + %v0s16i\t%1, %0
  2982. + rsr\t%0, ACCLO
  2983. + wsr\t%1, ACCLO"
  2984. +- [(set_attr "type" "move,move,move,move,load,store,rsr,wsr")
  2985. ++ [(set_attr "type" "move,move,move,move,move,load,store,rsr,wsr")
  2986. + (set_attr "mode" "HI")
  2987. +- (set_attr "length" "2,2,3,3,3,3,3,3")])
  2988. ++ (set_attr "length" "2,2,3,3,3,3,3,3,3")])
  2989. +
  2990. + ;; 8-bit Integer moves
  2991. +
  2992. +@@ -881,7 +883,7 @@
  2993. + (match_operand:SF 1 "general_operand" ""))]
  2994. + ""
  2995. + {
  2996. +- if (!TARGET_CONST16 && CONSTANT_P (operands[1]))
  2997. ++ if (!TARGET_CONST16 && !TARGET_AUTO_LITPOOLS && CONSTANT_P (operands[1]))
  2998. + operands[1] = force_const_mem (SFmode, operands[1]);
  2999. +
  3000. + if ((!register_operand (operands[0], SFmode)
  3001. +@@ -896,8 +898,8 @@
  3002. + })
  3003. +
  3004. + (define_insn "movsf_internal"
  3005. +- [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,W,a,a,U")
  3006. +- (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,iF,T,U,r"))]
  3007. ++ [(set (match_operand:SF 0 "nonimmed_operand" "=f,f,U,D,D,R,a,f,a,a,W,a,a,U")
  3008. ++ (match_operand:SF 1 "move_operand" "f,U,f,d,R,d,r,r,f,Y,iF,T,U,r"))]
  3009. + "((register_operand (operands[0], SFmode)
  3010. + || register_operand (operands[1], SFmode))
  3011. + && !(FP_REG_P (xt_true_regnum (operands[0]))
  3012. +@@ -912,13 +914,14 @@
  3013. + mov\t%0, %1
  3014. + wfr\t%0, %1
  3015. + rfr\t%0, %1
  3016. ++ movi\t%0, %y1
  3017. + const16\t%0, %t1\;const16\t%0, %b1
  3018. + %v1l32r\t%0, %1
  3019. + %v1l32i\t%0, %1
  3020. + %v0s32i\t%1, %0"
  3021. +- [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,load,load,store")
  3022. ++ [(set_attr "type" "farith,fload,fstore,move,load,store,move,farith,farith,move,move,load,load,store")
  3023. + (set_attr "mode" "SF")
  3024. +- (set_attr "length" "3,3,3,2,2,2,3,3,3,6,3,3,3")])
  3025. ++ (set_attr "length" "3,3,3,2,2,2,3,3,3,3,6,3,3,3")])
  3026. +
  3027. + (define_insn "*lsiu"
  3028. + [(set (match_operand:SF 0 "register_operand" "=f")
  3029. +@@ -991,7 +994,7 @@
  3030. + (match_operand:DF 1 "general_operand" ""))]
  3031. + ""
  3032. + {
  3033. +- if (CONSTANT_P (operands[1]) && !TARGET_CONST16)
  3034. ++ if (CONSTANT_P (operands[1]) && !TARGET_CONST16 && !TARGET_AUTO_LITPOOLS)
  3035. + operands[1] = force_const_mem (DFmode, operands[1]);
  3036. +
  3037. + if (!register_operand (operands[0], DFmode)
  3038. +@@ -1002,8 +1005,8 @@
  3039. + })
  3040. +
  3041. + (define_insn_and_split "movdf_internal"
  3042. +- [(set (match_operand:DF 0 "nonimmed_operand" "=a,W,a,a,U")
  3043. +- (match_operand:DF 1 "move_operand" "r,iF,T,U,r"))]
  3044. ++ [(set (match_operand:DF 0 "nonimmed_operand" "=a,a,W,a,a,U")
  3045. ++ (match_operand:DF 1 "move_operand" "r,Y,iF,T,U,r"))]
  3046. + "register_operand (operands[0], DFmode)
  3047. + || register_operand (operands[1], DFmode)"
  3048. + "#"
  3049. +diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt
  3050. +index 2fd6cee..21c6e96 100644
  3051. +--- a/gcc/config/xtensa/xtensa.opt
  3052. ++++ b/gcc/config/xtensa/xtensa.opt
  3053. +@@ -38,6 +38,10 @@ mtext-section-literals
  3054. + Target
  3055. + Intersperse literal pools with code in the text section
  3056. +
  3057. ++mauto-litpools
  3058. ++Target Report Mask(AUTO_LITPOOLS)
  3059. ++Relax literals in assembler and place them automatically in the text section
  3060. ++
  3061. + mserialize-volatile
  3062. + Target Report Mask(SERIALIZE_VOLATILE)
  3063. + -mno-serialize-volatile Do not serialize volatile memory references with MEMW instructions
  3064. +--
  3065. +1.8.1.4
  3066. +
  3067. diff --git a/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch b/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch
  3068. new file mode 100644
  3069. index 0000000..abc7a08
  3070. --- /dev/null
  3071. +++ b/package/gcc/4.9.3/871-xtensa-reimplement-register-spilling.patch
  3072. @@ -0,0 +1,76 @@
  3073. +From 05154174b369505238b759cf80d595d8cfc8c731 Mon Sep 17 00:00:00 2001
  3074. +From: Max Filippov <jcmvbkbc@gmail.com>
  3075. +Date: Mon, 10 Aug 2015 21:35:20 +0300
  3076. +Subject: [PATCH 1/3] xtensa: reimplement register spilling
  3077. +
  3078. +Spilling windowed registers in userspace is much easier, more portable,
  3079. +less error-prone and equally effective as in kernel. Now that register
  3080. +spilling syscall is considered obsolete in the xtensa linux kernel
  3081. +replace it with CALL12 followed by series of ENTRY in libgcc.
  3082. +
  3083. +2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
  3084. +libgcc/
  3085. + * config/xtensa/lib2funcs.S (__xtensa_libgcc_window_spill): Use
  3086. + CALL12 followed by series of ENTRY to spill windowed registers.
  3087. + (__xtensa_nonlocal_goto): Call __xtensa_libgcc_window_spill
  3088. + instead of making linux spill syscall.
  3089. +
  3090. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  3091. +---
  3092. +Backported from: r226962
  3093. +
  3094. + libgcc/config/xtensa/lib2funcs.S | 30 +++++++++++++++++++++++-------
  3095. + 1 file changed, 23 insertions(+), 7 deletions(-)
  3096. +
  3097. +diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S
  3098. +index 3ac8c1d..2e678af 100644
  3099. +--- a/libgcc/config/xtensa/lib2funcs.S
  3100. ++++ b/libgcc/config/xtensa/lib2funcs.S
  3101. +@@ -33,10 +33,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  3102. + .global __xtensa_libgcc_window_spill
  3103. + .type __xtensa_libgcc_window_spill,@function
  3104. + __xtensa_libgcc_window_spill:
  3105. +- entry sp, 32
  3106. +- movi a2, 0
  3107. +- syscall
  3108. ++ entry sp, 48
  3109. ++#if XCHAL_NUM_AREGS > 16
  3110. ++ call12 1f
  3111. ++ retw
  3112. ++ .align 4
  3113. ++1:
  3114. ++ .rept (XCHAL_NUM_AREGS - 24) / 12
  3115. ++ _entry sp, 48
  3116. ++ mov a12, a0
  3117. ++ .endr
  3118. ++ _entry sp, 16
  3119. ++#if XCHAL_NUM_AREGS % 12 == 0
  3120. ++ mov a4, a4
  3121. ++#elif XCHAL_NUM_AREGS % 12 == 4
  3122. ++ mov a8, a8
  3123. ++#elif XCHAL_NUM_AREGS % 12 == 8
  3124. ++ mov a12, a12
  3125. ++#endif
  3126. ++ retw
  3127. ++#else
  3128. ++ mov a8, a8
  3129. + retw
  3130. ++#endif
  3131. + .size __xtensa_libgcc_window_spill, .-__xtensa_libgcc_window_spill
  3132. +
  3133. +
  3134. +@@ -58,10 +77,7 @@ __xtensa_nonlocal_goto:
  3135. + entry sp, 32
  3136. +
  3137. + /* Flush registers. */
  3138. +- mov a5, a2
  3139. +- movi a2, 0
  3140. +- syscall
  3141. +- mov a2, a5
  3142. ++ call8 __xtensa_libgcc_window_spill
  3143. +
  3144. + /* Because the save area for a0-a3 is stored one frame below
  3145. + the one identified by a2, the only way to restore those
  3146. +--
  3147. +1.8.1.4
  3148. +
  3149. diff --git a/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch b/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
  3150. new file mode 100644
  3151. index 0000000..f23a5c0
  3152. --- /dev/null
  3153. +++ b/package/gcc/4.9.3/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
  3154. @@ -0,0 +1,33 @@
  3155. +From f66206679a0ad604f13673559f230160cd3d1189 Mon Sep 17 00:00:00 2001
  3156. +From: Max Filippov <jcmvbkbc@gmail.com>
  3157. +Date: Fri, 14 Aug 2015 02:45:02 +0300
  3158. +Subject: [PATCH 2/3] xtensa: use unwind-dw2-fde-dip instead of unwind-dw2-fde
  3159. +
  3160. +This allows having exception cleanup code in binaries that don't
  3161. +register their unwind tables.
  3162. +
  3163. +2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
  3164. +libgcc/
  3165. + * config/xtensa/t-xtensa (LIB2ADDEH): Replace unwind-dw2-fde
  3166. + with unwind-dw2-fde-dip.
  3167. +
  3168. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  3169. +---
  3170. +Backported from: r226963
  3171. +
  3172. + libgcc/config/xtensa/t-xtensa | 2 +-
  3173. + 1 file changed, 1 insertion(+), 1 deletion(-)
  3174. +
  3175. +diff --git a/libgcc/config/xtensa/t-xtensa b/libgcc/config/xtensa/t-xtensa
  3176. +index 27399e6..66d0eb3 100644
  3177. +--- a/libgcc/config/xtensa/t-xtensa
  3178. ++++ b/libgcc/config/xtensa/t-xtensa
  3179. +@@ -13,4 +13,4 @@ LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 _udivsi3 _umodsi3 \
  3180. + LIB2ADD = $(srcdir)/config/xtensa/lib2funcs.S
  3181. +
  3182. + LIB2ADDEH = $(srcdir)/config/xtensa/unwind-dw2-xtensa.c \
  3183. +- $(srcdir)/unwind-dw2-fde.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
  3184. ++ $(srcdir)/unwind-dw2-fde-dip.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
  3185. +--
  3186. +1.8.1.4
  3187. +
  3188. diff --git a/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch b/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch
  3189. new file mode 100644
  3190. index 0000000..dc40513
  3191. --- /dev/null
  3192. +++ b/package/gcc/4.9.3/873-xtensa-fix-_Unwind_GetCFA.patch
  3193. @@ -0,0 +1,40 @@
  3194. +From 15c7c4d39b317f0d902ef28fd43eca5c3369f891 Mon Sep 17 00:00:00 2001
  3195. +From: Max Filippov <jcmvbkbc@gmail.com>
  3196. +Date: Sat, 15 Aug 2015 05:12:11 +0300
  3197. +Subject: [PATCH 3/3] xtensa: fix _Unwind_GetCFA
  3198. +
  3199. +Returning context->cfa in _Unwind_GetCFA makes CFA point one stack frame
  3200. +higher than what was actually used by code at context->ra. This results
  3201. +in invalid CFA value in signal frames and premature unwinding completion
  3202. +in forced unwinding used by uClibc NPTL thread cancellation.
  3203. +Returning context->sp from _Unwind_GetCFA makes all CFA values valid and
  3204. +matching code that used them.
  3205. +
  3206. +2015-08-18 Max Filippov <jcmvbkbc@gmail.com>
  3207. +libgcc/
  3208. + * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return
  3209. + context->sp instead of context->cfa.
  3210. +
  3211. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  3212. +---
  3213. +Backported from: r226964
  3214. +
  3215. + libgcc/config/xtensa/unwind-dw2-xtensa.c | 2 +-
  3216. + 1 file changed, 1 insertion(+), 1 deletion(-)
  3217. +
  3218. +diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c
  3219. +index 35f7797..ef6b900 100644
  3220. +--- a/libgcc/config/xtensa/unwind-dw2-xtensa.c
  3221. ++++ b/libgcc/config/xtensa/unwind-dw2-xtensa.c
  3222. +@@ -130,7 +130,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
  3223. + _Unwind_Word
  3224. + _Unwind_GetCFA (struct _Unwind_Context *context)
  3225. + {
  3226. +- return (_Unwind_Ptr) context->cfa;
  3227. ++ return (_Unwind_Ptr) context->sp;
  3228. + }
  3229. +
  3230. + /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */
  3231. +--
  3232. +1.8.1.4
  3233. +
  3234. diff --git a/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch b/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch
  3235. new file mode 100644
  3236. index 0000000..23db3d8
  3237. --- /dev/null
  3238. +++ b/package/gcc/4.9.3/874-xtensa-add-uclinux-support.patch
  3239. @@ -0,0 +1,174 @@
  3240. +From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001
  3241. +From: Max Filippov <jcmvbkbc@gmail.com>
  3242. +Date: Sat, 22 Aug 2015 08:44:26 +0300
  3243. +Subject: [PATCH] xtensa: add uclinux support
  3244. +
  3245. +2015-10-03 Max Filippov <jcmvbkbc@gmail.com>
  3246. +gcc/
  3247. + * config.gcc (xtensa*-*-uclinux*): New configuration.
  3248. + * config/xtensa/uclinux.h: New file.
  3249. + * config/xtensa/uclinux.opt: New file.
  3250. +
  3251. +libgcc/
  3252. + * config.host (xtensa*-*-uclinux*): New configuration.
  3253. +
  3254. +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  3255. +---
  3256. +Backported from: r228450
  3257. +
  3258. + gcc/config.gcc | 5 ++++
  3259. + gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++
  3260. + gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++
  3261. + libgcc/config.host | 5 ++++
  3262. + 4 files changed, 111 insertions(+)
  3263. + create mode 100644 gcc/config/xtensa/uclinux.h
  3264. + create mode 100644 gcc/config/xtensa/uclinux.opt
  3265. +
  3266. +diff --git a/gcc/config.gcc b/gcc/config.gcc
  3267. +index c52f5a8..56797bd 100644
  3268. +--- a/gcc/config.gcc
  3269. ++++ b/gcc/config.gcc
  3270. +@@ -2995,6 +2995,11 @@ xtensa*-*-linux*)
  3271. + tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
  3272. + tmake_file="${tmake_file} xtensa/t-xtensa"
  3273. + ;;
  3274. ++xtensa*-*-uclinux*)
  3275. ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
  3276. ++ tmake_file="${tmake_file} xtensa/t-xtensa"
  3277. ++ extra_options="${extra_options} xtensa/uclinux.opt"
  3278. ++ ;;
  3279. + am33_2.0-*-linux*)
  3280. + tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
  3281. + gas=yes gnu_ld=yes
  3282. +diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
  3283. +new file mode 100644
  3284. +index 0000000..4606020
  3285. +--- /dev/null
  3286. ++++ b/gcc/config/xtensa/uclinux.h
  3287. +@@ -0,0 +1,69 @@
  3288. ++/* Xtensa uClinux configuration.
  3289. ++ Derived from the configuration for GCC for Intel i386 running Linux.
  3290. ++ Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3291. ++
  3292. ++This file is part of GCC.
  3293. ++
  3294. ++GCC is free software; you can redistribute it and/or modify it under
  3295. ++the terms of the GNU General Public License as published by the Free
  3296. ++Software Foundation; either version 3, or (at your option) any later
  3297. ++version.
  3298. ++
  3299. ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  3300. ++WARRANTY; without even the implied warranty of MERCHANTABILITY or
  3301. ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  3302. ++for more details.
  3303. ++
  3304. ++You should have received a copy of the GNU General Public License
  3305. ++along with GCC; see the file COPYING3. If not see
  3306. ++<http://www.gnu.org/licenses/>. */
  3307. ++
  3308. ++#undef TARGET_OS_CPP_BUILTINS
  3309. ++#define TARGET_OS_CPP_BUILTINS() \
  3310. ++ do \
  3311. ++ { \
  3312. ++ GNU_USER_TARGET_OS_CPP_BUILTINS (); \
  3313. ++ builtin_define ("__uClinux__"); \
  3314. ++ } \
  3315. ++ while (0)
  3316. ++
  3317. ++#undef SUBTARGET_CPP_SPEC
  3318. ++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
  3319. ++
  3320. ++#undef SIZE_TYPE
  3321. ++#define SIZE_TYPE "unsigned int"
  3322. ++
  3323. ++#undef PTRDIFF_TYPE
  3324. ++#define PTRDIFF_TYPE "int"
  3325. ++
  3326. ++#undef WCHAR_TYPE
  3327. ++#define WCHAR_TYPE "long int"
  3328. ++
  3329. ++#undef WCHAR_TYPE_SIZE
  3330. ++#define WCHAR_TYPE_SIZE 32
  3331. ++
  3332. ++#undef ASM_SPEC
  3333. ++#define ASM_SPEC \
  3334. ++ "%{mtext-section-literals:--text-section-literals} \
  3335. ++ %{mno-text-section-literals:--no-text-section-literals} \
  3336. ++ %{mtarget-align:--target-align} \
  3337. ++ %{mno-target-align:--no-target-align} \
  3338. ++ %{mlongcalls:--longcalls} \
  3339. ++ %{mno-longcalls:--no-longcalls} \
  3340. ++ %{mauto-litpools:--auto-litpools} \
  3341. ++ %{mno-auto-litpools:--no-auto-litpools}"
  3342. ++
  3343. ++#undef LINK_SPEC
  3344. ++#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
  3345. ++
  3346. ++#undef LOCAL_LABEL_PREFIX
  3347. ++#define LOCAL_LABEL_PREFIX "."
  3348. ++
  3349. ++/* Always enable "-fpic" for Xtensa Linux. */
  3350. ++#define XTENSA_ALWAYS_PIC 1
  3351. ++
  3352. ++#undef TARGET_LIBC_HAS_FUNCTION
  3353. ++#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
  3354. ++
  3355. ++#undef DBX_REGISTER_NUMBER
  3356. ++
  3357. +diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt
  3358. +new file mode 100644
  3359. +index 0000000..95ef777
  3360. +--- /dev/null
  3361. ++++ b/gcc/config/xtensa/uclinux.opt
  3362. +@@ -0,0 +1,32 @@
  3363. ++; Xtensa uClinux options.
  3364. ++
  3365. ++; Copyright (C) 2015 Free Software Foundation, Inc.
  3366. ++;
  3367. ++; This file is part of GCC.
  3368. ++;
  3369. ++; GCC is free software; you can redistribute it and/or modify it under
  3370. ++; the terms of the GNU General Public License as published by the Free
  3371. ++; Software Foundation; either version 3, or (at your option) any later
  3372. ++; version.
  3373. ++;
  3374. ++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  3375. ++; WARRANTY; without even the implied warranty of MERCHANTABILITY or
  3376. ++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  3377. ++; for more details.
  3378. ++;
  3379. ++; You should have received a copy of the GNU General Public License
  3380. ++; along with GCC; see the file COPYING3. If not see
  3381. ++; <http://www.gnu.org/licenses/>.
  3382. ++
  3383. ++; See the GCC internals manual (options.texi) for a description of
  3384. ++; this file's format.
  3385. ++
  3386. ++; Please try to keep this file in ASCII collating order.
  3387. ++
  3388. ++elf2flt
  3389. ++Driver
  3390. ++
  3391. ++elf2flt=
  3392. ++Driver JoinedOrMissing
  3393. ++
  3394. ++; This comment is to ensure we retain the blank line above.
  3395. +diff --git a/libgcc/config.host b/libgcc/config.host
  3396. +index 2c64756..2ee92c1 100644
  3397. +--- a/libgcc/config.host
  3398. ++++ b/libgcc/config.host
  3399. +@@ -1295,6 +1295,11 @@ xtensa*-*-linux*)
  3400. + tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
  3401. + md_unwind_header=xtensa/linux-unwind.h
  3402. + ;;
  3403. ++xtensa*-*-uclinux*)
  3404. ++ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
  3405. ++ md_unwind_header=xtensa/linux-unwind.h
  3406. ++ extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
  3407. ++ ;;
  3408. + am33_2.0-*-linux*)
  3409. + # Don't need crtbeginT.o from *-*-linux* default.
  3410. + extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
  3411. +--
  3412. +1.8.1.4
  3413. +
  3414. diff --git a/package/gcc/4.9.3/880-nios2_legitimize_address.patch b/package/gcc/4.9.3/880-nios2_legitimize_address.patch
  3415. new file mode 100644
  3416. index 0000000..4623f29
  3417. --- /dev/null
  3418. +++ b/package/gcc/4.9.3/880-nios2_legitimize_address.patch
  3419. @@ -0,0 +1,49 @@
  3420. +From b0ea54f3f995754881e0ea6651133aa7b58eeaa2 Mon Sep 17 00:00:00 2001
  3421. +From: cltang <cltang@138bc75d-0d04-0410-961f-82ee72b054a4>
  3422. +Date: Tue, 22 Sep 2015 12:23:20 +0000
  3423. +Subject: [PATCH] nios2_legitimize_address 2015-09-22 Chung-Lin Tang
  3424. + <cltang@codesourcery.com>
  3425. +
  3426. + Backport from mainline
  3427. + 2015-09-22 Chung-Lin Tang <cltang@codesourcery.com>
  3428. +
  3429. + * config/nios2/nios2.c (nios2_legitimize_address): When handling
  3430. + 'reg + reloc' cases, allow first operand to be non-REG, and use
  3431. + force_reg() to enforce address pattern.
  3432. +
  3433. +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@228013 138bc75d-0d04-0410-961f-82ee72b054a4
  3434. +
  3435. +Fixes:
  3436. +http://autobuild.buildroot.net/results/901/90186d1fe134b804c0101554296b1235dc0ccbb0
  3437. +
  3438. +[backported to 4.9.3]
  3439. +Signed-off-by: Romain Naour <romain.naour@gmail.com>
  3440. +---
  3441. + gcc/config/nios2/nios2.c | 4 ++--
  3442. + 1 file changed, 2 insertions(+), 2 deletions(-)
  3443. +
  3444. +diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
  3445. +index 047b615..41dd6f9 100644
  3446. +--- a/gcc/config/nios2/nios2.c
  3447. ++++ b/gcc/config/nios2/nios2.c
  3448. +@@ -1786,15 +1786,15 @@ nios2_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
  3449. +
  3450. + Which will be output as '%tls_le(var+48)(r23)' in assembly. */
  3451. + if (GET_CODE (x) == PLUS
  3452. +- && GET_CODE (XEXP (x, 0)) == REG
  3453. + && GET_CODE (XEXP (x, 1)) == CONST)
  3454. + {
  3455. +- rtx unspec, offset, reg = XEXP (x, 0);
  3456. ++ rtx unspec, offset;
  3457. + split_const (XEXP (x, 1), &unspec, &offset);
  3458. + if (GET_CODE (unspec) == UNSPEC
  3459. + && !nios2_large_offset_p (XINT (unspec, 1))
  3460. + && offset != const0_rtx)
  3461. + {
  3462. ++ rtx reg = force_reg (Pmode, XEXP (x, 0));
  3463. + unspec = copy_rtx (unspec);
  3464. + XVECEXP (unspec, 0, 0)
  3465. + = plus_constant (Pmode, XVECEXP (unspec, 0, 0), INTVAL (offset));
  3466. +--
  3467. +2.5.0
  3468. +
  3469. diff --git a/package/gcc/4.9.3/890-fix-m68k-compile.patch b/package/gcc/4.9.3/890-fix-m68k-compile.patch
  3470. new file mode 100644
  3471. index 0000000..140977b
  3472. --- /dev/null
  3473. +++ b/package/gcc/4.9.3/890-fix-m68k-compile.patch
  3474. @@ -0,0 +1,15 @@
  3475. +remove unused header, which breaks the toolchain building
  3476. +
  3477. +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  3478. +
  3479. +diff -Nur gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c gcc-4.9.3/libgcc/config/m68k/linux-atomic.c
  3480. +--- gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c 2014-01-02 23:25:22.000000000 +0100
  3481. ++++ gcc-4.9.3/libgcc/config/m68k/linux-atomic.c 2016-03-18 22:24:40.000000000 +0100
  3482. +@@ -33,7 +33,6 @@
  3483. + using the kernel helper defined below. There is no support for
  3484. + 64-bit operations yet. */
  3485. +
  3486. +-#include <asm/unistd.h>
  3487. + #include <stdbool.h>
  3488. +
  3489. + #ifndef __NR_atomic_cmpxchg_32
  3490. diff --git a/package/gcc/4.9.3/900-musl-support.patch b/package/gcc/4.9.3/900-musl-support.patch
  3491. new file mode 100644
  3492. index 0000000..90f64de
  3493. --- /dev/null
  3494. +++ b/package/gcc/4.9.3/900-musl-support.patch
  3495. @@ -0,0 +1,640 @@
  3496. +Add musl support to gcc
  3497. +
  3498. +This patch comes from the musl-cross project at
  3499. +https://bitbucket.org/GregorR/musl-cross/src. Compared to the upstream version:
  3500. +
  3501. + * the config.sub modifications have been removed, because Buildroot
  3502. + already overwrites all config.sub with a more recent config.sub
  3503. + that has musl support.
  3504. +
  3505. + * change to ensure that a dummy dynamic linker path
  3506. + MUSL_DYNAMIC_LINKER<foo> is defined for all architectures,
  3507. + otherwise building gcc for architectures not supported by musl was
  3508. + causing build failure. Bug reported upstream at
  3509. + https://bitbucket.org/GregorR/musl-gcc-patches/issue/4/musl-gcc-patches-break-the-build-on.
  3510. +
  3511. + * change the USE_PT_GNU_EH_FRAME logic to keep the existing gcc logic
  3512. + and only add the musl one as an addition, not as a replacement. Not
  3513. + doing this breaks C++ exception handling with glibc, because
  3514. + USE_PT_GNU_EH_FRAME doesn't get defined due to the configure script
  3515. + not testing dl_iterate_phdr() on any system except Solaris.
  3516. +
  3517. +[Gustavo: remove upstream applied gcc/config/sh/sh.c chunk for 4.9.1]
  3518. +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3519. +---
  3520. +
  3521. +Index: b/fixincludes/mkfixinc.sh
  3522. +===================================================================
  3523. +--- a/fixincludes/mkfixinc.sh
  3524. ++++ b/fixincludes/mkfixinc.sh
  3525. +@@ -19,7 +19,8 @@
  3526. + powerpc-*-eabi* | \
  3527. + powerpc-*-rtems* | \
  3528. + powerpcle-*-eabisim* | \
  3529. +- powerpcle-*-eabi* )
  3530. ++ powerpcle-*-eabi* | \
  3531. ++ *-musl* )
  3532. + # IF there is no include fixing,
  3533. + # THEN create a no-op fixer and exit
  3534. + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
  3535. +Index: b/gcc/config.gcc
  3536. +===================================================================
  3537. +--- a/gcc/config.gcc
  3538. ++++ b/gcc/config.gcc
  3539. +@@ -594,7 +594,7 @@
  3540. + esac
  3541. +
  3542. + # Common C libraries.
  3543. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
  3544. ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
  3545. +
  3546. + # 32-bit x86 processors supported by --with-arch=. Each processor
  3547. + # MUST be separated by exactly one space.
  3548. +@@ -719,6 +719,9 @@
  3549. + *-*-*uclibc*)
  3550. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
  3551. + ;;
  3552. ++ *-*-*musl*)
  3553. ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
  3554. ++ ;;
  3555. + *)
  3556. + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
  3557. + ;;
  3558. +@@ -2322,6 +2325,10 @@
  3559. + powerpc*-*-linux*paired*)
  3560. + tm_file="${tm_file} rs6000/750cl.h" ;;
  3561. + esac
  3562. ++ case ${target} in
  3563. ++ *-linux*-musl*)
  3564. ++ enable_secureplt=yes ;;
  3565. ++ esac
  3566. + if test x${enable_secureplt} = xyes; then
  3567. + tm_file="rs6000/secureplt.h ${tm_file}"
  3568. + fi
  3569. +Index: b/gcc/config/aarch64/aarch64-linux.h
  3570. +===================================================================
  3571. +--- a/gcc/config/aarch64/aarch64-linux.h
  3572. ++++ b/gcc/config/aarch64/aarch64-linux.h
  3573. +@@ -22,6 +22,8 @@
  3574. + #define GCC_AARCH64_LINUX_H
  3575. +
  3576. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1"
  3577. ++#undef MUSL_DYNAMIC_LINKER
  3578. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
  3579. +
  3580. + #define CPP_SPEC "%{pthread:-D_REENTRANT}"
  3581. +
  3582. +Index: b/gcc/config/arm/linux-eabi.h
  3583. +===================================================================
  3584. +--- a/gcc/config/arm/linux-eabi.h
  3585. ++++ b/gcc/config/arm/linux-eabi.h
  3586. +@@ -77,6 +77,23 @@
  3587. + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
  3588. + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
  3589. +
  3590. ++/* For ARM musl currently supports four dynamic linkers:
  3591. ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
  3592. ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
  3593. ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
  3594. ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
  3595. ++ musl does not support the legacy OABI mode.
  3596. ++ All the dynamic linkers live in /lib.
  3597. ++ We default to soft-float, EL. */
  3598. ++#undef MUSL_DYNAMIC_LINKER
  3599. ++#if TARGET_BIG_ENDIAN_DEFAULT
  3600. ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
  3601. ++#else
  3602. ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
  3603. ++#endif
  3604. ++#define MUSL_DYNAMIC_LINKER \
  3605. ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
  3606. ++
  3607. + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
  3608. + use the GNU/Linux version, not the generic BPABI version. */
  3609. + #undef LINK_SPEC
  3610. +Index: b/gcc/config/i386/linux.h
  3611. +===================================================================
  3612. +--- a/gcc/config/i386/linux.h
  3613. ++++ b/gcc/config/i386/linux.h
  3614. +@@ -21,3 +21,5 @@
  3615. +
  3616. + #define GNU_USER_LINK_EMULATION "elf_i386"
  3617. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  3618. ++#undef MUSL_DYNAMIC_LINKER
  3619. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
  3620. +Index: b/gcc/config/i386/linux64.h
  3621. +===================================================================
  3622. +--- a/gcc/config/i386/linux64.h
  3623. ++++ b/gcc/config/i386/linux64.h
  3624. +@@ -30,3 +30,10 @@
  3625. + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
  3626. + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
  3627. + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
  3628. ++
  3629. ++#undef MUSL_DYNAMIC_LINKER32
  3630. ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
  3631. ++#undef MUSL_DYNAMIC_LINKER64
  3632. ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
  3633. ++#undef MUSL_DYNAMIC_LINKERX32
  3634. ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
  3635. +Index: b/gcc/config/linux.h
  3636. +===================================================================
  3637. +--- a/gcc/config/linux.h
  3638. ++++ b/gcc/config/linux.h
  3639. +@@ -32,10 +32,12 @@
  3640. + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
  3641. + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
  3642. + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
  3643. ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
  3644. + #else
  3645. + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
  3646. + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
  3647. + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
  3648. ++#define OPTION_MUSL (linux_libc == LIBC_MUSL)
  3649. + #endif
  3650. +
  3651. + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \
  3652. +@@ -53,18 +55,21 @@
  3653. + uClibc or Bionic is the default C library and whether
  3654. + -muclibc or -mglibc or -mbionic has been passed to change the default. */
  3655. +
  3656. +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
  3657. +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
  3658. ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
  3659. ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
  3660. +
  3661. + #if DEFAULT_LIBC == LIBC_GLIBC
  3662. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  3663. +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
  3664. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  3665. ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
  3666. + #elif DEFAULT_LIBC == LIBC_UCLIBC
  3667. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  3668. +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
  3669. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  3670. ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
  3671. + #elif DEFAULT_LIBC == LIBC_BIONIC
  3672. +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
  3673. +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
  3674. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  3675. ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
  3676. ++#elif DEFAULT_LIBC == LIBC_MUSL
  3677. ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
  3678. ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
  3679. + #else
  3680. + #error "Unsupported DEFAULT_LIBC"
  3681. + #endif /* DEFAULT_LIBC */
  3682. +@@ -82,23 +87,103 @@
  3683. + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
  3684. + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
  3685. +
  3686. ++/* Musl dynamic linker paths must be defined on a per-architecture
  3687. ++ basis, for each architecture supported by Musl. However, in order
  3688. ++ to let other architectures continue to build with other C
  3689. ++ libraries, we provide a dummy definition of the following defines. */
  3690. ++#define MUSL_DYNAMIC_LINKER "invalid"
  3691. ++#define MUSL_DYNAMIC_LINKER32 "invalid"
  3692. ++#define MUSL_DYNAMIC_LINKER64 "invalid"
  3693. ++#define MUSL_DYNAMIC_LINKERX32 "invalid"
  3694. ++
  3695. + #define GNU_USER_DYNAMIC_LINKER \
  3696. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
  3697. +- BIONIC_DYNAMIC_LINKER)
  3698. ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  3699. + #define GNU_USER_DYNAMIC_LINKER32 \
  3700. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
  3701. +- BIONIC_DYNAMIC_LINKER32)
  3702. ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  3703. + #define GNU_USER_DYNAMIC_LINKER64 \
  3704. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
  3705. +- BIONIC_DYNAMIC_LINKER64)
  3706. ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  3707. + #define GNU_USER_DYNAMIC_LINKERX32 \
  3708. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
  3709. +- BIONIC_DYNAMIC_LINKERX32)
  3710. ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKER32)
  3711. +
  3712. + /* Whether we have Bionic libc runtime */
  3713. + #undef TARGET_HAS_BIONIC
  3714. + #define TARGET_HAS_BIONIC (OPTION_BIONIC)
  3715. +
  3716. ++/* musl avoids problematic includes by rearranging the include directories.
  3717. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */
  3718. ++#if DEFAULT_LIBC == LIBC_MUSL
  3719. ++#define INCLUDE_DEFAULTS_MUSL_GPP \
  3720. ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
  3721. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
  3722. ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
  3723. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
  3724. ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
  3725. ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
  3726. ++
  3727. ++#ifdef LOCAL_INCLUDE_DIR
  3728. ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \
  3729. ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
  3730. ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
  3731. ++#else
  3732. ++#define INCLUDE_DEFAULTS_MUSL_LOCAL
  3733. ++#endif
  3734. ++
  3735. ++#ifdef PREFIX_INCLUDE_DIR
  3736. ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \
  3737. ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
  3738. ++#else
  3739. ++#define INCLUDE_DEFAULTS_MUSL_PREFIX
  3740. ++#endif
  3741. ++
  3742. ++#ifdef CROSS_INCLUDE_DIR
  3743. ++#define INCLUDE_DEFAULTS_MUSL_CROSS \
  3744. ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
  3745. ++#else
  3746. ++#define INCLUDE_DEFAULTS_MUSL_CROSS
  3747. ++#endif
  3748. ++
  3749. ++#ifdef TOOL_INCLUDE_DIR
  3750. ++#define INCLUDE_DEFAULTS_MUSL_TOOL \
  3751. ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
  3752. ++#else
  3753. ++#define INCLUDE_DEFAULTS_MUSL_TOOL
  3754. ++#endif
  3755. ++
  3756. ++#ifdef NATIVE_SYSTEM_HEADER_DIR
  3757. ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \
  3758. ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
  3759. ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
  3760. ++#else
  3761. ++#define INCLUDE_DEFAULTS_MUSL_NATIVE
  3762. ++#endif
  3763. ++
  3764. ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
  3765. ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
  3766. ++# define INCLUDE_DEFAULTS_MUSL_LOCAL
  3767. ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
  3768. ++# define INCLUDE_DEFAULTS_MUSL_NATIVE
  3769. ++#else
  3770. ++# undef INCLUDE_DEFAULTS_MUSL_CROSS
  3771. ++# define INCLUDE_DEFAULTS_MUSL_CROSS
  3772. ++#endif
  3773. ++
  3774. ++#undef INCLUDE_DEFAULTS
  3775. ++#define INCLUDE_DEFAULTS \
  3776. ++ { \
  3777. ++ INCLUDE_DEFAULTS_MUSL_GPP \
  3778. ++ INCLUDE_DEFAULTS_MUSL_PREFIX \
  3779. ++ INCLUDE_DEFAULTS_MUSL_CROSS \
  3780. ++ INCLUDE_DEFAULTS_MUSL_TOOL \
  3781. ++ INCLUDE_DEFAULTS_MUSL_NATIVE \
  3782. ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
  3783. ++ { 0, 0, 0, 0, 0, 0 } \
  3784. ++ }
  3785. ++#endif
  3786. ++
  3787. + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
  3788. + /* This is a *uclinux* target. We don't define below macros to normal linux
  3789. + versions, because doing so would require *uclinux* targets to include
  3790. +Index: b/gcc/config/linux.opt
  3791. +===================================================================
  3792. +--- a/gcc/config/linux.opt
  3793. ++++ b/gcc/config/linux.opt
  3794. +@@ -30,3 +30,7 @@
  3795. + muclibc
  3796. + Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
  3797. + Use uClibc C library
  3798. ++
  3799. ++mmusl
  3800. ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
  3801. ++Use musl C library
  3802. +Index: b/gcc/config/microblaze/linux.h
  3803. +===================================================================
  3804. +--- a/gcc/config/microblaze/linux.h
  3805. ++++ b/gcc/config/microblaze/linux.h
  3806. +@@ -25,7 +25,23 @@
  3807. + #undef TLS_NEEDS_GOT
  3808. + #define TLS_NEEDS_GOT 1
  3809. +
  3810. +-#define DYNAMIC_LINKER "/lib/ld.so.1"
  3811. ++#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
  3812. ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  3813. ++#else
  3814. ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  3815. ++#endif
  3816. ++
  3817. ++#undef MUSL_DYNAMIC_LINKER
  3818. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
  3819. ++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  3820. ++
  3821. ++#if DEFAULT_LIBC == LIBC_MUSL
  3822. ++#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER
  3823. ++#else
  3824. ++#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
  3825. ++#endif
  3826. ++
  3827. ++
  3828. + #undef SUBTARGET_EXTRA_SPECS
  3829. + #define SUBTARGET_EXTRA_SPECS \
  3830. + { "dynamic_linker", DYNAMIC_LINKER }
  3831. +Index: b/gcc/config/rs6000/linux64.h
  3832. +===================================================================
  3833. +--- a/gcc/config/rs6000/linux64.h
  3834. ++++ b/gcc/config/rs6000/linux64.h
  3835. +@@ -375,17 +375,23 @@
  3836. + #endif
  3837. + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
  3838. + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
  3839. ++#undef MUSL_DYNAMIC_LINKER32
  3840. ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
  3841. ++#undef MUSL_DYNAMIC_LINKER64
  3842. ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
  3843. + #if DEFAULT_LIBC == LIBC_UCLIBC
  3844. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  3845. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  3846. + #elif DEFAULT_LIBC == LIBC_GLIBC
  3847. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  3848. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  3849. ++#elif DEFAULT_LIBC == LIBC_MUSL
  3850. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  3851. + #else
  3852. + #error "Unsupported DEFAULT_LIBC"
  3853. + #endif
  3854. + #define GNU_USER_DYNAMIC_LINKER32 \
  3855. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
  3856. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
  3857. + #define GNU_USER_DYNAMIC_LINKER64 \
  3858. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
  3859. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
  3860. +
  3861. + #undef DEFAULT_ASM_ENDIAN
  3862. + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
  3863. +Index: b/gcc/config/rs6000/secureplt.h
  3864. +===================================================================
  3865. +--- a/gcc/config/rs6000/secureplt.h
  3866. ++++ b/gcc/config/rs6000/secureplt.h
  3867. +@@ -18,3 +18,4 @@
  3868. + <http://www.gnu.org/licenses/>. */
  3869. +
  3870. + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
  3871. ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
  3872. +Index: b/gcc/config/rs6000/sysv4.h
  3873. +===================================================================
  3874. +--- a/gcc/config/rs6000/sysv4.h
  3875. ++++ b/gcc/config/rs6000/sysv4.h
  3876. +@@ -537,6 +537,9 @@
  3877. + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
  3878. + #define CC1_SECURE_PLT_DEFAULT_SPEC ""
  3879. + #endif
  3880. ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
  3881. ++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
  3882. ++#endif
  3883. +
  3884. + /* Pass -G xxx to the compiler. */
  3885. + #define CC1_SPEC "%{G*} %(cc1_cpu)" \
  3886. +@@ -585,7 +588,8 @@
  3887. +
  3888. + /* Override the default target of the linker. */
  3889. + #define LINK_TARGET_SPEC \
  3890. +- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
  3891. ++ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
  3892. ++ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
  3893. +
  3894. + /* Any specific OS flags. */
  3895. + #define LINK_OS_SPEC "\
  3896. +@@ -763,15 +767,18 @@
  3897. +
  3898. + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
  3899. + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
  3900. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
  3901. + #if DEFAULT_LIBC == LIBC_UCLIBC
  3902. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
  3903. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
  3904. ++#elif DEFAULT_LIBC == LIBC_MUSL
  3905. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
  3906. + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
  3907. +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
  3908. ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
  3909. + #else
  3910. + #error "Unsupported DEFAULT_LIBC"
  3911. + #endif
  3912. + #define GNU_USER_DYNAMIC_LINKER \
  3913. +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
  3914. ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
  3915. +
  3916. + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
  3917. + %{rdynamic:-export-dynamic} \
  3918. +@@ -894,6 +901,7 @@
  3919. + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
  3920. + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
  3921. + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
  3922. ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
  3923. + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
  3924. + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
  3925. + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
  3926. +Index: b/gcc/config/sh/linux.h
  3927. +===================================================================
  3928. +--- a/gcc/config/sh/linux.h
  3929. ++++ b/gcc/config/sh/linux.h
  3930. +@@ -43,7 +43,15 @@
  3931. +
  3932. + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  3933. +
  3934. ++#if TARGET_BIG_ENDIAN_DEFAULT /* BE */
  3935. ++#define MUSL_DYNAMIC_LINKER_E "eb"
  3936. ++#else
  3937. ++#define MUSL_DYNAMIC_LINKER_E
  3938. ++#endif
  3939. ++
  3940. + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  3941. ++#undef MUSL_DYNAMIC_LINKER
  3942. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1"
  3943. +
  3944. + #undef SUBTARGET_LINK_EMUL_SUFFIX
  3945. + #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
  3946. +Index: b/gcc/configure
  3947. +===================================================================
  3948. +--- a/gcc/configure
  3949. ++++ b/gcc/configure
  3950. +@@ -27449,6 +27453,9 @@
  3951. + gcc_cv_target_dl_iterate_phdr=no
  3952. + fi
  3953. + ;;
  3954. ++ *-linux-musl*)
  3955. ++ gcc_cv_target_dl_iterate_phdr=yes
  3956. ++ ;;
  3957. + esac
  3958. +
  3959. + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  3960. +Index: b/gcc/configure.ac
  3961. +===================================================================
  3962. +--- a/gcc/configure.ac
  3963. ++++ b/gcc/configure.ac
  3964. +@@ -5108,6 +5112,9 @@
  3965. + gcc_cv_target_dl_iterate_phdr=no
  3966. + fi
  3967. + ;;
  3968. ++ *-linux-musl*)
  3969. ++ gcc_cv_target_dl_iterate_phdr=yes
  3970. ++ ;;
  3971. + esac
  3972. + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
  3973. + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
  3974. +Index: b/gcc/ginclude/stddef.h
  3975. +===================================================================
  3976. +--- a/gcc/ginclude/stddef.h
  3977. ++++ b/gcc/ginclude/stddef.h
  3978. +@@ -181,6 +181,7 @@
  3979. + #ifndef _GCC_SIZE_T
  3980. + #ifndef _SIZET_
  3981. + #ifndef __size_t
  3982. ++#ifndef __DEFINED_size_t /* musl */
  3983. + #define __size_t__ /* BeOS */
  3984. + #define __SIZE_T__ /* Cray Unicos/Mk */
  3985. + #define _SIZE_T
  3986. +@@ -197,6 +198,7 @@
  3987. + #define ___int_size_t_h
  3988. + #define _GCC_SIZE_T
  3989. + #define _SIZET_
  3990. ++#define __DEFINED_size_t /* musl */
  3991. + #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
  3992. + || defined(__FreeBSD_kernel__)
  3993. + /* __size_t is a typedef on FreeBSD 5, must not trash it. */
  3994. +@@ -214,6 +216,7 @@
  3995. + typedef long ssize_t;
  3996. + #endif /* __BEOS__ */
  3997. + #endif /* !(defined (__GNUG__) && defined (size_t)) */
  3998. ++#endif /* __DEFINED_size_t */
  3999. + #endif /* __size_t */
  4000. + #endif /* _SIZET_ */
  4001. + #endif /* _GCC_SIZE_T */
  4002. +Index: b/libgcc/unwind-dw2-fde-dip.c
  4003. +===================================================================
  4004. +--- a/libgcc/unwind-dw2-fde-dip.c
  4005. ++++ b/libgcc/unwind-dw2-fde-dip.c
  4006. +@@ -73,6 +73,13 @@
  4007. + && defined(TARGET_DL_ITERATE_PHDR) \
  4008. + && defined(__sun__) && defined(__svr4__)
  4009. + # define USE_PT_GNU_EH_FRAME
  4010. ++ #endif
  4011. ++
  4012. ++/* For musl libc, TARGET_DL_ITERATE_PHDR gets defined by the configure
  4013. ++ script. */
  4014. ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
  4015. ++ && defined(TARGET_DL_ITERATE_PHDR)
  4016. ++# define USE_PT_GNU_EH_FRAME
  4017. + #endif
  4018. +
  4019. + #if defined(USE_PT_GNU_EH_FRAME)
  4020. +Index: b/libgomp/config/posix/time.c
  4021. +===================================================================
  4022. +--- a/libgomp/config/posix/time.c
  4023. ++++ b/libgomp/config/posix/time.c
  4024. +@@ -28,6 +28,8 @@
  4025. + The following implementation uses the most simple POSIX routines.
  4026. + If present, POSIX 4 clocks should be used instead. */
  4027. +
  4028. ++#define _POSIX_C_SOURCE 199309L /* for clocks */
  4029. ++
  4030. + #include "libgomp.h"
  4031. + #include <unistd.h>
  4032. + #if TIME_WITH_SYS_TIME
  4033. +Index: b/libitm/config/arm/hwcap.cc
  4034. +===================================================================
  4035. +--- a/libitm/config/arm/hwcap.cc
  4036. ++++ b/libitm/config/arm/hwcap.cc
  4037. +@@ -40,7 +40,11 @@
  4038. +
  4039. + #ifdef __linux__
  4040. + #include <unistd.h>
  4041. ++#ifdef __GLIBC__
  4042. + #include <sys/fcntl.h>
  4043. ++#else
  4044. ++#include <fcntl.h>
  4045. ++#endif
  4046. + #include <elf.h>
  4047. +
  4048. + static void __attribute__((constructor))
  4049. +Index: b/libitm/config/linux/x86/tls.h
  4050. +===================================================================
  4051. +--- a/libitm/config/linux/x86/tls.h
  4052. ++++ b/libitm/config/linux/x86/tls.h
  4053. +@@ -25,16 +25,19 @@
  4054. + #ifndef LIBITM_X86_TLS_H
  4055. + #define LIBITM_X86_TLS_H 1
  4056. +
  4057. +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  4058. ++#if defined(__GLIBC_PREREQ)
  4059. ++#if __GLIBC_PREREQ(2, 10)
  4060. + /* Use slots in the TCB head rather than __thread lookups.
  4061. + GLIBC has reserved words 10 through 13 for TM. */
  4062. + #define HAVE_ARCH_GTM_THREAD 1
  4063. + #define HAVE_ARCH_GTM_THREAD_DISP 1
  4064. + #endif
  4065. ++#endif
  4066. +
  4067. + #include "config/generic/tls.h"
  4068. +
  4069. +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
  4070. ++#if defined(__GLIBC_PREREQ)
  4071. ++#if __GLIBC_PREREQ(2, 10)
  4072. + namespace GTM HIDDEN {
  4073. +
  4074. + #ifdef __x86_64__
  4075. +@@ -101,5 +104,6 @@
  4076. +
  4077. + } // namespace GTM
  4078. + #endif /* >= GLIBC 2.10 */
  4079. ++#endif
  4080. +
  4081. + #endif // LIBITM_X86_TLS_H
  4082. +Index: b/libstdc++-v3/configure.host
  4083. +===================================================================
  4084. +--- a/libstdc++-v3/configure.host
  4085. ++++ b/libstdc++-v3/configure.host
  4086. +@@ -264,6 +264,13 @@
  4087. + os_include_dir="os/bsd/freebsd"
  4088. + ;;
  4089. + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
  4090. ++ # check for musl by target
  4091. ++ case "${host_os}" in
  4092. ++ *-musl*)
  4093. ++ os_include_dir="os/generic"
  4094. ++ ;;
  4095. ++ *)
  4096. ++
  4097. + if [ "$uclibc" = "yes" ]; then
  4098. + os_include_dir="os/uclibc"
  4099. + elif [ "$bionic" = "yes" ]; then
  4100. +@@ -272,6 +279,9 @@
  4101. + os_include_dir="os/gnu-linux"
  4102. + fi
  4103. + ;;
  4104. ++
  4105. ++ esac
  4106. ++ ;;
  4107. + hpux*)
  4108. + os_include_dir="os/hpux"
  4109. + ;;
  4110. +Index: b/gcc/config/mips/linux64.h
  4111. +===================================================================
  4112. +--- a/gcc/config/mips/linux64.h
  4113. ++++ b/gcc/config/mips/linux64.h
  4114. +@@ -41,4 +41,4 @@
  4115. + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
  4116. + #define GNU_USER_DYNAMIC_LINKERN32 \
  4117. + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
  4118. +- BIONIC_DYNAMIC_LINKERN32)
  4119. ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKER)
  4120. +Index: b/gcc/config/mips/linux.h
  4121. +===================================================================
  4122. +--- a/gcc/config/mips/linux.h
  4123. ++++ b/gcc/config/mips/linux.h
  4124. +@@ -23,3 +23,11 @@
  4125. + #undef UCLIBC_DYNAMIC_LINKER
  4126. + #define UCLIBC_DYNAMIC_LINKER \
  4127. + "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
  4128. ++
  4129. ++#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
  4130. ++#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}"
  4131. ++#else
  4132. ++#define MUSL_DYNAMIC_LINKER_E "%{EL:el}"
  4133. ++#endif
  4134. ++#undef MUSL_DYNAMIC_LINKER
  4135. ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
  4136. diff --git a/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch b/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch
  4137. new file mode 100644
  4138. index 0000000..df5372b
  4139. --- /dev/null
  4140. +++ b/package/gcc/4.9.3/920-libgcc-remove-unistd-header.patch
  4141. @@ -0,0 +1,12 @@
  4142. +Upstream status: In progress
  4143. +
  4144. +--- a/libgcc/config/nios2/linux-atomic.c
  4145. ++++ b/libgcc/config/nios2/linux-atomic.c
  4146. +@@ -20,7 +20,6 @@
  4147. + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  4148. + <http://www.gnu.org/licenses/>. */
  4149. +
  4150. +-#include <asm/unistd.h>
  4151. + #define EFAULT 14
  4152. + #define EBUSY 16
  4153. + #define ENOSYS 38
  4154. diff --git a/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch b/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch
  4155. new file mode 100644
  4156. index 0000000..670cf8d
  4157. --- /dev/null
  4158. +++ b/package/gcc/4.9.3/930-libgcc-disable-split-stack-nothreads.patch
  4159. @@ -0,0 +1,14 @@
  4160. +disable split-stack for non-thread builds
  4161. +
  4162. +Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
  4163. +
  4164. +diff -Nur gcc-4.9.3.orig/libgcc/config/t-stack gcc-4.9.3/libgcc/config/t-stack
  4165. +--- gcc-4.9.3.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200
  4166. ++++ gcc-4.9.3/libgcc/config/t-stack 2016-03-07 01:34:32.000000000 +0100
  4167. +@@ -1,4 +1,6 @@
  4168. + # Makefile fragment to provide generic support for -fsplit-stack.
  4169. + # This should be used in config.host for any host which supports
  4170. + # -fsplit-stack.
  4171. ++ifeq ($(enable_threads),yes)
  4172. + LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
  4173. ++endif
  4174. diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
  4175. index d204bf7..08a7272 100644
  4176. --- a/package/gcc/Config.in.host
  4177. +++ b/package/gcc/Config.in.host
  4178. @@ -36,6 +36,32 @@ choice
  4179. depends on BR2_arc
  4180. select BR2_TOOLCHAIN_GCC_AT_LEAST_6
  4181. + config BR2_GCC_VERSION_4_9_1
  4182. + bool "gcc 4.9.1"
  4183. + # Broken or unsupported architectures
  4184. + depends on !BR2_arc
  4185. + # Broken or unsupported ARM cores
  4186. + depends on !BR2_cortex_a17
  4187. + # Unsupported for MIPS R6
  4188. + depends on !BR2_mips_32r6 && !BR2_mips_64r6
  4189. + # PR60102 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60102
  4190. + select BR2_GCC_NEEDS_MPC
  4191. + select BR2_GCC_SUPPORTS_GRAPHITE
  4192. + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  4193. +
  4194. + config BR2_GCC_VERSION_4_9_3
  4195. + bool "gcc 4.9.3"
  4196. + # Broken or unsupported architectures
  4197. + depends on !BR2_arc
  4198. + # Broken or unsupported ARM cores
  4199. + depends on !BR2_cortex_a17
  4200. + # Unsupported for MIPS R6
  4201. + depends on !BR2_mips_32r6 && !BR2_mips_64r6
  4202. + # PR60102 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60102
  4203. + select BR2_GCC_NEEDS_MPC
  4204. + select BR2_GCC_SUPPORTS_GRAPHITE
  4205. + select BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  4206. +
  4207. config BR2_GCC_VERSION_4_9_X
  4208. bool "gcc 4.9.x"
  4209. # Broken or unsupported architectures
  4210. @@ -93,6 +119,8 @@ config BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
  4211. config BR2_GCC_VERSION
  4212. string
  4213. default "4.8.5" if BR2_GCC_VERSION_4_8_X
  4214. + default "4.9.1" if BR2_GCC_VERSION_4_9_1
  4215. + default "4.9.3" if BR2_GCC_VERSION_4_9_3
  4216. default "4.9.4" if BR2_GCC_VERSION_4_9_X
  4217. default "5.4.0" if BR2_GCC_VERSION_5_X
  4218. default "6.2.0" if BR2_GCC_VERSION_6_X
  4219. diff --git a/package/gcc/gcc.hash b/package/gcc/gcc.hash
  4220. index ce738ef..581bceb 100644
  4221. --- a/package/gcc/gcc.hash
  4222. +++ b/package/gcc/gcc.hash
  4223. @@ -4,6 +4,10 @@ sha512 78696b287d46aacd6f150920da376ea32f58ad9f0dafd2d3b7fa6dbdd8dd7afe659108d1
  4224. sha512 dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189 gcc-4.7.4.tar.bz2
  4225. # From ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.5/sha512.sum
  4226. sha512 47fdfeca0c0a624cdec9c4ae47137d056c918d5c386d4b96985bb3c8172aba377cb66cbcc30e80832fd244a7d98f562c20198056915c70cfef0977545073a8ea gcc-4.8.5.tar.bz2
  4227. +# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.1/sha512.sum
  4228. +sha512 8598106a4b7c03bb4d6e29fa1bfa9ee6b6390d1f1bca86c1ccd27aed830ae1d126daa50c4041016cbfa76090dd66c51f1ce06958b8ccd6c3be51eae875125593 gcc-4.9.1.tar.bz2
  4229. +# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.3/sha512.sum
  4230. +sha512 9ac57377a6975fc7adac704ec81355262b9f537def6955576753b87715470a20ee6a2a3144a79cc8fcba3443f7b44c7337d79d704b522d053f54f79aa6b442df gcc-4.9.3.tar.bz2
  4231. # From ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.4/sha512.sum
  4232. sha512 93abb78e16277454f41a8e9810f41f66c0fdffdc539a762ff6b67d3037f78db971378683fd2ebf707d1d51c059fad2161fe42d110c330027f40214b7db0f3efe gcc-4.9.4.tar.bz2
  4233. # From ftp://gcc.gnu.org/pub/gcc/releases/gcc-5.4.0/sha512.sum
  4234. diff --git a/package/glibc/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch b/package/glibc/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch
  4235. new file mode 100644
  4236. index 0000000..da2f49d
  4237. --- /dev/null
  4238. +++ b/package/glibc/glibc/2.18-svnr23787/0001-CVE-2014-7817-eglibc.patch
  4239. @@ -0,0 +1,174 @@
  4240. +From https://bugzilla.redhat.com/show_bug.cgi?id=1157689
  4241. +Modified for eglibc.
  4242. +
  4243. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4244. +
  4245. +WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
  4246. +EMBARGOED !!! EMBARGOED !!! EMARGOED !!! EMBARGOED !!! EMBARGOED !!!
  4247. +SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!!
  4248. +
  4249. +CVE-2014-7817:
  4250. +
  4251. +The function wordexp() fails to properly handle the WRDE_NOCMD
  4252. +flag when processing arithmetic inputs in the form of "$((... ``))"
  4253. +where "..." can be anything valid. The backticks in the arithmetic
  4254. +epxression are evaluated by in a shell even if WRDE_NOCMD forbade
  4255. +command substitution. This allows an attacker to attempt to pass
  4256. +dangerous commands via constructs of the above form, and bypass
  4257. +the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD
  4258. +in parse_arith(). The patch also hardens parse_backticks() and
  4259. +parse_comm() to check for WRDE_NOCMD flag and return an error instead
  4260. +of ever running a shell.
  4261. +
  4262. +We expand the testsuite and add 3 new regression tests of roughtly
  4263. +the same form but with a couple of nested levels.
  4264. +
  4265. +On top of the 3 new tests we add fork validation to the WRDE_NOCMD
  4266. +testing. If any forks are detected during the execution of a wordexp()
  4267. +call with WRDE_NOCMD, the test is marked as failed. This is slightly
  4268. +heuristic since vfork might be used, but it provides a higher level
  4269. +of assurance that no shells were executed as part of command substitution
  4270. +with WRDE_NOCMD in effect. In addition it doesn't require libpthread or
  4271. +libdl, instead we use the public implementation namespace function
  4272. +__register_atfork (already part of the public ABI for libpthread).
  4273. +
  4274. +Tested on x86_64 with no regressions.
  4275. +
  4276. +2014-10-27 Carlos O'Donell <carlos@redhat.com>
  4277. +
  4278. + * wordexp-test.c (__dso_handle): Add prototype.
  4279. + (__register_atfork): Likewise.
  4280. + (__app_register_atfork): New function.
  4281. + (registered_forks): New global.
  4282. + (register_fork): New function.
  4283. + (test_case): Add 3 new tests for WRDE_CMDSUB.
  4284. + (main): Call __app_register_atfork.
  4285. + (testit): If WRDE_NOCMD set registered_forks to zero, run test, and
  4286. + if fork count is non-zero fail the test.
  4287. + * posix/wordexp.c (parse_arith): Return WRDE_NOCMD if WRDE_NOCMD flag
  4288. + is set and parsing '`'.
  4289. + (parse_comm): Return WRDE_NOCMD if WRDE_NOCMD flag is set.
  4290. + (parse_backtick): Return WRDE_NOCMD if WRDE_NOCMD flag is set and
  4291. + parsing '`'.
  4292. +
  4293. +diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
  4294. +index 4957006..5ce2a1b 100644
  4295. +--- a/libc/posix/wordexp-test.c
  4296. ++++ b/libc/posix/wordexp-test.c
  4297. +@@ -27,6 +27,25 @@
  4298. +
  4299. + #define IFS " \n\t"
  4300. +
  4301. ++extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
  4302. ++extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
  4303. ++
  4304. ++static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
  4305. ++{
  4306. ++ return __register_atfork (prepare, parent, child,
  4307. ++ &__dso_handle == NULL ? NULL : __dso_handle);
  4308. ++}
  4309. ++
  4310. ++/* Number of forks seen. */
  4311. ++static int registered_forks;
  4312. ++
  4313. ++/* For each fork increment the fork count. */
  4314. ++static void
  4315. ++register_fork (void)
  4316. ++{
  4317. ++ registered_forks++;
  4318. ++}
  4319. ++
  4320. + struct test_case_struct
  4321. + {
  4322. + int retval;
  4323. +@@ -206,6 +225,12 @@ struct test_case_struct
  4324. + { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
  4325. + { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
  4326. + { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
  4327. ++ /* Test for CVE-2014-7817. We test 3 combinations of command
  4328. ++ substitution inside an arithmetic expression to make sure that
  4329. ++ no commands are executed and error is returned. */
  4330. ++ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4331. ++ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4332. ++ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4333. +
  4334. + { -1, NULL, NULL, 0, 0, { NULL, }, IFS },
  4335. + };
  4336. +@@ -258,6 +283,15 @@ main (int argc, char *argv[])
  4337. + return -1;
  4338. + }
  4339. +
  4340. ++ /* If we are not allowed to do command substitution, we install
  4341. ++ fork handlers to verify that no forks happened. No forks should
  4342. ++ happen at all if command substitution is disabled. */
  4343. ++ if (__app_register_atfork (register_fork, NULL, NULL) != 0)
  4344. ++ {
  4345. ++ printf ("Failed to register fork handler.\n");
  4346. ++ return -1;
  4347. ++ }
  4348. ++
  4349. + for (test = 0; test_case[test].retval != -1; test++)
  4350. + if (testit (&test_case[test]))
  4351. + ++fail;
  4352. +@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc)
  4353. +
  4354. + printf ("Test %d (%s): ", ++tests, tc->words);
  4355. +
  4356. ++ if (tc->flags & WRDE_NOCMD)
  4357. ++ registered_forks = 0;
  4358. ++
  4359. + if (tc->flags & WRDE_APPEND)
  4360. + {
  4361. + /* initial wordexp() call, to be appended to */
  4362. +@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc)
  4363. + }
  4364. + retval = wordexp (tc->words, &we, tc->flags);
  4365. +
  4366. ++ if ((tc->flags & WRDE_NOCMD)
  4367. ++ && (registered_forks > 0))
  4368. ++ {
  4369. ++ printf ("FAILED fork called for WRDE_NOCMD\n");
  4370. ++ return 1;
  4371. ++ }
  4372. ++
  4373. + if (tc->flags & WRDE_DOOFFS)
  4374. + start_offs = sav_we.we_offs;
  4375. +
  4376. +diff --git a/posix/wordexp.c b/posix/wordexp.c
  4377. +index b6b65dd..d6a158f 100644
  4378. +--- a/libc/posix/wordexp.c
  4379. ++++ b/libc/posix/wordexp.c
  4380. +@@ -693,6 +693,12 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
  4381. + break;
  4382. +
  4383. + case '`':
  4384. ++ if (flags & WRDE_NOCMD)
  4385. ++ {
  4386. ++ free (expr);
  4387. ++ return WRDE_NOCMD;
  4388. ++ }
  4389. ++
  4390. + (*offset)++;
  4391. + error = parse_backtick (&expr, &expr_length, &expr_maxlen,
  4392. + words, offset, flags, NULL, NULL, NULL);
  4393. +@@ -1144,6 +1150,10 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
  4394. + size_t comm_maxlen;
  4395. + char *comm = w_newword (&comm_length, &comm_maxlen);
  4396. +
  4397. ++ /* Do nothing if command substitution should not succeed. */
  4398. ++ if (flags & WRDE_NOCMD)
  4399. ++ return WRDE_CMDSUB;
  4400. ++
  4401. + for (; words[*offset]; ++(*offset))
  4402. + {
  4403. + switch (words[*offset])
  4404. +@@ -2121,6 +2131,9 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length,
  4405. + switch (words[*offset])
  4406. + {
  4407. + case '`':
  4408. ++ if (flags & WRDE_NOCMD)
  4409. ++ return WRDE_NOCMD;
  4410. ++
  4411. + /* Go -- give the script to the shell */
  4412. + error = exec_comm (comm, word, word_length, max_length, flags,
  4413. + pwordexp, ifs, ifs_white);
  4414. diff --git a/package/glibc/glibc/2.18-svnr23787/0002-accept-make4.patch b/package/glibc/glibc/2.18-svnr23787/0002-accept-make4.patch
  4415. new file mode 100644
  4416. index 0000000..4f426f2
  4417. --- /dev/null
  4418. +++ b/package/glibc/glibc/2.18-svnr23787/0002-accept-make4.patch
  4419. @@ -0,0 +1,33 @@
  4420. +Backport upstream patch (28d708c44bc47b56f6551ff285f78edcf61c208a) to accept
  4421. +make-4.0 or newer.
  4422. +We patch both configure and configure.in files so if we ever have to run
  4423. +autoreconf in the glibc source, then the fix will be propagated properly.
  4424. +
  4425. +Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
  4426. +
  4427. +Index: glibc-2.18-svnr23787/libc/configure
  4428. +===================================================================
  4429. +--- glibc-2.18-svnr23787.orig/libc/configure
  4430. ++++ glibc-2.18-svnr23787/libc/configure
  4431. +@@ -4772,7 +4772,7 @@ $as_echo_n "checking version of $MAKE...
  4432. + ac_prog_version=`$MAKE --version 2>&1 | sed -n 's/^.*GNU Make[^0-9]*\([0-9][0-9.]*\).*$/\1/p'`
  4433. + case $ac_prog_version in
  4434. + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  4435. +- 3.79* | 3.[89]*)
  4436. ++ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
  4437. + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  4438. + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  4439. +
  4440. +Index: glibc-2.18-svnr23787/libc/configure.in
  4441. +===================================================================
  4442. +--- glibc-2.18-svnr23787.orig/libc/configure.in
  4443. ++++ glibc-2.18-svnr23787/libc/configure.in
  4444. +@@ -989,7 +989,7 @@ AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}g
  4445. + critic_missing="$critic_missing gcc")
  4446. + AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
  4447. + [GNU Make[^0-9]*\([0-9][0-9.]*\)],
  4448. +- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
  4449. ++ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
  4450. +
  4451. + AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
  4452. + [GNU gettext.* \([0-9]*\.[0-9.]*\)],
  4453. diff --git a/package/glibc/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch b/package/glibc/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch
  4454. new file mode 100644
  4455. index 0000000..f447dcd
  4456. --- /dev/null
  4457. +++ b/package/glibc/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch
  4458. @@ -0,0 +1,141 @@
  4459. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=41488498b6
  4460. +See https://bugzilla.redhat.com/show_bug.cgi?id=1135841
  4461. +
  4462. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4463. +
  4464. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm1364.c eglibc-2.19/libc/iconvdata/ibm1364.c
  4465. +--- eglibc-2.19.orig/libc/iconvdata/ibm1364.c 2015-01-08 16:05:53.918823240 -0300
  4466. ++++ eglibc-2.19/libc/iconvdata/ibm1364.c 2015-01-08 16:06:02.781555143 -0300
  4467. +@@ -220,7 +220,8 @@
  4468. + ++rp2; \
  4469. + \
  4470. + uint32_t res; \
  4471. +- if (__builtin_expect (ch < rp2->start, 0) \
  4472. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4473. ++ || __builtin_expect (ch < rp2->start, 0) \
  4474. + || (res = DB_TO_UCS4[ch + rp2->idx], \
  4475. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4476. + { \
  4477. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm932.c eglibc-2.19/libc/iconvdata/ibm932.c
  4478. +--- eglibc-2.19.orig/libc/iconvdata/ibm932.c 2015-01-08 16:05:53.910818967 -0300
  4479. ++++ eglibc-2.19/libc/iconvdata/ibm932.c 2015-01-08 16:06:02.781555143 -0300
  4480. +@@ -73,11 +73,12 @@
  4481. + } \
  4482. + \
  4483. + ch = (ch * 0x100) + inptr[1]; \
  4484. ++ /* ch was less than 0xfd. */ \
  4485. ++ assert (ch < 0xfd00); \
  4486. + while (ch > rp2->end) \
  4487. + ++rp2; \
  4488. + \
  4489. +- if (__builtin_expect (rp2 == NULL, 0) \
  4490. +- || __builtin_expect (ch < rp2->start, 0) \
  4491. ++ if (__builtin_expect (ch < rp2->start, 0) \
  4492. + || (res = __ibm932db_to_ucs4[ch + rp2->idx], \
  4493. + __builtin_expect (res, '\1') == 0 && ch !=0)) \
  4494. + { \
  4495. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm933.c eglibc-2.19/libc/iconvdata/ibm933.c
  4496. +--- eglibc-2.19.orig/libc/iconvdata/ibm933.c 2015-01-08 16:05:53.917822706 -0300
  4497. ++++ eglibc-2.19/libc/iconvdata/ibm933.c 2015-01-08 16:06:02.781555143 -0300
  4498. +@@ -161,7 +161,7 @@
  4499. + while (ch > rp2->end) \
  4500. + ++rp2; \
  4501. + \
  4502. +- if (__builtin_expect (rp2 == NULL, 0) \
  4503. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4504. + || __builtin_expect (ch < rp2->start, 0) \
  4505. + || (res = __ibm933db_to_ucs4[ch + rp2->idx], \
  4506. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4507. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm935.c eglibc-2.19/libc/iconvdata/ibm935.c
  4508. +--- eglibc-2.19.orig/libc/iconvdata/ibm935.c 2015-01-08 16:05:53.921824843 -0300
  4509. ++++ eglibc-2.19/libc/iconvdata/ibm935.c 2015-01-08 16:06:02.782555677 -0300
  4510. +@@ -161,7 +161,7 @@
  4511. + while (ch > rp2->end) \
  4512. + ++rp2; \
  4513. + \
  4514. +- if (__builtin_expect (rp2 == NULL, 0) \
  4515. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4516. + || __builtin_expect (ch < rp2->start, 0) \
  4517. + || (res = __ibm935db_to_ucs4[ch + rp2->idx], \
  4518. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4519. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm937.c eglibc-2.19/libc/iconvdata/ibm937.c
  4520. +--- eglibc-2.19.orig/libc/iconvdata/ibm937.c 2015-01-08 16:05:53.915821638 -0300
  4521. ++++ eglibc-2.19/libc/iconvdata/ibm937.c 2015-01-08 16:06:02.782555677 -0300
  4522. +@@ -161,7 +161,7 @@
  4523. + while (ch > rp2->end) \
  4524. + ++rp2; \
  4525. + \
  4526. +- if (__builtin_expect (rp2 == NULL, 0) \
  4527. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4528. + || __builtin_expect (ch < rp2->start, 0) \
  4529. + || (res = __ibm937db_to_ucs4[ch + rp2->idx], \
  4530. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4531. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm939.c eglibc-2.19/libc/iconvdata/ibm939.c
  4532. +--- eglibc-2.19.orig/libc/iconvdata/ibm939.c 2015-01-08 16:05:53.917822706 -0300
  4533. ++++ eglibc-2.19/libc/iconvdata/ibm939.c 2015-01-08 16:06:02.782555677 -0300
  4534. +@@ -161,7 +161,7 @@
  4535. + while (ch > rp2->end) \
  4536. + ++rp2; \
  4537. + \
  4538. +- if (__builtin_expect (rp2 == NULL, 0) \
  4539. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4540. + || __builtin_expect (ch < rp2->start, 0) \
  4541. + || (res = __ibm939db_to_ucs4[ch + rp2->idx], \
  4542. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4543. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm943.c eglibc-2.19/libc/iconvdata/ibm943.c
  4544. +--- eglibc-2.19.orig/libc/iconvdata/ibm943.c 2015-01-08 16:05:53.918823240 -0300
  4545. ++++ eglibc-2.19/libc/iconvdata/ibm943.c 2015-01-08 16:06:02.782555677 -0300
  4546. +@@ -74,11 +74,12 @@
  4547. + } \
  4548. + \
  4549. + ch = (ch * 0x100) + inptr[1]; \
  4550. ++ /* ch was less than 0xfd. */ \
  4551. ++ assert (ch < 0xfd00); \
  4552. + while (ch > rp2->end) \
  4553. + ++rp2; \
  4554. + \
  4555. +- if (__builtin_expect (rp2 == NULL, 0) \
  4556. +- || __builtin_expect (ch < rp2->start, 0) \
  4557. ++ if (__builtin_expect (ch < rp2->start, 0) \
  4558. + || (res = __ibm943db_to_ucs4[ch + rp2->idx], \
  4559. + __builtin_expect (res, '\1') == 0 && ch !=0)) \
  4560. + { \
  4561. +diff -Nura eglibc-2.19.orig/libc/iconvdata/Makefile eglibc-2.19/libc/iconvdata/Makefile
  4562. +--- eglibc-2.19.orig/libc/iconvdata/Makefile 2015-01-08 16:05:53.903815227 -0300
  4563. ++++ eglibc-2.19/libc/iconvdata/Makefile 2015-01-08 16:06:02.782555677 -0300
  4564. +@@ -303,6 +303,7 @@
  4565. + $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
  4566. + $(addprefix $(objpfx),$(modules.so)) \
  4567. + $(common-objdir)/iconv/iconv_prog TESTS
  4568. ++ iconv_modules="$(modules)" \
  4569. + $(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@
  4570. +
  4571. + $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
  4572. +diff -Nura eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh eglibc-2.19/libc/iconvdata/run-iconv-test.sh
  4573. +--- eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:05:53.894810420 -0300
  4574. ++++ eglibc-2.19/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:06:02.782555677 -0300
  4575. +@@ -188,6 +188,24 @@
  4576. +
  4577. + done < TESTS2
  4578. +
  4579. ++# Check for crashes in decoders.
  4580. ++printf '\016\377\377\377\377\377\377\377' > $temp1
  4581. ++for from in $iconv_modules ; do
  4582. ++ echo $ac_n "test decoder $from $ac_c"
  4583. ++ PROG=`eval echo $ICONV`
  4584. ++ if $PROG < $temp1 >/dev/null 2>&1 ; then
  4585. ++ : # fall through
  4586. ++ else
  4587. ++ status=$?
  4588. ++ if test $status -gt 1 ; then
  4589. ++ echo "/FAILED"
  4590. ++ failed=1
  4591. ++ continue
  4592. ++ fi
  4593. ++ fi
  4594. ++ echo "OK"
  4595. ++done
  4596. ++
  4597. + exit $failed
  4598. + # Local Variables:
  4599. + # mode:shell-script
  4600. diff --git a/package/glibc/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch b/package/glibc/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch
  4601. new file mode 100644
  4602. index 0000000..c7aa12c
  4603. --- /dev/null
  4604. +++ b/package/glibc/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch
  4605. @@ -0,0 +1,20 @@
  4606. +Fix CVE-2014-9402 - denial of service in getnetbyname function.
  4607. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
  4608. +See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
  4609. +
  4610. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4611. +
  4612. +diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c
  4613. +--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:35.024977879 -0300
  4614. ++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:42.543992357 -0300
  4615. +@@ -398,8 +398,8 @@
  4616. +
  4617. + case BYNAME:
  4618. + {
  4619. +- char **ap = result->n_aliases++;
  4620. +- while (*ap != NULL)
  4621. ++ char **ap;
  4622. ++ for (ap = result->n_aliases; *ap != NULL; ++ap)
  4623. + {
  4624. + /* Check each alias name for being of the forms:
  4625. + 4.3.2.1.in-addr.arpa = net 1.2.3.4
  4626. diff --git a/package/glibc/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch b/package/glibc/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch
  4627. new file mode 100644
  4628. index 0000000..a0da626
  4629. --- /dev/null
  4630. +++ b/package/glibc/glibc/2.18-svnr23787/0005-CVE-2015-1472.patch
  4631. @@ -0,0 +1,88 @@
  4632. +Fix CVE-2015-1472 - heap buffer overflow in wscanf
  4633. +Backport from upstream:
  4634. +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5bd80bfe9ca0d955bfbbc002781bc7b01b6bcb06
  4635. +See: https://bugzilla.redhat.com/show_bug.cgi?id=1188235
  4636. +
  4637. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4638. +
  4639. +diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c
  4640. +index aece3f2..8a2eb9e 100644
  4641. +--- a/libc/stdio-common/tst-sscanf.c
  4642. ++++ b/libc/stdio-common/tst-sscanf.c
  4643. +@@ -233,5 +233,38 @@ main (void)
  4644. + }
  4645. + }
  4646. +
  4647. ++ /* BZ #16618
  4648. ++ The test will segfault during SSCANF if the buffer overflow
  4649. ++ is not fixed. The size of `s` is such that it forces the use
  4650. ++ of malloc internally and this triggers the incorrect computation.
  4651. ++ Thus the value for SIZE is arbitrariy high enough that malloc
  4652. ++ is used. */
  4653. ++ {
  4654. ++#define SIZE 131072
  4655. ++ CHAR *s = malloc ((SIZE + 1) * sizeof (*s));
  4656. ++ if (s == NULL)
  4657. ++ abort ();
  4658. ++ for (size_t i = 0; i < SIZE; i++)
  4659. ++ s[i] = L('0');
  4660. ++ s[SIZE] = L('\0');
  4661. ++ int i = 42;
  4662. ++ /* Scan multi-digit zero into `i`. */
  4663. ++ if (SSCANF (s, L("%d"), &i) != 1)
  4664. ++ {
  4665. ++ printf ("FAIL: bug16618: SSCANF did not read one input item.\n");
  4666. ++ result = 1;
  4667. ++ }
  4668. ++ if (i != 0)
  4669. ++ {
  4670. ++ printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n");
  4671. ++ result = 1;
  4672. ++ }
  4673. ++ free (s);
  4674. ++ if (result != 1)
  4675. ++ printf ("PASS: bug16618: Did not crash.\n");
  4676. ++#undef SIZE
  4677. ++ }
  4678. ++
  4679. ++
  4680. + return result;
  4681. + }
  4682. +diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
  4683. +index cd129a8..0e204e7 100644
  4684. +--- a/libc/stdio-common/vfscanf.c
  4685. ++++ b/libc/stdio-common/vfscanf.c
  4686. +@@ -272,9 +272,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
  4687. + if (__glibc_unlikely (wpsize == wpmax)) \
  4688. + { \
  4689. + CHAR_T *old = wp; \
  4690. +- size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \
  4691. +- ? UCHAR_MAX + 1 : 2 * wpmax); \
  4692. +- if (use_malloc || !__libc_use_alloca (newsize)) \
  4693. ++ bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); \
  4694. ++ size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax); \
  4695. ++ size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX; \
  4696. ++ if (!__libc_use_alloca (newsize)) \
  4697. + { \
  4698. + wp = realloc (use_malloc ? wp : NULL, newsize); \
  4699. + if (wp == NULL) \
  4700. +@@ -286,14 +287,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
  4701. + } \
  4702. + if (! use_malloc) \
  4703. + MEMCPY (wp, old, wpsize); \
  4704. +- wpmax = newsize; \
  4705. ++ wpmax = wpneed; \
  4706. + use_malloc = true; \
  4707. + } \
  4708. + else \
  4709. + { \
  4710. + size_t s = wpmax * sizeof (CHAR_T); \
  4711. +- wp = (CHAR_T *) extend_alloca (wp, s, \
  4712. +- newsize * sizeof (CHAR_T)); \
  4713. ++ wp = (CHAR_T *) extend_alloca (wp, s, newsize); \
  4714. + wpmax = s / sizeof (CHAR_T); \
  4715. + if (old != NULL) \
  4716. + MEMCPY (wp, old, wpsize); \
  4717. +--
  4718. +1.9.4
  4719. +
  4720. diff --git a/package/glibc/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch b/package/glibc/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch
  4721. new file mode 100644
  4722. index 0000000..da2f49d
  4723. --- /dev/null
  4724. +++ b/package/glibc/glibc/2.19-svnr25243/0001-CVE-2014-7817-eglibc.patch
  4725. @@ -0,0 +1,174 @@
  4726. +From https://bugzilla.redhat.com/show_bug.cgi?id=1157689
  4727. +Modified for eglibc.
  4728. +
  4729. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4730. +
  4731. +WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
  4732. +EMBARGOED !!! EMBARGOED !!! EMARGOED !!! EMBARGOED !!! EMBARGOED !!!
  4733. +SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!! SECURITY !!!
  4734. +
  4735. +CVE-2014-7817:
  4736. +
  4737. +The function wordexp() fails to properly handle the WRDE_NOCMD
  4738. +flag when processing arithmetic inputs in the form of "$((... ``))"
  4739. +where "..." can be anything valid. The backticks in the arithmetic
  4740. +epxression are evaluated by in a shell even if WRDE_NOCMD forbade
  4741. +command substitution. This allows an attacker to attempt to pass
  4742. +dangerous commands via constructs of the above form, and bypass
  4743. +the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD
  4744. +in parse_arith(). The patch also hardens parse_backticks() and
  4745. +parse_comm() to check for WRDE_NOCMD flag and return an error instead
  4746. +of ever running a shell.
  4747. +
  4748. +We expand the testsuite and add 3 new regression tests of roughtly
  4749. +the same form but with a couple of nested levels.
  4750. +
  4751. +On top of the 3 new tests we add fork validation to the WRDE_NOCMD
  4752. +testing. If any forks are detected during the execution of a wordexp()
  4753. +call with WRDE_NOCMD, the test is marked as failed. This is slightly
  4754. +heuristic since vfork might be used, but it provides a higher level
  4755. +of assurance that no shells were executed as part of command substitution
  4756. +with WRDE_NOCMD in effect. In addition it doesn't require libpthread or
  4757. +libdl, instead we use the public implementation namespace function
  4758. +__register_atfork (already part of the public ABI for libpthread).
  4759. +
  4760. +Tested on x86_64 with no regressions.
  4761. +
  4762. +2014-10-27 Carlos O'Donell <carlos@redhat.com>
  4763. +
  4764. + * wordexp-test.c (__dso_handle): Add prototype.
  4765. + (__register_atfork): Likewise.
  4766. + (__app_register_atfork): New function.
  4767. + (registered_forks): New global.
  4768. + (register_fork): New function.
  4769. + (test_case): Add 3 new tests for WRDE_CMDSUB.
  4770. + (main): Call __app_register_atfork.
  4771. + (testit): If WRDE_NOCMD set registered_forks to zero, run test, and
  4772. + if fork count is non-zero fail the test.
  4773. + * posix/wordexp.c (parse_arith): Return WRDE_NOCMD if WRDE_NOCMD flag
  4774. + is set and parsing '`'.
  4775. + (parse_comm): Return WRDE_NOCMD if WRDE_NOCMD flag is set.
  4776. + (parse_backtick): Return WRDE_NOCMD if WRDE_NOCMD flag is set and
  4777. + parsing '`'.
  4778. +
  4779. +diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
  4780. +index 4957006..5ce2a1b 100644
  4781. +--- a/libc/posix/wordexp-test.c
  4782. ++++ b/libc/posix/wordexp-test.c
  4783. +@@ -27,6 +27,25 @@
  4784. +
  4785. + #define IFS " \n\t"
  4786. +
  4787. ++extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
  4788. ++extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
  4789. ++
  4790. ++static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
  4791. ++{
  4792. ++ return __register_atfork (prepare, parent, child,
  4793. ++ &__dso_handle == NULL ? NULL : __dso_handle);
  4794. ++}
  4795. ++
  4796. ++/* Number of forks seen. */
  4797. ++static int registered_forks;
  4798. ++
  4799. ++/* For each fork increment the fork count. */
  4800. ++static void
  4801. ++register_fork (void)
  4802. ++{
  4803. ++ registered_forks++;
  4804. ++}
  4805. ++
  4806. + struct test_case_struct
  4807. + {
  4808. + int retval;
  4809. +@@ -206,6 +225,12 @@ struct test_case_struct
  4810. + { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
  4811. + { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
  4812. + { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
  4813. ++ /* Test for CVE-2014-7817. We test 3 combinations of command
  4814. ++ substitution inside an arithmetic expression to make sure that
  4815. ++ no commands are executed and error is returned. */
  4816. ++ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4817. ++ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4818. ++ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
  4819. +
  4820. + { -1, NULL, NULL, 0, 0, { NULL, }, IFS },
  4821. + };
  4822. +@@ -258,6 +283,15 @@ main (int argc, char *argv[])
  4823. + return -1;
  4824. + }
  4825. +
  4826. ++ /* If we are not allowed to do command substitution, we install
  4827. ++ fork handlers to verify that no forks happened. No forks should
  4828. ++ happen at all if command substitution is disabled. */
  4829. ++ if (__app_register_atfork (register_fork, NULL, NULL) != 0)
  4830. ++ {
  4831. ++ printf ("Failed to register fork handler.\n");
  4832. ++ return -1;
  4833. ++ }
  4834. ++
  4835. + for (test = 0; test_case[test].retval != -1; test++)
  4836. + if (testit (&test_case[test]))
  4837. + ++fail;
  4838. +@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc)
  4839. +
  4840. + printf ("Test %d (%s): ", ++tests, tc->words);
  4841. +
  4842. ++ if (tc->flags & WRDE_NOCMD)
  4843. ++ registered_forks = 0;
  4844. ++
  4845. + if (tc->flags & WRDE_APPEND)
  4846. + {
  4847. + /* initial wordexp() call, to be appended to */
  4848. +@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc)
  4849. + }
  4850. + retval = wordexp (tc->words, &we, tc->flags);
  4851. +
  4852. ++ if ((tc->flags & WRDE_NOCMD)
  4853. ++ && (registered_forks > 0))
  4854. ++ {
  4855. ++ printf ("FAILED fork called for WRDE_NOCMD\n");
  4856. ++ return 1;
  4857. ++ }
  4858. ++
  4859. + if (tc->flags & WRDE_DOOFFS)
  4860. + start_offs = sav_we.we_offs;
  4861. +
  4862. +diff --git a/posix/wordexp.c b/posix/wordexp.c
  4863. +index b6b65dd..d6a158f 100644
  4864. +--- a/libc/posix/wordexp.c
  4865. ++++ b/libc/posix/wordexp.c
  4866. +@@ -693,6 +693,12 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
  4867. + break;
  4868. +
  4869. + case '`':
  4870. ++ if (flags & WRDE_NOCMD)
  4871. ++ {
  4872. ++ free (expr);
  4873. ++ return WRDE_NOCMD;
  4874. ++ }
  4875. ++
  4876. + (*offset)++;
  4877. + error = parse_backtick (&expr, &expr_length, &expr_maxlen,
  4878. + words, offset, flags, NULL, NULL, NULL);
  4879. +@@ -1144,6 +1150,10 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
  4880. + size_t comm_maxlen;
  4881. + char *comm = w_newword (&comm_length, &comm_maxlen);
  4882. +
  4883. ++ /* Do nothing if command substitution should not succeed. */
  4884. ++ if (flags & WRDE_NOCMD)
  4885. ++ return WRDE_CMDSUB;
  4886. ++
  4887. + for (; words[*offset]; ++(*offset))
  4888. + {
  4889. + switch (words[*offset])
  4890. +@@ -2121,6 +2131,9 @@ parse_backtick (char **word, size_t *word_length, size_t *max_length,
  4891. + switch (words[*offset])
  4892. + {
  4893. + case '`':
  4894. ++ if (flags & WRDE_NOCMD)
  4895. ++ return WRDE_NOCMD;
  4896. ++
  4897. + /* Go -- give the script to the shell */
  4898. + error = exec_comm (comm, word, word_length, max_length, flags,
  4899. + pwordexp, ifs, ifs_white);
  4900. diff --git a/package/glibc/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch b/package/glibc/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch
  4901. new file mode 100644
  4902. index 0000000..f447dcd
  4903. --- /dev/null
  4904. +++ b/package/glibc/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch
  4905. @@ -0,0 +1,141 @@
  4906. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=41488498b6
  4907. +See https://bugzilla.redhat.com/show_bug.cgi?id=1135841
  4908. +
  4909. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  4910. +
  4911. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm1364.c eglibc-2.19/libc/iconvdata/ibm1364.c
  4912. +--- eglibc-2.19.orig/libc/iconvdata/ibm1364.c 2015-01-08 16:05:53.918823240 -0300
  4913. ++++ eglibc-2.19/libc/iconvdata/ibm1364.c 2015-01-08 16:06:02.781555143 -0300
  4914. +@@ -220,7 +220,8 @@
  4915. + ++rp2; \
  4916. + \
  4917. + uint32_t res; \
  4918. +- if (__builtin_expect (ch < rp2->start, 0) \
  4919. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4920. ++ || __builtin_expect (ch < rp2->start, 0) \
  4921. + || (res = DB_TO_UCS4[ch + rp2->idx], \
  4922. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4923. + { \
  4924. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm932.c eglibc-2.19/libc/iconvdata/ibm932.c
  4925. +--- eglibc-2.19.orig/libc/iconvdata/ibm932.c 2015-01-08 16:05:53.910818967 -0300
  4926. ++++ eglibc-2.19/libc/iconvdata/ibm932.c 2015-01-08 16:06:02.781555143 -0300
  4927. +@@ -73,11 +73,12 @@
  4928. + } \
  4929. + \
  4930. + ch = (ch * 0x100) + inptr[1]; \
  4931. ++ /* ch was less than 0xfd. */ \
  4932. ++ assert (ch < 0xfd00); \
  4933. + while (ch > rp2->end) \
  4934. + ++rp2; \
  4935. + \
  4936. +- if (__builtin_expect (rp2 == NULL, 0) \
  4937. +- || __builtin_expect (ch < rp2->start, 0) \
  4938. ++ if (__builtin_expect (ch < rp2->start, 0) \
  4939. + || (res = __ibm932db_to_ucs4[ch + rp2->idx], \
  4940. + __builtin_expect (res, '\1') == 0 && ch !=0)) \
  4941. + { \
  4942. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm933.c eglibc-2.19/libc/iconvdata/ibm933.c
  4943. +--- eglibc-2.19.orig/libc/iconvdata/ibm933.c 2015-01-08 16:05:53.917822706 -0300
  4944. ++++ eglibc-2.19/libc/iconvdata/ibm933.c 2015-01-08 16:06:02.781555143 -0300
  4945. +@@ -161,7 +161,7 @@
  4946. + while (ch > rp2->end) \
  4947. + ++rp2; \
  4948. + \
  4949. +- if (__builtin_expect (rp2 == NULL, 0) \
  4950. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4951. + || __builtin_expect (ch < rp2->start, 0) \
  4952. + || (res = __ibm933db_to_ucs4[ch + rp2->idx], \
  4953. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4954. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm935.c eglibc-2.19/libc/iconvdata/ibm935.c
  4955. +--- eglibc-2.19.orig/libc/iconvdata/ibm935.c 2015-01-08 16:05:53.921824843 -0300
  4956. ++++ eglibc-2.19/libc/iconvdata/ibm935.c 2015-01-08 16:06:02.782555677 -0300
  4957. +@@ -161,7 +161,7 @@
  4958. + while (ch > rp2->end) \
  4959. + ++rp2; \
  4960. + \
  4961. +- if (__builtin_expect (rp2 == NULL, 0) \
  4962. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4963. + || __builtin_expect (ch < rp2->start, 0) \
  4964. + || (res = __ibm935db_to_ucs4[ch + rp2->idx], \
  4965. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4966. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm937.c eglibc-2.19/libc/iconvdata/ibm937.c
  4967. +--- eglibc-2.19.orig/libc/iconvdata/ibm937.c 2015-01-08 16:05:53.915821638 -0300
  4968. ++++ eglibc-2.19/libc/iconvdata/ibm937.c 2015-01-08 16:06:02.782555677 -0300
  4969. +@@ -161,7 +161,7 @@
  4970. + while (ch > rp2->end) \
  4971. + ++rp2; \
  4972. + \
  4973. +- if (__builtin_expect (rp2 == NULL, 0) \
  4974. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4975. + || __builtin_expect (ch < rp2->start, 0) \
  4976. + || (res = __ibm937db_to_ucs4[ch + rp2->idx], \
  4977. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4978. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm939.c eglibc-2.19/libc/iconvdata/ibm939.c
  4979. +--- eglibc-2.19.orig/libc/iconvdata/ibm939.c 2015-01-08 16:05:53.917822706 -0300
  4980. ++++ eglibc-2.19/libc/iconvdata/ibm939.c 2015-01-08 16:06:02.782555677 -0300
  4981. +@@ -161,7 +161,7 @@
  4982. + while (ch > rp2->end) \
  4983. + ++rp2; \
  4984. + \
  4985. +- if (__builtin_expect (rp2 == NULL, 0) \
  4986. ++ if (__builtin_expect (rp2->start == 0xffff, 0) \
  4987. + || __builtin_expect (ch < rp2->start, 0) \
  4988. + || (res = __ibm939db_to_ucs4[ch + rp2->idx], \
  4989. + __builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
  4990. +diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm943.c eglibc-2.19/libc/iconvdata/ibm943.c
  4991. +--- eglibc-2.19.orig/libc/iconvdata/ibm943.c 2015-01-08 16:05:53.918823240 -0300
  4992. ++++ eglibc-2.19/libc/iconvdata/ibm943.c 2015-01-08 16:06:02.782555677 -0300
  4993. +@@ -74,11 +74,12 @@
  4994. + } \
  4995. + \
  4996. + ch = (ch * 0x100) + inptr[1]; \
  4997. ++ /* ch was less than 0xfd. */ \
  4998. ++ assert (ch < 0xfd00); \
  4999. + while (ch > rp2->end) \
  5000. + ++rp2; \
  5001. + \
  5002. +- if (__builtin_expect (rp2 == NULL, 0) \
  5003. +- || __builtin_expect (ch < rp2->start, 0) \
  5004. ++ if (__builtin_expect (ch < rp2->start, 0) \
  5005. + || (res = __ibm943db_to_ucs4[ch + rp2->idx], \
  5006. + __builtin_expect (res, '\1') == 0 && ch !=0)) \
  5007. + { \
  5008. +diff -Nura eglibc-2.19.orig/libc/iconvdata/Makefile eglibc-2.19/libc/iconvdata/Makefile
  5009. +--- eglibc-2.19.orig/libc/iconvdata/Makefile 2015-01-08 16:05:53.903815227 -0300
  5010. ++++ eglibc-2.19/libc/iconvdata/Makefile 2015-01-08 16:06:02.782555677 -0300
  5011. +@@ -303,6 +303,7 @@
  5012. + $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
  5013. + $(addprefix $(objpfx),$(modules.so)) \
  5014. + $(common-objdir)/iconv/iconv_prog TESTS
  5015. ++ iconv_modules="$(modules)" \
  5016. + $(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@
  5017. +
  5018. + $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
  5019. +diff -Nura eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh eglibc-2.19/libc/iconvdata/run-iconv-test.sh
  5020. +--- eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:05:53.894810420 -0300
  5021. ++++ eglibc-2.19/libc/iconvdata/run-iconv-test.sh 2015-01-08 16:06:02.782555677 -0300
  5022. +@@ -188,6 +188,24 @@
  5023. +
  5024. + done < TESTS2
  5025. +
  5026. ++# Check for crashes in decoders.
  5027. ++printf '\016\377\377\377\377\377\377\377' > $temp1
  5028. ++for from in $iconv_modules ; do
  5029. ++ echo $ac_n "test decoder $from $ac_c"
  5030. ++ PROG=`eval echo $ICONV`
  5031. ++ if $PROG < $temp1 >/dev/null 2>&1 ; then
  5032. ++ : # fall through
  5033. ++ else
  5034. ++ status=$?
  5035. ++ if test $status -gt 1 ; then
  5036. ++ echo "/FAILED"
  5037. ++ failed=1
  5038. ++ continue
  5039. ++ fi
  5040. ++ fi
  5041. ++ echo "OK"
  5042. ++done
  5043. ++
  5044. + exit $failed
  5045. + # Local Variables:
  5046. + # mode:shell-script
  5047. diff --git a/package/glibc/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch b/package/glibc/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch
  5048. new file mode 100644
  5049. index 0000000..c7aa12c
  5050. --- /dev/null
  5051. +++ b/package/glibc/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch
  5052. @@ -0,0 +1,20 @@
  5053. +Fix CVE-2014-9402 - denial of service in getnetbyname function.
  5054. +Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
  5055. +See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
  5056. +
  5057. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  5058. +
  5059. +diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c
  5060. +--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:35.024977879 -0300
  5061. ++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c 2015-01-08 16:12:42.543992357 -0300
  5062. +@@ -398,8 +398,8 @@
  5063. +
  5064. + case BYNAME:
  5065. + {
  5066. +- char **ap = result->n_aliases++;
  5067. +- while (*ap != NULL)
  5068. ++ char **ap;
  5069. ++ for (ap = result->n_aliases; *ap != NULL; ++ap)
  5070. + {
  5071. + /* Check each alias name for being of the forms:
  5072. + 4.3.2.1.in-addr.arpa = net 1.2.3.4
  5073. diff --git a/package/glibc/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch b/package/glibc/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch
  5074. new file mode 100644
  5075. index 0000000..a0da626
  5076. --- /dev/null
  5077. +++ b/package/glibc/glibc/2.19-svnr25243/0004-CVE-2015-1472.patch
  5078. @@ -0,0 +1,88 @@
  5079. +Fix CVE-2015-1472 - heap buffer overflow in wscanf
  5080. +Backport from upstream:
  5081. +https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5bd80bfe9ca0d955bfbbc002781bc7b01b6bcb06
  5082. +See: https://bugzilla.redhat.com/show_bug.cgi?id=1188235
  5083. +
  5084. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  5085. +
  5086. +diff --git a/stdio-common/tst-sscanf.c b/stdio-common/tst-sscanf.c
  5087. +index aece3f2..8a2eb9e 100644
  5088. +--- a/libc/stdio-common/tst-sscanf.c
  5089. ++++ b/libc/stdio-common/tst-sscanf.c
  5090. +@@ -233,5 +233,38 @@ main (void)
  5091. + }
  5092. + }
  5093. +
  5094. ++ /* BZ #16618
  5095. ++ The test will segfault during SSCANF if the buffer overflow
  5096. ++ is not fixed. The size of `s` is such that it forces the use
  5097. ++ of malloc internally and this triggers the incorrect computation.
  5098. ++ Thus the value for SIZE is arbitrariy high enough that malloc
  5099. ++ is used. */
  5100. ++ {
  5101. ++#define SIZE 131072
  5102. ++ CHAR *s = malloc ((SIZE + 1) * sizeof (*s));
  5103. ++ if (s == NULL)
  5104. ++ abort ();
  5105. ++ for (size_t i = 0; i < SIZE; i++)
  5106. ++ s[i] = L('0');
  5107. ++ s[SIZE] = L('\0');
  5108. ++ int i = 42;
  5109. ++ /* Scan multi-digit zero into `i`. */
  5110. ++ if (SSCANF (s, L("%d"), &i) != 1)
  5111. ++ {
  5112. ++ printf ("FAIL: bug16618: SSCANF did not read one input item.\n");
  5113. ++ result = 1;
  5114. ++ }
  5115. ++ if (i != 0)
  5116. ++ {
  5117. ++ printf ("FAIL: bug16618: Value of `i` was not zero as expected.\n");
  5118. ++ result = 1;
  5119. ++ }
  5120. ++ free (s);
  5121. ++ if (result != 1)
  5122. ++ printf ("PASS: bug16618: Did not crash.\n");
  5123. ++#undef SIZE
  5124. ++ }
  5125. ++
  5126. ++
  5127. + return result;
  5128. + }
  5129. +diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
  5130. +index cd129a8..0e204e7 100644
  5131. +--- a/libc/stdio-common/vfscanf.c
  5132. ++++ b/libc/stdio-common/vfscanf.c
  5133. +@@ -272,9 +272,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
  5134. + if (__glibc_unlikely (wpsize == wpmax)) \
  5135. + { \
  5136. + CHAR_T *old = wp; \
  5137. +- size_t newsize = (UCHAR_MAX + 1 > 2 * wpmax \
  5138. +- ? UCHAR_MAX + 1 : 2 * wpmax); \
  5139. +- if (use_malloc || !__libc_use_alloca (newsize)) \
  5140. ++ bool fits = __glibc_likely (wpmax <= SIZE_MAX / sizeof (CHAR_T) / 2); \
  5141. ++ size_t wpneed = MAX (UCHAR_MAX + 1, 2 * wpmax); \
  5142. ++ size_t newsize = fits ? wpneed * sizeof (CHAR_T) : SIZE_MAX; \
  5143. ++ if (!__libc_use_alloca (newsize)) \
  5144. + { \
  5145. + wp = realloc (use_malloc ? wp : NULL, newsize); \
  5146. + if (wp == NULL) \
  5147. +@@ -286,14 +287,13 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
  5148. + } \
  5149. + if (! use_malloc) \
  5150. + MEMCPY (wp, old, wpsize); \
  5151. +- wpmax = newsize; \
  5152. ++ wpmax = wpneed; \
  5153. + use_malloc = true; \
  5154. + } \
  5155. + else \
  5156. + { \
  5157. + size_t s = wpmax * sizeof (CHAR_T); \
  5158. +- wp = (CHAR_T *) extend_alloca (wp, s, \
  5159. +- newsize * sizeof (CHAR_T)); \
  5160. ++ wp = (CHAR_T *) extend_alloca (wp, s, newsize); \
  5161. + wpmax = s / sizeof (CHAR_T); \
  5162. + if (old != NULL) \
  5163. + MEMCPY (wp, old, wpsize); \
  5164. +--
  5165. +1.9.4
  5166. +
  5167. diff --git a/package/glibc/glibc/2.22/0001-fix-CVE-2015-7547.patch b/package/glibc/glibc/2.22/0001-fix-CVE-2015-7547.patch
  5168. new file mode 100644
  5169. index 0000000..19b8b6e
  5170. --- /dev/null
  5171. +++ b/package/glibc/glibc/2.22/0001-fix-CVE-2015-7547.patch
  5172. @@ -0,0 +1,236 @@
  5173. +Fetched from gentoo glibc patchball
  5174. +Original patch filename: 10_all_glibc-CVE-2015-7547.patch
  5175. +Based on: https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
  5176. +
  5177. +Fixes:
  5178. +CVE-2015-7547 - glibc getaddrinfo stack-based buffer overflow.
  5179. +
  5180. +Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  5181. +
  5182. +--- a/resolv/nss_dns/dns-host.c
  5183. ++++ b/resolv/nss_dns/dns-host.c
  5184. +@@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
  5185. + int h_namelen = 0;
  5186. +
  5187. + if (ancount == 0)
  5188. +- return NSS_STATUS_NOTFOUND;
  5189. ++ {
  5190. ++ *h_errnop = HOST_NOT_FOUND;
  5191. ++ return NSS_STATUS_NOTFOUND;
  5192. ++ }
  5193. +
  5194. + while (ancount-- > 0 && cp < end_of_message && had_error == 0)
  5195. + {
  5196. +@@ -1208,7 +1211,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
  5197. + /* Special case here: if the resolver sent a result but it only
  5198. + contains a CNAME while we are looking for a T_A or T_AAAA record,
  5199. + we fail with NOTFOUND instead of TRYAGAIN. */
  5200. +- return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND;
  5201. ++ if (canon != NULL)
  5202. ++ {
  5203. ++ *h_errnop = HOST_NOT_FOUND;
  5204. ++ return NSS_STATUS_NOTFOUND;
  5205. ++ }
  5206. ++
  5207. ++ *h_errnop = NETDB_INTERNAL;
  5208. ++ return NSS_STATUS_TRYAGAIN;
  5209. + }
  5210. +
  5211. +
  5212. +@@ -1242,8 +1252,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
  5213. + &pat, &buffer, &buflen,
  5214. + errnop, h_errnop, ttlp,
  5215. + &first);
  5216. ++ /* Use the second response status in some cases. */
  5217. + if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
  5218. + status = status2;
  5219. ++ /* Do not return a truncated second response (unless it was
  5220. ++ unavoidable e.g. unrecoverable TRYAGAIN). */
  5221. ++ if (status == NSS_STATUS_SUCCESS
  5222. ++ && (status2 == NSS_STATUS_TRYAGAIN
  5223. ++ && *errnop == ERANGE && *h_errnop != NO_RECOVERY))
  5224. ++ status = NSS_STATUS_TRYAGAIN;
  5225. + }
  5226. +
  5227. + return status;
  5228. +--- a/resolv/res_query.c
  5229. ++++ b/resolv/res_query.c
  5230. +@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
  5231. + {
  5232. + free (*answerp2);
  5233. + *answerp2 = NULL;
  5234. ++ *nanswerp2 = 0;
  5235. + *answerp2_malloced = 0;
  5236. + }
  5237. + }
  5238. +@@ -447,6 +448,7 @@ __libc_res_nsearch(res_state statp,
  5239. + {
  5240. + free (*answerp2);
  5241. + *answerp2 = NULL;
  5242. ++ *nanswerp2 = 0;
  5243. + *answerp2_malloced = 0;
  5244. + }
  5245. +
  5246. +@@ -521,6 +523,7 @@ __libc_res_nsearch(res_state statp,
  5247. + {
  5248. + free (*answerp2);
  5249. + *answerp2 = NULL;
  5250. ++ *nanswerp2 = 0;
  5251. + *answerp2_malloced = 0;
  5252. + }
  5253. + if (saved_herrno != -1)
  5254. +--- a/resolv/res_send.c
  5255. ++++ b/resolv/res_send.c
  5256. +@@ -639,11 +639,7 @@ send_vc(res_state statp,
  5257. + {
  5258. + const HEADER *hp = (HEADER *) buf;
  5259. + const HEADER *hp2 = (HEADER *) buf2;
  5260. +- u_char *ans = *ansp;
  5261. +- int orig_anssizp = *anssizp;
  5262. +- // XXX REMOVE
  5263. +- // int anssiz = *anssizp;
  5264. +- HEADER *anhp = (HEADER *) ans;
  5265. ++ HEADER *anhp = (HEADER *) *ansp;
  5266. + struct sockaddr *nsap = get_nsaddr (statp, ns);
  5267. + int truncating, connreset, n;
  5268. + /* On some architectures compiler might emit a warning indicating
  5269. +@@ -767,35 +763,6 @@ send_vc(res_state statp,
  5270. + assert (anscp != NULL || ansp2 == NULL);
  5271. + thisresplenp = &resplen;
  5272. + } else {
  5273. +- if (*anssizp != MAXPACKET) {
  5274. +- /* No buffer allocated for the first
  5275. +- reply. We can try to use the rest
  5276. +- of the user-provided buffer. */
  5277. +-#if __GNUC_PREREQ (4, 7)
  5278. +- DIAG_PUSH_NEEDS_COMMENT;
  5279. +- DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
  5280. +-#endif
  5281. +-#if _STRING_ARCH_unaligned
  5282. +- *anssizp2 = orig_anssizp - resplen;
  5283. +- *ansp2 = *ansp + resplen;
  5284. +-#else
  5285. +- int aligned_resplen
  5286. +- = ((resplen + __alignof__ (HEADER) - 1)
  5287. +- & ~(__alignof__ (HEADER) - 1));
  5288. +- *anssizp2 = orig_anssizp - aligned_resplen;
  5289. +- *ansp2 = *ansp + aligned_resplen;
  5290. +-#endif
  5291. +-#if __GNUC_PREREQ (4, 7)
  5292. +- DIAG_POP_NEEDS_COMMENT;
  5293. +-#endif
  5294. +- } else {
  5295. +- /* The first reply did not fit into the
  5296. +- user-provided buffer. Maybe the second
  5297. +- answer will. */
  5298. +- *anssizp2 = orig_anssizp;
  5299. +- *ansp2 = *ansp;
  5300. +- }
  5301. +-
  5302. + thisanssizp = anssizp2;
  5303. + thisansp = ansp2;
  5304. + thisresplenp = resplen2;
  5305. +@@ -804,10 +771,14 @@ send_vc(res_state statp,
  5306. + anhp = (HEADER *) *thisansp;
  5307. +
  5308. + *thisresplenp = rlen;
  5309. +- if (rlen > *thisanssizp) {
  5310. +- /* Yes, we test ANSCP here. If we have two buffers
  5311. +- both will be allocatable. */
  5312. +- if (__glibc_likely (anscp != NULL)) {
  5313. ++ /* Is the answer buffer too small? */
  5314. ++ if (*thisanssizp < rlen) {
  5315. ++ /* If the current buffer is not the the static
  5316. ++ user-supplied buffer then we can reallocate
  5317. ++ it. */
  5318. ++ if (thisansp != NULL && thisansp != ansp) {
  5319. ++ /* Always allocate MAXPACKET, callers expect
  5320. ++ this specific size. */
  5321. + u_char *newp = malloc (MAXPACKET);
  5322. + if (newp == NULL) {
  5323. + *terrno = ENOMEM;
  5324. +@@ -957,8 +928,6 @@ send_dg(res_state statp,
  5325. + {
  5326. + const HEADER *hp = (HEADER *) buf;
  5327. + const HEADER *hp2 = (HEADER *) buf2;
  5328. +- u_char *ans = *ansp;
  5329. +- int orig_anssizp = *anssizp;
  5330. + struct timespec now, timeout, finish;
  5331. + struct pollfd pfd[1];
  5332. + int ptimeout;
  5333. +@@ -1154,50 +1123,48 @@ send_dg(res_state statp,
  5334. + assert (anscp != NULL || ansp2 == NULL);
  5335. + thisresplenp = &resplen;
  5336. + } else {
  5337. +- if (*anssizp != MAXPACKET) {
  5338. +- /* No buffer allocated for the first
  5339. +- reply. We can try to use the rest
  5340. +- of the user-provided buffer. */
  5341. +-#if _STRING_ARCH_unaligned
  5342. +- *anssizp2 = orig_anssizp - resplen;
  5343. +- *ansp2 = *ansp + resplen;
  5344. +-#else
  5345. +- int aligned_resplen
  5346. +- = ((resplen + __alignof__ (HEADER) - 1)
  5347. +- & ~(__alignof__ (HEADER) - 1));
  5348. +- *anssizp2 = orig_anssizp - aligned_resplen;
  5349. +- *ansp2 = *ansp + aligned_resplen;
  5350. +-#endif
  5351. +- } else {
  5352. +- /* The first reply did not fit into the
  5353. +- user-provided buffer. Maybe the second
  5354. +- answer will. */
  5355. +- *anssizp2 = orig_anssizp;
  5356. +- *ansp2 = *ansp;
  5357. +- }
  5358. +-
  5359. + thisanssizp = anssizp2;
  5360. + thisansp = ansp2;
  5361. + thisresplenp = resplen2;
  5362. + }
  5363. +
  5364. + if (*thisanssizp < MAXPACKET
  5365. +- /* Yes, we test ANSCP here. If we have two buffers
  5366. +- both will be allocatable. */
  5367. +- && anscp
  5368. ++ /* If the current buffer is not the the static
  5369. ++ user-supplied buffer then we can reallocate
  5370. ++ it. */
  5371. ++ && (thisansp != NULL && thisansp != ansp)
  5372. + #ifdef FIONREAD
  5373. ++ /* Is the size too small? */
  5374. + && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
  5375. + || *thisanssizp < *thisresplenp)
  5376. + #endif
  5377. + ) {
  5378. ++ /* Always allocate MAXPACKET, callers expect
  5379. ++ this specific size. */
  5380. + u_char *newp = malloc (MAXPACKET);
  5381. + if (newp != NULL) {
  5382. +- *anssizp = MAXPACKET;
  5383. +- *thisansp = ans = newp;
  5384. ++ *thisanssizp = MAXPACKET;
  5385. ++ *thisansp = newp;
  5386. + if (thisansp == ansp2)
  5387. + *ansp2_malloced = 1;
  5388. + }
  5389. + }
  5390. ++ /* We could end up with truncation if anscp was NULL
  5391. ++ (not allowed to change caller's buffer) and the
  5392. ++ response buffer size is too small. This isn't a
  5393. ++ reliable way to detect truncation because the ioctl
  5394. ++ may be an inaccurate report of the UDP message size.
  5395. ++ Therefore we use this only to issue debug output.
  5396. ++ To do truncation accurately with UDP we need
  5397. ++ MSG_TRUNC which is only available on Linux. We
  5398. ++ can abstract out the Linux-specific feature in the
  5399. ++ future to detect truncation. */
  5400. ++ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
  5401. ++ Dprint(statp->options & RES_DEBUG,
  5402. ++ (stdout, ";; response may be truncated (UDP)\n")
  5403. ++ );
  5404. ++ }
  5405. ++
  5406. + HEADER *anhp = (HEADER *) *thisansp;
  5407. + socklen_t fromlen = sizeof(struct sockaddr_in6);
  5408. + assert (sizeof(from) <= fromlen);
  5409. diff --git a/package/glibc/glibc/2.22/0002-microblaze-include-unix-sysdep.h.patch b/package/glibc/glibc/2.22/0002-microblaze-include-unix-sysdep.h.patch
  5410. new file mode 100644
  5411. index 0000000..28f4b6e
  5412. --- /dev/null
  5413. +++ b/package/glibc/glibc/2.22/0002-microblaze-include-unix-sysdep.h.patch
  5414. @@ -0,0 +1,43 @@
  5415. +From 8415fb8d4f05c023b9d79e44dff197cc285fd1e5 Mon Sep 17 00:00:00 2001
  5416. +From: Mike Frysinger <vapier@gentoo.org>
  5417. +Date: Thu, 6 Aug 2015 02:10:46 -0400
  5418. +Subject: [PATCH] microblaze: include unix/sysdep.h
  5419. +
  5420. +The semi-recent SYSCALL_CANCEL inclusion broke microblaze due to the
  5421. +sysdep.h header not including the unix/sysdep.h header. Include it
  5422. +here like all other ports.
  5423. +
  5424. +(cherry picked from commit 5d5de49c3ccd69f65b801f1ca490a0112d1cbd7d)
  5425. +
  5426. +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  5427. +[edited to remove ChangeLog modifications, which cause conflicts.]
  5428. +---
  5429. + sysdeps/unix/sysv/linux/microblaze/sysdep.h | 7 ++++++-
  5430. + 2 files changed, 12 insertions(+), 1 deletion(-)
  5431. +
  5432. +diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
  5433. +index 83c0340..9d5c542 100644
  5434. +--- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
  5435. ++++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
  5436. +@@ -16,8 +16,11 @@
  5437. + License along with the GNU C Library; if not, see
  5438. + <http://www.gnu.org/licenses/>. */
  5439. +
  5440. ++#ifndef _LINUX_MICROBLAZE_SYSDEP_H
  5441. ++#define _LINUX_MICROBLAZE_SYSDEP_H 1
  5442. ++
  5443. ++#include <sysdeps/unix/sysdep.h>
  5444. + #include <sysdeps/microblaze/sysdep.h>
  5445. +-#include <sys/syscall.h>
  5446. +
  5447. + /* Defines RTLD_PRIVATE_ERRNO. */
  5448. + #include <dl-sysdep.h>
  5449. +@@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL: \
  5450. + # define PTR_DEMANGLE(var) (void) (var)
  5451. +
  5452. + #endif /* not __ASSEMBLER__ */
  5453. ++
  5454. ++#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
  5455. +--
  5456. +2.6.4
  5457. +
  5458. diff --git a/package/glibc/glibc/Config.in b/package/glibc/glibc/Config.in
  5459. new file mode 100644
  5460. index 0000000..0565162
  5461. --- /dev/null
  5462. +++ b/package/glibc/glibc/Config.in
  5463. @@ -0,0 +1,56 @@
  5464. +if BR2_TOOLCHAIN_BUILDROOT_EGLIBC
  5465. +
  5466. +config BR2_PACKAGE_EGLIBC
  5467. + bool
  5468. + default y
  5469. + select BR2_PACKAGE_LINUX_HEADERS
  5470. +
  5471. +choice
  5472. + prompt "eglibc version"
  5473. + default BR2_EGLIBC_VERSION_2_18
  5474. +
  5475. +config BR2_EGLIBC_VERSION_2_18
  5476. + bool "2.18-svnr23787"
  5477. + # Build breakage
  5478. + depends on !BR2_sparc
  5479. +
  5480. +config BR2_EGLIBC_VERSION_2_19
  5481. + bool "2.19-svnr25243"
  5482. + # Build breakage
  5483. + depends on !BR2_powerpc_SPE
  5484. +
  5485. +endchoice
  5486. +
  5487. +endif
  5488. +
  5489. +if BR2_TOOLCHAIN_BUILDROOT_GLIBC
  5490. +
  5491. +config BR2_PACKAGE_GLIBC
  5492. + bool
  5493. + default y
  5494. + select BR2_PACKAGE_LINUX_HEADERS
  5495. +
  5496. +choice
  5497. + prompt "glibc version"
  5498. + default BR2_GLIBC_VERSION_2_22
  5499. +
  5500. +config BR2_GLIBC_VERSION_2_22
  5501. + bool "2.22"
  5502. + # No support for pthread barriers on < v9 ISA
  5503. + depends on !BR2_sparc
  5504. +
  5505. +config BR2_GLIBC_VERSION_2_23
  5506. + bool "2.23"
  5507. + # No support for pthread barriers on < v9 ISA
  5508. + depends on !BR2_sparc
  5509. +
  5510. +endchoice
  5511. +
  5512. +endif
  5513. +
  5514. +config BR2_GLIBC_VERSION_STRING
  5515. + string
  5516. + default "2.18-svnr23787" if BR2_EGLIBC_VERSION_2_18
  5517. + default "2.19-svnr25243" if BR2_EGLIBC_VERSION_2_19
  5518. + default "2.22" if BR2_GLIBC_VERSION_2_22
  5519. + default "2.23" if BR2_GLIBC_VERSION_2_23
  5520. diff --git a/package/glibc/glibc/glibc.hash b/package/glibc/glibc/glibc.hash
  5521. new file mode 100644
  5522. index 0000000..b04f214
  5523. --- /dev/null
  5524. +++ b/package/glibc/glibc/glibc.hash
  5525. @@ -0,0 +1,8 @@
  5526. +# Locally calculated after checking pgp signature (glibc)
  5527. +# http://downloads.yoctoproject.org/releases/eglibc/*.{md5,sha1} (eglibc)
  5528. +md5 b395b021422a027d89884992e91734fc eglibc-2.18-svnr23787.tar.bz2
  5529. +sha1 224d9e655e8f0ad04ffde47b97a11c64e2255b56 eglibc-2.18-svnr23787.tar.bz2
  5530. +md5 197836c2ba42fb146e971222647198dd eglibc-2.19-svnr25243.tar.bz2
  5531. +sha1 8013c1935b46fd50d2d1fbfad3b0af362b75fb28 eglibc-2.19-svnr25243.tar.bz2
  5532. +sha256 eb731406903befef1d8f878a46be75ef862b9056ab0cde1626d08a7a05328948 glibc-2.22.tar.xz
  5533. +sha256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 glibc-2.23.tar.xz
  5534. diff --git a/package/glibc/glibc/glibc.mk b/package/glibc/glibc/glibc.mk
  5535. new file mode 100644
  5536. index 0000000..4a9ba0e
  5537. --- /dev/null
  5538. +++ b/package/glibc/glibc/glibc.mk
  5539. @@ -0,0 +1,155 @@
  5540. +################################################################################
  5541. +#
  5542. +# glibc/eglibc
  5543. +#
  5544. +################################################################################
  5545. +
  5546. +GLIBC_VERSION = $(call qstrip,$(BR2_GLIBC_VERSION_STRING))
  5547. +
  5548. +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_EGLIBC),y)
  5549. +GLIBC_SITE = http://downloads.yoctoproject.org/releases/eglibc
  5550. +GLIBC_SOURCE = eglibc-$(GLIBC_VERSION).tar.bz2
  5551. +GLIBC_SRC_SUBDIR = libc
  5552. +else
  5553. +GLIBC_SITE = $(BR2_GNU_MIRROR)/libc
  5554. +GLIBC_SOURCE = glibc-$(GLIBC_VERSION).tar.xz
  5555. +GLIBC_SRC_SUBDIR = .
  5556. +endif
  5557. +
  5558. +GLIBC_LICENSE = GPLv2+ (programs), LGPLv2.1+, BSD-3c, MIT (library)
  5559. +GLIBC_LICENSE_FILES = $(addprefix $(GLIBC_SRC_SUBDIR)/,COPYING COPYING.LIB LICENSES)
  5560. +
  5561. +# glibc is part of the toolchain so disable the toolchain dependency
  5562. +GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
  5563. +
  5564. +# Before (e)glibc is configured, we must have the first stage
  5565. +# cross-compiler and the kernel headers
  5566. +GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-gawk
  5567. +
  5568. +GLIBC_SUBDIR = build
  5569. +
  5570. +GLIBC_INSTALL_STAGING = YES
  5571. +
  5572. +GLIBC_INSTALL_STAGING_OPTS = install_root=$(STAGING_DIR) install
  5573. +
  5574. +# Thumb build is broken, build in ARM mode
  5575. +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
  5576. +GLIBC_EXTRA_CFLAGS += -marm
  5577. +endif
  5578. +
  5579. +# MIPS64 defaults to n32 so pass the correct -mabi if
  5580. +# we are using a different ABI. OABI32 is also used
  5581. +# in MIPS so we pass -mabi=32 in this case as well
  5582. +# even though it's not strictly necessary.
  5583. +ifeq ($(BR2_MIPS_NABI64),y)
  5584. +GLIBC_EXTRA_CFLAGS += -mabi=64
  5585. +else ifeq ($(BR2_MIPS_OABI32),y)
  5586. +GLIBC_EXTRA_CFLAGS += -mabi=32
  5587. +endif
  5588. +
  5589. +ifeq ($(BR2_ENABLE_DEBUG),y)
  5590. +GLIBC_EXTRA_CFLAGS += -g
  5591. +endif
  5592. +
  5593. +# The stubs.h header is not installed by install-headers, but is
  5594. +# needed for the gcc build. An empty stubs.h will work, as explained
  5595. +# in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
  5596. +# is used by Crosstool-NG.
  5597. +ifeq ($(BR2_TOOLCHAIN_BUILDROOT_GLIBC),y)
  5598. +define GLIBC_ADD_MISSING_STUB_H
  5599. + mkdir -p $(STAGING_DIR)/usr/include/gnu
  5600. + touch $(STAGING_DIR)/usr/include/gnu/stubs.h
  5601. +endef
  5602. +endif
  5603. +
  5604. +# Even though we use the autotools-package infrastructure, we have to
  5605. +# override the default configure commands for several reasons:
  5606. +#
  5607. +# 1. We have to build out-of-tree, but we can't use the same
  5608. +# 'symbolic link to configure' used with the gcc packages.
  5609. +#
  5610. +# 2. We have to execute the configure script with bash and not sh.
  5611. +#
  5612. +# Note that as mentionned in
  5613. +# http://patches.openembedded.org/patch/38849/, eglibc/glibc must be
  5614. +# built with -O2, so we pass our own CFLAGS and CXXFLAGS below.
  5615. +define GLIBC_CONFIGURE_CMDS
  5616. + mkdir -p $(@D)/build
  5617. + # Do the configuration
  5618. + (cd $(@D)/build; \
  5619. + $(TARGET_CONFIGURE_OPTS) \
  5620. + CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
  5621. + CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
  5622. + $(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
  5623. + ac_cv_path_BASH_SHELL=/bin/bash \
  5624. + libc_cv_forced_unwind=yes \
  5625. + libc_cv_ssp=no \
  5626. + --target=$(GNU_TARGET_NAME) \
  5627. + --host=$(GNU_TARGET_NAME) \
  5628. + --build=$(GNU_HOST_NAME) \
  5629. + --prefix=/usr \
  5630. + --enable-shared \
  5631. + $(if $(BR2_SOFT_FLOAT),--without-fp,--with-fp) \
  5632. + $(if $(BR2_x86_64),--enable-lock-elision) \
  5633. + --with-pkgversion="Buildroot" \
  5634. + --without-cvs \
  5635. + --disable-profile \
  5636. + --without-gd \
  5637. + --enable-obsolete-rpc \
  5638. + --enable-kernel=$(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)) \
  5639. + --with-headers=$(STAGING_DIR)/usr/include)
  5640. + $(GLIBC_ADD_MISSING_STUB_H)
  5641. +endef
  5642. +
  5643. +
  5644. +#
  5645. +# We also override the install to target commands since we only want
  5646. +# to install the libraries, and nothing more.
  5647. +#
  5648. +
  5649. +GLIBC_LIBS_LIB = \
  5650. + ld*.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* \
  5651. + libnsl.so.* libpthread.so.* libresolv.so.* librt.so.* libutil.so.* \
  5652. + libnss_files.so.* libnss_dns.so.*
  5653. +
  5654. +ifeq ($(BR2_PACKAGE_GDB),y)
  5655. +GLIBC_LIBS_LIB += libthread_db.so.*
  5656. +endif
  5657. +
  5658. +define GLIBC_INSTALL_TARGET_CMDS
  5659. + for libs in $(GLIBC_LIBS_LIB); do \
  5660. + $(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
  5661. + done
  5662. +endef
  5663. +
  5664. +# MIPS R6 requires to have NaN2008 support which is currently not
  5665. +# supported by the Linux kernel. In order to prevent building the
  5666. +# glibc against kernels not having NaN2008 support on platforms that
  5667. +# requires it, glibc currently checks for an (inexisting) 10.0.0
  5668. +# kernel headers version.
  5669. +#
  5670. +# Since in practice the kernel support for NaN2008 is not really
  5671. +# required for things to work properly, we adjust the glibc check to
  5672. +# make it believe that NaN2008 support was added in the kernel
  5673. +# starting from version 4.0.0.
  5674. +#
  5675. +# In general the compatibility issues introduced by mis-matched NaN
  5676. +# encodings will not cause a problem as signalling NaNs are rarely used
  5677. +# in average code. For MIPS R6 there isn't actually any compatibility
  5678. +# issue as the hardware is always NaN2008 and software is always
  5679. +# NaN2008. The problem only comes from when older MIPS code is linked in
  5680. +# via a DSO and multiple NaN encodings are introduced. Since Buildroot
  5681. +# is intended to have all code built from source then this scenario is
  5682. +# highly unlikely. The failure mode, if it ever occurs, would be either
  5683. +# that a signalling NaN fails to raise an invalid operation exception or
  5684. +# (more likely) an ordinary NaN raises an invalid operation exception.
  5685. +ifeq ($(BR2_mips_32r6)$(BR2_mips_64r6),y)
  5686. +define GLIBC_FIX_MIPS_R6
  5687. + $(SED) 's#10.0.0#4.0.0#' \
  5688. + $(@D)/sysdeps/unix/sysv/linux/mips/configure \
  5689. + $(@D)/sysdeps/unix/sysv/linux/mips/configure.ac
  5690. +endef
  5691. +GLIBC_POST_EXTRACT_HOOKS += GLIBC_FIX_MIPS_R6
  5692. +endif
  5693. +
  5694. +$(eval $(autotools-package))
  5695. diff --git a/package/glibc/glibc/nsswitch.conf b/package/glibc/glibc/nsswitch.conf
  5696. new file mode 100644
  5697. index 0000000..5c38491
  5698. --- /dev/null
  5699. +++ b/package/glibc/glibc/nsswitch.conf
  5700. @@ -0,0 +1,13 @@
  5701. +# /etc/nsswitch.conf
  5702. +
  5703. +passwd: files
  5704. +group: files
  5705. +shadow: files
  5706. +
  5707. +hosts: files dns
  5708. +networks: files dns
  5709. +
  5710. +protocols: files
  5711. +services: files
  5712. +ethers: files
  5713. +rpc: files
  5714. diff --git a/package/qt5/Config.in b/package/qt5/Config.in
  5715. index 234dfdd..fb57d25 100644
  5716. --- a/package/qt5/Config.in
  5717. +++ b/package/qt5/Config.in
  5718. @@ -31,6 +31,7 @@ menuconfig BR2_PACKAGE_QT5
  5719. if BR2_PACKAGE_QT5
  5720. source "package/qt5/qt5base/Config.in"
  5721. +source "package/qt5/qt53d/Config.in"
  5722. source "package/qt5/qt5canvas3d/Config.in"
  5723. source "package/qt5/qt5connectivity/Config.in"
  5724. source "package/qt5/qt5declarative/Config.in"
  5725. @@ -41,17 +42,20 @@ source "package/qt5/qt5location/Config.in"
  5726. source "package/qt5/qt5multimedia/Config.in"
  5727. source "package/qt5/qt5quickcontrols/Config.in"
  5728. source "package/qt5/qt5sensors/Config.in"
  5729. +source "package/qt5/qt5serialbus/Config.in"
  5730. source "package/qt5/qt5serialport/Config.in"
  5731. +source "package/qt5/qt5wayland/Config.in"
  5732. source "package/qt5/qt5svg/Config.in"
  5733. source "package/qt5/qt5tools/Config.in"
  5734. source "package/qt5/qt5webchannel/Config.in"
  5735. source "package/qt5/qt5websockets/Config.in"
  5736. source "package/qt5/qt5x11extras/Config.in"
  5737. +source "package/qt5/qt5webengine/Config.in"
  5738. source "package/qt5/qt5xmlpatterns/Config.in"
  5739. -comment "technology preview"
  5740. -source "package/qt5/qt53d/Config.in"
  5741. +source "package/qt5/qt5virtualkeyboard/Config.in"
  5742. +source "package/qt5/qt5charts/Config.in"
  5743. +source "package/qt5/qt5datavis3d/Config.in"
  5744. source "package/qt5/qt5quickcontrols2/Config.in"
  5745. -source "package/qt5/qt5serialbus/Config.in"
  5746. comment "legacy compatibility"
  5747. source "package/qt5/qt5script/Config.in"
  5748. source "package/qt5/qt5webkit/Config.in"
  5749. diff --git a/package/qt5/qt5.mk b/package/qt5/qt5.mk
  5750. index d25f663..0710ef4 100644
  5751. --- a/package/qt5/qt5.mk
  5752. +++ b/package/qt5/qt5.mk
  5753. @@ -1,6 +1,8 @@
  5754. -QT5_VERSION_MAJOR = 5.6
  5755. -QT5_VERSION = $(QT5_VERSION_MAJOR).2
  5756. +QT5_VERSION_MAJOR = 5.7
  5757. +QT5_VERSION = $(QT5_VERSION_MAJOR).0
  5758. QT5_SITE = http://download.qt.io/official_releases/qt/$(QT5_VERSION_MAJOR)/$(QT5_VERSION)/submodules
  5759. +##QT5_VERSION = $(QT5_VERSION_MAJOR).1
  5760. +##QT5_SITE = http://download.qt.io/snapshots/qt/$(QT5_VERSION_MAJOR)/$(QT5_VERSION)/latest_src/submodules
  5761. include $(sort $(wildcard package/qt5/*/*.mk))
  5762. define QT5_LA_PRL_FILES_FIXUP
  5763. diff --git a/package/qt5/qt53d/qt53d.hash b/package/qt5/qt53d/qt53d.hash
  5764. index 7179380..f59a671 100644
  5765. --- a/package/qt5/qt53d/qt53d.hash
  5766. +++ b/package/qt5/qt53d/qt53d.hash
  5767. @@ -1,2 +1 @@
  5768. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qt3d-opensource-src-5.6.2.tar.xz.mirrorlist
  5769. -sha256 a21786db6e0f5c6c70213fe1a3530ed3d7f28f28401a0f793970e9bc860ce941 qt3d-opensource-src-5.6.2.tar.xz
  5770. +sha256 a8248a1779b561ea450e92345e8187bacac359df0e92ad61a1ad7652bb233e29 qt3d-opensource-src-5.7.0.tar.xz
  5771. diff --git a/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.__patch b/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.__patch
  5772. new file mode 100644
  5773. index 0000000..54e4db8
  5774. --- /dev/null
  5775. +++ b/package/qt5/qt5base/0001-Disable-c-standard-compiler-flags-for-the-host-build.__patch
  5776. @@ -0,0 +1,44 @@
  5777. +From e69e69519661954716d59bfa5bbd0626515cfda9 Mon Sep 17 00:00:00 2001
  5778. +From: Peter Seiderer <ps.report@gmx.net>
  5779. +Date: Thu, 3 Mar 2016 15:17:31 +0100
  5780. +Subject: [PATCH] Disable c++ standard compiler flags for the host build
  5781. +MIME-Version: 1.0
  5782. +Content-Type: text/plain; charset=UTF-8
  5783. +Content-Transfer-Encoding: 8bit
  5784. +
  5785. +There is no test for c++ standard support for the host build
  5786. +(only for the target compiler/build) which leads to trouble
  5787. +in some cross compiling environments (old host compiler, new
  5788. +cross compiler):
  5789. +
  5790. + g++: error: unrecognized command line option ‘-std=c++1z’
  5791. +
  5792. +So disable c++ standard compiler flags unconditionally for host builds.
  5793. +
  5794. +Task-number: QTBUG-51644
  5795. +Change-Id: Ifb3042e125fe199a7e081740d1171d26ccacf0c5
  5796. +Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
  5797. +Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
  5798. +---
  5799. + mkspecs/features/default_post.prf | 5 ++++-
  5800. + 1 file changed, 4 insertions(+), 1 deletion(-)
  5801. +
  5802. +diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
  5803. +index cd8d885..561c8f4 100644
  5804. +--- a/mkspecs/features/default_post.prf
  5805. ++++ b/mkspecs/features/default_post.prf
  5806. +@@ -95,7 +95,10 @@ breakpad {
  5807. + !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME)
  5808. + }
  5809. +
  5810. +-c++11|c++14|c++1z {
  5811. ++# Disable special compiler flags for host builds (needs to be changed for 5.7
  5812. ++# to fall back to c++11 because since 5.7 c++11 is required everywhere,
  5813. ++# including host builds).
  5814. ++if(!host_build|!cross_compile):if(c++11|c++14|c++1z) {
  5815. + c++1z: cxxstd = CXX1Z
  5816. + else: c++14: cxxstd = CXX14
  5817. + else: cxxstd = CXX11
  5818. +--
  5819. +2.1.4
  5820. +
  5821. diff --git a/package/qt5/qt5base/Config.in b/package/qt5/qt5base/Config.in
  5822. index 7244fbe..64a7f65 100644
  5823. --- a/package/qt5/qt5base/Config.in
  5824. +++ b/package/qt5/qt5base/Config.in
  5825. @@ -180,7 +180,7 @@ config BR2_PACKAGE_QT5BASE_DIRECTFB
  5826. bool "directfb support"
  5827. depends on BR2_PACKAGE_DIRECTFB
  5828. -comment "directfb backend available if directfb is enabled"
  5829. +comment "directfb backend if directb is enabled"
  5830. depends on !BR2_PACKAGE_DIRECTFB
  5831. config BR2_PACKAGE_QT5BASE_XCB
  5832. diff --git a/package/qt5/qt5base/qmake.conf b/package/qt5/qt5base/qmake.conf
  5833. index 49cf898..2152d3c 100644
  5834. --- a/package/qt5/qt5base/qmake.conf
  5835. +++ b/package/qt5/qt5base/qmake.conf
  5836. @@ -19,7 +19,6 @@ QMAKE_CXXFLAGS_RELEASE += -O3
  5837. CONFIG += nostrip
  5838. QMAKE_LIBS += -lrt -lpthread -ldl
  5839. -QMAKE_CFLAGS_ISYSTEM =
  5840. include(../common/linux_device_post.conf)
  5841. load(qt_config)
  5842. diff --git a/package/qt5/qt5base/qt5base.hash b/package/qt5/qt5base/qt5base.hash
  5843. index 9808e9b..6795b60 100644
  5844. --- a/package/qt5/qt5base/qt5base.hash
  5845. +++ b/package/qt5/qt5base/qt5base.hash
  5846. @@ -1,2 +1 @@
  5847. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtbase-opensource-src-5.6.2.tar.xz.mirrorlist
  5848. -sha256 2f6eae93c5d982fe0a387a01aeb3435571433e23e9d9d9246741faf51f1ee787 qtbase-opensource-src-5.6.2.tar.xz
  5849. +sha256 3e7b6d123cab23a587ccbc45173296b33786faa409dba0494e4658fda3ede646 qtbase-opensource-src-5.7.0.tar.xz
  5850. diff --git a/package/qt5/qt5base/qt5base.mk b/package/qt5/qt5base/qt5base.mk
  5851. index 23dba2a..81666d6 100644
  5852. --- a/package/qt5/qt5base/qt5base.mk
  5853. +++ b/package/qt5/qt5base/qt5base.mk
  5854. @@ -20,21 +20,16 @@ QT5BASE_INSTALL_STAGING = YES
  5855. # want to use the one packaged in Buildroot
  5856. QT5BASE_CONFIGURE_OPTS += \
  5857. -optimized-qmake \
  5858. + -no-kms \
  5859. -no-cups \
  5860. + -no-nis \
  5861. -no-iconv \
  5862. -system-zlib \
  5863. -system-pcre \
  5864. + -system-harfbuzz \
  5865. -no-pch \
  5866. -shared
  5867. -# Uses libgbm from mesa3d
  5868. -ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_EGL),y)
  5869. -QT5BASE_CONFIGURE_OPTS += -kms -gbm
  5870. -QT5BASE_DEPENDENCIES += mesa3d
  5871. -else
  5872. -QT5BASE_CONFIGURE_OPTS += -no-kms
  5873. -endif
  5874. -
  5875. ifeq ($(BR2_ENABLE_DEBUG),y)
  5876. QT5BASE_CONFIGURE_OPTS += -debug
  5877. else
  5878. @@ -58,10 +53,6 @@ ifneq ($(QT5BASE_CONFIG_FILE),)
  5879. QT5BASE_CONFIGURE_OPTS += -qconfig buildroot
  5880. endif
  5881. -ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
  5882. -QT5BASE_DEPENDENCIES += udev
  5883. -endif
  5884. -
  5885. # Qt5 SQL Plugins
  5886. ifeq ($(BR2_PACKAGE_QT5BASE_SQL),y)
  5887. ifeq ($(BR2_PACKAGE_QT5BASE_MYSQL),y)
  5888. diff --git a/package/qt5/qt5canvas3d/qt5canvas3d.hash b/package/qt5/qt5canvas3d/qt5canvas3d.hash
  5889. index 01819e4..2d13e40 100644
  5890. --- a/package/qt5/qt5canvas3d/qt5canvas3d.hash
  5891. +++ b/package/qt5/qt5canvas3d/qt5canvas3d.hash
  5892. @@ -1,2 +1 @@
  5893. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtcanvas3d-opensource-src-5.6.2.tar.xz.mirrorlist
  5894. -sha256 d7584d006b03f99692ccabce922e755a6f12bb1ed1fbc99c2b84842b9e0aa0ad qtcanvas3d-opensource-src-5.6.2.tar.xz
  5895. +sha256 7871b3fd4c1a561c5b3eb57746e8504bc5d8fa626f9df578e619f9e823e3bd97 qtcanvas3d-opensource-src-5.7.0.tar.xz
  5896. diff --git a/package/qt5/qt5charts/Config.in b/package/qt5/qt5charts/Config.in
  5897. new file mode 100644
  5898. index 0000000..d354bb2
  5899. --- /dev/null
  5900. +++ b/package/qt5/qt5charts/Config.in
  5901. @@ -0,0 +1,18 @@
  5902. +config BR2_PACKAGE_QT5CHARTS
  5903. + bool "qt5charts"
  5904. + select BR2_PACKAGE_QT5DECLARATIVE
  5905. + select BR2_PACKAGE_QT5DECLARATIVE_QUICK
  5906. + select BR2_PACKAGE_QT5BASE_WIDGETS
  5907. + depends on BR2_PACKAGE_QT5_GL_AVAILABLE
  5908. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  5909. + help
  5910. + Qt is a cross-platform application and UI framework for
  5911. + developers using C++.
  5912. +
  5913. + This package corresponds to the qt5charts module.
  5914. +
  5915. + http://qt.io
  5916. +
  5917. +comment "qt5charts needs an OpenGL-capable backend"
  5918. + depends on !BR2_PACKAGE_QT5_GL_AVAILABLE
  5919. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  5920. diff --git a/package/qt5/qt5charts/qt5charts.mk b/package/qt5/qt5charts/qt5charts.mk
  5921. new file mode 100644
  5922. index 0000000..c813354
  5923. --- /dev/null
  5924. +++ b/package/qt5/qt5charts/qt5charts.mk
  5925. @@ -0,0 +1,39 @@
  5926. +################################################################################
  5927. +#
  5928. +# qt5charts
  5929. +#
  5930. +################################################################################
  5931. +
  5932. +QT5CHARTS_VERSION = $(QT5_VERSION)
  5933. +QT5CHARTS_SITE = $(QT5_SITE)
  5934. +QT5CHARTS_SOURCE = qtcharts-opensource-src-$(QT5CHARTS_VERSION).tar.xz
  5935. +QT5CHARTS_DEPENDENCIES = qt5base qt5declarative
  5936. +QT5CHARTS_INSTALL_STAGING = YES
  5937. +
  5938. +ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  5939. +QT5CHARTS_LICENSE = GPLv3
  5940. +QT5CHARTS_LICENSE_FILES = LICENSE.GPL3
  5941. +else
  5942. +QT5CHARTS_LICENSE = Commercial license
  5943. +QT5CHARTS_REDISTRIBUTE = NO
  5944. +endif
  5945. +
  5946. +define QT5CHARTS_CONFIGURE_CMDS
  5947. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake)
  5948. +endef
  5949. +
  5950. +define QT5CHARTS_BUILD_CMDS
  5951. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  5952. +endef
  5953. +
  5954. +define QT5CHARTS_INSTALL_STAGING_CMDS
  5955. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  5956. + $(QT5_LA_PRL_FILES_FIXUP)
  5957. +endef
  5958. +
  5959. +define QT5CHARTS_INSTALL_TARGET_CMDS
  5960. + cp -dpfr $(STAGING_DIR)/usr/lib/libQt5Charts.so.* $(TARGET_DIR)/usr/lib/
  5961. + cp -dpfr $(STAGING_DIR)/usr/qml/QtCharts $(TARGET_DIR)/usr/qml/
  5962. +endef
  5963. +
  5964. +$(eval $(generic-package))
  5965. diff --git a/package/qt5/qt5connectivity/Config.in b/package/qt5/qt5connectivity/Config.in
  5966. index fa9b911..d529ea7 100644
  5967. --- a/package/qt5/qt5connectivity/Config.in
  5968. +++ b/package/qt5/qt5connectivity/Config.in
  5969. @@ -1,9 +1,13 @@
  5970. config BR2_PACKAGE_QT5CONNECTIVITY
  5971. bool "qt5connectivity"
  5972. + select BR2_PACKAGE_BLUEZ_UTILS
  5973. select BR2_PACKAGE_QT5BASE
  5974. select BR2_PACKAGE_QT5BASE_CONCURRENT
  5975. select BR2_PACKAGE_QT5BASE_DBUS
  5976. - depends on BR2_PACKAGE_NEARD || BR2_PACKAGE_BLUEZ_UTILS || BR2_PACKAGE_BLUEZ5_UTILS
  5977. + depends on !BR2_STATIC_LIBS # bluez_utils
  5978. + depends on BR2_USE_WCHAR # bluez_utils
  5979. + depends on BR2_TOOLCHAIN_HAS_THREADS # bluez_utils
  5980. + depends on BR2_USE_MMU # bluez_utils
  5981. help
  5982. Qt is a cross-platform application and UI framework for
  5983. developers using C++.
  5984. @@ -12,6 +16,6 @@ config BR2_PACKAGE_QT5CONNECTIVITY
  5985. http://qt.io
  5986. -comment "qt5connectivity needs neard and/or bluez(5)_utils"
  5987. - depends on !BR2_PACKAGE_NEARD && !BR2_PACKAGE_BLUEZ_UTILS && \
  5988. - !BR2_PACKAGE_BLUEZ5_UTILS
  5989. +comment "qt5connectivity needs a toolchain w/ wchar, threads, dynamic library"
  5990. + depends on BR2_USE_MMU
  5991. + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
  5992. diff --git a/package/qt5/qt5connectivity/qt5connectivity.hash b/package/qt5/qt5connectivity/qt5connectivity.hash
  5993. index 4574f3d..00b7c20 100644
  5994. --- a/package/qt5/qt5connectivity/qt5connectivity.hash
  5995. +++ b/package/qt5/qt5connectivity/qt5connectivity.hash
  5996. @@ -1,2 +1 @@
  5997. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtconnectivity-opensource-src-5.6.2.tar.xz.mirrorlist
  5998. -sha256 1b672923e0703d62f605ccec97b454b1a04c1f0db47f54b687d009e84eabedf9 qtconnectivity-opensource-src-5.6.2.tar.xz
  5999. +sha256 9844ca7ec5be187a77dfd7e95051fb267006f6c77157ecb0b8ceeac103a32703 qtconnectivity-opensource-src-5.7.0.tar.xz
  6000. diff --git a/package/qt5/qt5connectivity/qt5connectivity.mk b/package/qt5/qt5connectivity/qt5connectivity.mk
  6001. index 0f7257d..936bc6f 100644
  6002. --- a/package/qt5/qt5connectivity/qt5connectivity.mk
  6003. +++ b/package/qt5/qt5connectivity/qt5connectivity.mk
  6004. @@ -7,7 +7,7 @@
  6005. QT5CONNECTIVITY_VERSION = $(QT5_VERSION)
  6006. QT5CONNECTIVITY_SITE = $(QT5_SITE)
  6007. QT5CONNECTIVITY_SOURCE = qtconnectivity-opensource-src-$(QT5CONNECTIVITY_VERSION).tar.xz
  6008. -QT5CONNECTIVITY_DEPENDENCIES = qt5base
  6009. +QT5CONNECTIVITY_DEPENDENCIES = bluez_utils qt5base
  6010. QT5CONNECTIVITY_INSTALL_STAGING = YES
  6011. ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  6012. @@ -18,10 +18,9 @@ QT5CONNECTIVITY_LICENSE = Commercial license
  6013. QT5CONNECTIVITY_REDISTRIBUTE = NO
  6014. endif
  6015. -QT5CONNECTIVITY_DEPENDENCIES += $(if $(BR2_PACKAGE_QT5DECLARATIVE),qt5declarative)
  6016. -QT5CONNECTIVITY_DEPENDENCIES += $(if $(BR2_PACKAGE_BLUEZ_UTILS),bluez_utils)
  6017. -QT5CONNECTIVITY_DEPENDENCIES += $(if $(BR2_PACKAGE_BLUEZ5_UTILS),bluez5_utils)
  6018. -QT5CONNECTIVITY_DEPENDENCIES += $(if $(BR2_PACKAGE_NEARD),neard)
  6019. +ifeq ($(BR2_PACKAGE_QT5DECLARATIVE),y)
  6020. +QT5CONNECTIVITY_DEPENDENCIES += qt5declarative
  6021. +endif
  6022. define QT5CONNECTIVITY_CONFIGURE_CMDS
  6023. (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake)
  6024. @@ -37,36 +36,15 @@ define QT5CONNECTIVITY_INSTALL_STAGING_CMDS
  6025. endef
  6026. ifeq ($(BR2_PACKAGE_QT5DECLARATIVE_QUICK),y)
  6027. -ifneq ($(BR2_PACKAGE_BLUEZ_UTILS)$(BR2_PACKAGE_BLUEZ5_UTILS),)
  6028. -define QT5CONNECTIVITY_INSTALL_TARGET_BLUETOOTH_QMLS
  6029. +define QT5CONNECTIVITY_INSTALL_TARGET_QMLS
  6030. cp -dpfr $(STAGING_DIR)/usr/qml/QtBluetooth $(TARGET_DIR)/usr/qml/
  6031. endef
  6032. endif
  6033. -ifeq ($(BR2_PACKAGE_NEARD),y)
  6034. -define QT5CONNECTIVITY_INSTALL_TARGET_NFC_QMLS
  6035. - cp -dpfr $(STAGING_DIR)/usr/qml/QtNfc $(TARGET_DIR)/usr/qml/
  6036. -endef
  6037. -endif
  6038. -endif
  6039. -ifneq ($(BR2_PACKAGE_BLUEZ_UTILS)$(BR2_PACKAGE_BLUEZ5_UTILS),)
  6040. -define QT5CONNECTIVITY_INSTALL_TARGET_BLUETOOTH
  6041. +define QT5CONNECTIVITY_INSTALL_TARGET_CMDS
  6042. cp -dpf $(STAGING_DIR)/usr/lib/libQt5Bluetooth.so.* $(TARGET_DIR)/usr/lib
  6043. cp -dpf $(STAGING_DIR)/usr/bin/sdpscanner $(TARGET_DIR)/usr/bin
  6044. -endef
  6045. -endif
  6046. -
  6047. -ifeq ($(BR2_PACKAGE_NEARD),y)
  6048. -define QT5CONNECTIVITY_INSTALL_TARGET_NFC
  6049. - cp -dpf $(STAGING_DIR)/usr/lib/libQt5Nfc.so.* $(TARGET_DIR)/usr/lib
  6050. -endef
  6051. -endif
  6052. -
  6053. -define QT5CONNECTIVITY_INSTALL_TARGET_CMDS
  6054. - $(QT5CONNECTIVITY_INSTALL_TARGET_BLUETOOTH)
  6055. - $(QT5CONNECTIVITY_INSTALL_TARGET_NFC)
  6056. - $(QT5CONNECTIVITY_INSTALL_TARGET_BLUETOOTH_QMLS)
  6057. - $(QT5CONNECTIVITY_INSTALL_TARGET_NFC_QMLS)
  6058. + $(QT5CONNECTIVITY_INSTALL_TARGET_QMLS)
  6059. endef
  6060. $(eval $(generic-package))
  6061. diff --git a/package/qt5/qt5datavis3d/Config.in b/package/qt5/qt5datavis3d/Config.in
  6062. new file mode 100644
  6063. index 0000000..c7aca95
  6064. --- /dev/null
  6065. +++ b/package/qt5/qt5datavis3d/Config.in
  6066. @@ -0,0 +1,17 @@
  6067. +config BR2_PACKAGE_QT5DATAVIS3D
  6068. + bool "qt5datavis3d"
  6069. + select BR2_PACKAGE_QT5DECLARATIVE
  6070. + select BR2_PACKAGE_QT5DECLARATIVE_QUICK
  6071. + depends on BR2_PACKAGE_QT5_GL_AVAILABLE
  6072. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  6073. + help
  6074. + Qt is a cross-platform application and UI framework for
  6075. + developers using C++.
  6076. +
  6077. + This package corresponds to the qt5datavis3d module.
  6078. +
  6079. + http://qt.io
  6080. +
  6081. +comment "qt5canvas3d needs an OpenGL-capable backend"
  6082. + depends on !BR2_PACKAGE_QT5_GL_AVAILABLE
  6083. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  6084. diff --git a/package/qt5/qt5datavis3d/qt5datavis3d.mk b/package/qt5/qt5datavis3d/qt5datavis3d.mk
  6085. new file mode 100644
  6086. index 0000000..9101148
  6087. --- /dev/null
  6088. +++ b/package/qt5/qt5datavis3d/qt5datavis3d.mk
  6089. @@ -0,0 +1,39 @@
  6090. +################################################################################
  6091. +#
  6092. +# qt5datavis3d
  6093. +#
  6094. +################################################################################
  6095. +
  6096. +QT5DATAVIS3D_VERSION = $(QT5_VERSION)
  6097. +QT5DATAVIS3D_SITE = $(QT5_SITE)
  6098. +QT5DATAVIS3D_SOURCE = qtdatavis3d-opensource-src-$(QT5DATAVIS3D_VERSION).tar.xz
  6099. +QT5DATAVIS3D_DEPENDENCIES = qt5base qt5declarative
  6100. +QT5DATAVIS3D_INSTALL_STAGING = YES
  6101. +
  6102. +ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  6103. +QT5DATAVIS3D_LICENSE = GPLv3
  6104. +QT5DATAVIS3D_LICENSE_FILES = LICENSE.GPL3
  6105. +else
  6106. +QT5DATAVIS3D_LICENSE = Commercial license
  6107. +QT5DATAVIS3D_REDISTRIBUTE = NO
  6108. +endif
  6109. +
  6110. +define QT5DATAVIS3D_CONFIGURE_CMDS
  6111. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake)
  6112. +endef
  6113. +
  6114. +define QT5DATAVIS3D_BUILD_CMDS
  6115. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  6116. +endef
  6117. +
  6118. +define QT5DATAVIS3D_INSTALL_STAGING_CMDS
  6119. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  6120. + $(QT5_LA_PRL_FILES_FIXUP)
  6121. +endef
  6122. +
  6123. +define QT5DATAVIS3D_INSTALL_TARGET_CMDS
  6124. + cp -dpfr $(STAGING_DIR)/usr/lib/libQt5DataVisualization.so.* $(TARGET_DIR)/usr/lib
  6125. + cp -dpfr $(STAGING_DIR)/usr/qml/QtDataVisualization $(TARGET_DIR)/usr/qml/
  6126. +endef
  6127. +
  6128. +$(eval $(generic-package))
  6129. diff --git a/package/qt5/qt5declarative/qt5declarative.hash b/package/qt5/qt5declarative/qt5declarative.hash
  6130. index d8d3a68..6779669 100644
  6131. --- a/package/qt5/qt5declarative/qt5declarative.hash
  6132. +++ b/package/qt5/qt5declarative/qt5declarative.hash
  6133. @@ -1,2 +1 @@
  6134. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtdeclarative-opensource-src-5.6.2.tar.xz.mirrorlist
  6135. -sha256 0086a986bc36b398ba518c404d08cdff0a0d7978c30aa3fa2ab73d71654209da qtdeclarative-opensource-src-5.6.2.tar.xz
  6136. +sha256 86de6239f3aee2e5f561c16ad7b6e47d8f341c293d4ed11c85acbc21888cf9f4 qtdeclarative-opensource-src-5.7.0.tar.xz
  6137. diff --git a/package/qt5/qt5enginio/qt5enginio.hash b/package/qt5/qt5enginio/qt5enginio.hash
  6138. index 9951834..95f507c 100644
  6139. --- a/package/qt5/qt5enginio/qt5enginio.hash
  6140. +++ b/package/qt5/qt5enginio/qt5enginio.hash
  6141. @@ -1,2 +1 @@
  6142. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtenginio-opensource-src-1.6.2.tar.xz.mirrorlist
  6143. -sha256 90ffc38d214a75ab0ef90a4760843f12bc073ae49c17de24c677d1d403bddcc3 qtenginio-opensource-src-1.6.2.tar.xz
  6144. +sha256 627ddcfbbfc3ec1a83c9dbb5f24287b5cd6cb5d3b9d09af4d1c444c6ac147f0c qtenginio-opensource-src-1.6.0.tar.xz
  6145. diff --git a/package/qt5/qt5enginio/qt5enginio.mk b/package/qt5/qt5enginio/qt5enginio.mk
  6146. index ada5fa7..b858d1c 100644
  6147. --- a/package/qt5/qt5enginio/qt5enginio.mk
  6148. +++ b/package/qt5/qt5enginio/qt5enginio.mk
  6149. @@ -6,7 +6,7 @@
  6150. # Qt5Enginio does not follow Qt versionning
  6151. # see https://bugreports.qt.io/browse/QTBUG-50111
  6152. -QT5ENGINIO_VERSION = 1.6.2
  6153. +QT5ENGINIO_VERSION = 1.6.0
  6154. QT5ENGINIO_SITE = $(QT5_SITE)
  6155. QT5ENGINIO_SOURCE = qtenginio-opensource-src-$(QT5ENGINIO_VERSION).tar.xz
  6156. QT5ENGINIO_DEPENDENCIES = openssl qt5base
  6157. diff --git a/package/qt5/qt5graphicaleffects/qt5graphicaleffects.hash b/package/qt5/qt5graphicaleffects/qt5graphicaleffects.hash
  6158. index ae29e3b..7c79a99 100644
  6159. --- a/package/qt5/qt5graphicaleffects/qt5graphicaleffects.hash
  6160. +++ b/package/qt5/qt5graphicaleffects/qt5graphicaleffects.hash
  6161. @@ -1,2 +1 @@
  6162. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtgraphicaleffects-opensource-src-5.6.2.tar.xz.mirrorlist
  6163. -sha256 1e9f0fac2c72a812d396db74b2d9d12f513d2ec9135d5982ca85aee7f00be75e qtgraphicaleffects-opensource-src-5.6.2.tar.xz
  6164. +sha256 c816539ce345e502425a94c624332df78f53aeebc460d76b53b79b59cb938de7 qtgraphicaleffects-opensource-src-5.7.0.tar.xz
  6165. diff --git a/package/qt5/qt5imageformats/qt5imageformats.hash b/package/qt5/qt5imageformats/qt5imageformats.hash
  6166. index 54b58e4..b65be40 100644
  6167. --- a/package/qt5/qt5imageformats/qt5imageformats.hash
  6168. +++ b/package/qt5/qt5imageformats/qt5imageformats.hash
  6169. @@ -1,2 +1 @@
  6170. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtimageformats-opensource-src-5.6.2.tar.xz.mirrorlist
  6171. -sha256 4fb153be62dac393cbcebab65040b3b9d6edecd1ebbe5e543401b0e45bd147e4 qtimageformats-opensource-src-5.6.2.tar.xz
  6172. +sha256 ef3344a44194d1414be585f8c8a652ffe217c663a22b6e26d3bb5e114f3f62e5 qtimageformats-opensource-src-5.7.0.tar.xz
  6173. diff --git a/package/qt5/qt5location/qt5location.hash b/package/qt5/qt5location/qt5location.hash
  6174. index 374952f..074168e 100644
  6175. --- a/package/qt5/qt5location/qt5location.hash
  6176. +++ b/package/qt5/qt5location/qt5location.hash
  6177. @@ -1,2 +1 @@
  6178. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtlocation-opensource-src-5.6.2.tar.xz.mirrorlist
  6179. -sha256 7a8995206ed0220f943a33c037527a1a8243d5386f5ca77bf88152675c28d23a qtlocation-opensource-src-5.6.2.tar.xz
  6180. +sha256 70273367342493a77c050f033a92d96e79925aa70308746e9681d8661f4aa865 qtlocation-opensource-src-5.7.0.tar.xz
  6181. diff --git a/package/qt5/qt5multimedia/Config.in b/package/qt5/qt5multimedia/Config.in
  6182. index 7549b35..59c3984 100644
  6183. --- a/package/qt5/qt5multimedia/Config.in
  6184. +++ b/package/qt5/qt5multimedia/Config.in
  6185. @@ -3,7 +3,6 @@ config BR2_PACKAGE_QT5MULTIMEDIA
  6186. select BR2_PACKAGE_QT5BASE
  6187. select BR2_PACKAGE_QT5BASE_GUI
  6188. select BR2_PACKAGE_QT5BASE_NETWORK
  6189. - select BR2_PACKAGE_QT5BASE_OPENGL_LIB if BR2_PACKAGE_QT5BASE_OPENGL
  6190. help
  6191. Qt is a cross-platform application and UI framework for
  6192. developers using C++.
  6193. diff --git a/package/qt5/qt5multimedia/qt5multimedia.hash b/package/qt5/qt5multimedia/qt5multimedia.hash
  6194. index 56a11fb..1a85f95 100644
  6195. --- a/package/qt5/qt5multimedia/qt5multimedia.hash
  6196. +++ b/package/qt5/qt5multimedia/qt5multimedia.hash
  6197. @@ -1,2 +1 @@
  6198. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtmultimedia-opensource-src-5.6.2.tar.xz.mirrorlist
  6199. -sha256 cb9a70a7c6c0eb5be4a3fcaf9590863479e95a255308bbf07d5b7aa303bb8caf qtmultimedia-opensource-src-5.6.2.tar.xz
  6200. +sha256 05ae705bda224a600b06e390aa7b1448c4a6a52d2d37842d2121fb4a5d84b559 qtmultimedia-opensource-src-5.7.0.tar.xz
  6201. diff --git a/package/qt5/qt5quickcontrols/qt5quickcontrols.hash b/package/qt5/qt5quickcontrols/qt5quickcontrols.hash
  6202. index 6db589d..cf438f8 100644
  6203. --- a/package/qt5/qt5quickcontrols/qt5quickcontrols.hash
  6204. +++ b/package/qt5/qt5quickcontrols/qt5quickcontrols.hash
  6205. @@ -1,2 +1 @@
  6206. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtquickcontrols-opensource-src-5.6.2.tar.xz.mirrorlist
  6207. -sha256 5ed0f2292be10222dfb1b57a05472798fd759279f65455d91c02ef4fb746102c qtquickcontrols-opensource-src-5.6.2.tar.xz
  6208. +sha256 d8e19a77100fff109585ccc62116e63dd11ce9486056a8eb5b64159b7ecdec32 qtquickcontrols-opensource-src-5.7.0.tar.xz
  6209. diff --git a/package/qt5/qt5quickcontrols2/qt5quickcontrols2.hash b/package/qt5/qt5quickcontrols2/qt5quickcontrols2.hash
  6210. index 0d85d48..c43afd7 100644
  6211. --- a/package/qt5/qt5quickcontrols2/qt5quickcontrols2.hash
  6212. +++ b/package/qt5/qt5quickcontrols2/qt5quickcontrols2.hash
  6213. @@ -1,2 +1 @@
  6214. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtquickcontrols2-opensource-src-5.6.2.tar.xz.mirrorlist
  6215. -sha256 09dc1710aa4701aebe145829eb99bab94d0870cf578f7dddcec0af92286dfec1 qtquickcontrols2-opensource-src-5.6.2.tar.xz
  6216. +sha256 63f5b0777992c32bd602b88de657e202cd6d5e8ba0371c6d5da16fb8c7481045 qtquickcontrols2-opensource-src-5.7.0.tar.xz
  6217. diff --git a/package/qt5/qt5quickcontrols2/qt5quickcontrols2.mk b/package/qt5/qt5quickcontrols2/qt5quickcontrols2.mk
  6218. index a5ad3f6..622e61f 100644
  6219. --- a/package/qt5/qt5quickcontrols2/qt5quickcontrols2.mk
  6220. +++ b/package/qt5/qt5quickcontrols2/qt5quickcontrols2.mk
  6221. @@ -31,10 +31,10 @@ define QT5QUICKCONTROLS2_INSTALL_STAGING_CMDS
  6222. endef
  6223. define QT5QUICKCONTROLS2_INSTALL_TARGET_CMDS
  6224. - cp -dpf $(STAGING_DIR)/usr/lib/libQt5LabsTemplates.so.* $(TARGET_DIR)/usr/lib
  6225. - cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/controls $(TARGET_DIR)/usr/qml/Qt/labs
  6226. - cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/calendar $(TARGET_DIR)/usr/qml/Qt/labs
  6227. - cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/templates $(TARGET_DIR)/usr/qml/Qt/labs
  6228. + cp -dpf $(STAGING_DIR)/usr/lib/libQt5Quick*.so.* $(TARGET_DIR)/usr/lib
  6229. +# cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/controls $(TARGET_DIR)/usr/qml/Qt/labs
  6230. +# cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/calendar $(TARGET_DIR)/usr/qml/Qt/labs
  6231. +# cp -dpfr $(STAGING_DIR)/usr/qml/Qt/labs/templates $(TARGET_DIR)/usr/qml/Qt/labs
  6232. endef
  6233. $(eval $(generic-package))
  6234. diff --git a/package/qt5/qt5sensors/qt5sensors.hash b/package/qt5/qt5sensors/qt5sensors.hash
  6235. index 65cd127..ec62e3b 100644
  6236. --- a/package/qt5/qt5sensors/qt5sensors.hash
  6237. +++ b/package/qt5/qt5sensors/qt5sensors.hash
  6238. @@ -1,2 +1 @@
  6239. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtsensors-opensource-src-5.6.2.tar.xz.mirrorlist
  6240. -sha256 a7809081aab4f2f0d7a4f40c3abb02e1690bb390d1dd410d7c6c5019a5053427 qtsensors-opensource-src-5.6.2.tar.xz
  6241. +sha256 283dcc66a24c4367e865fa8301b6ea04d0cb78bd0f166fd09a6bb42e1e3731be qtsensors-opensource-src-5.7.0.tar.xz
  6242. diff --git a/package/qt5/qt5serialbus/Config.in b/package/qt5/qt5serialbus/Config.in
  6243. index f5b713d..504141c 100644
  6244. --- a/package/qt5/qt5serialbus/Config.in
  6245. +++ b/package/qt5/qt5serialbus/Config.in
  6246. @@ -1,6 +1,5 @@
  6247. config BR2_PACKAGE_QT5SERIALBUS
  6248. bool "qt5serialbus"
  6249. - depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_6 # CAN FD
  6250. select BR2_PACKAGE_QT5BASE
  6251. select BR2_PACKAGE_QT5SERIALPORT
  6252. help
  6253. @@ -10,6 +9,3 @@ config BR2_PACKAGE_QT5SERIALBUS
  6254. This package corresponds to the qt5serialbus module.
  6255. http://qt.io
  6256. -
  6257. -comment "qt5serialbus needs headers >= 3.6"
  6258. - depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_6
  6259. diff --git a/package/qt5/qt5serialbus/qt5serialbus.hash b/package/qt5/qt5serialbus/qt5serialbus.hash
  6260. index 308c365..0597219 100644
  6261. --- a/package/qt5/qt5serialbus/qt5serialbus.hash
  6262. +++ b/package/qt5/qt5serialbus/qt5serialbus.hash
  6263. @@ -1,2 +1 @@
  6264. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtserialbus-opensource-src-5.6.2.tar.xz.mirrorlist
  6265. -sha256 b39260091691532382935ed51de9ead8e66cfb5f7a6e5410c17cd0695ccaf826 qtserialbus-opensource-src-5.6.2.tar.xz
  6266. +sha256 2c437ace393e9dcf170990b519cec59c5cbcfc3c830e46116abb52549dc15d38 qtserialbus-opensource-src-5.7.0.tar.xz
  6267. diff --git a/package/qt5/qt5serialport/qt5serialport.hash b/package/qt5/qt5serialport/qt5serialport.hash
  6268. index 2458e5d..7751d64 100644
  6269. --- a/package/qt5/qt5serialport/qt5serialport.hash
  6270. +++ b/package/qt5/qt5serialport/qt5serialport.hash
  6271. @@ -1,2 +1 @@
  6272. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtserialport-opensource-src-5.6.2.tar.xz.mirrorlist
  6273. -sha256 af76281bad2c2bd283189635316b46091f6712134b845ae1b9e3016eec94f376 qtserialport-opensource-src-5.6.2.tar.xz
  6274. +sha256 5ce150d843a243854736489d4a71205a8ca8dc8f93626ec29d1aa7a249a08265 qtserialport-opensource-src-5.7.0.tar.xz
  6275. diff --git a/package/qt5/qt5svg/qt5svg.hash b/package/qt5/qt5svg/qt5svg.hash
  6276. index 0c9e9eb..0c3a9ff 100644
  6277. --- a/package/qt5/qt5svg/qt5svg.hash
  6278. +++ b/package/qt5/qt5svg/qt5svg.hash
  6279. @@ -1,2 +1 @@
  6280. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtsvg-opensource-src-5.6.2.tar.xz.mirrorlist
  6281. -sha256 f7a361bf661b31ae7779513559dd0b774171911bc57f5cfb6bed6878ddc8bc4e qtsvg-opensource-src-5.6.2.tar.xz
  6282. +sha256 a1f89f035aed48bf8843ff1880c4b54dc2e3a5160dbd743aec03e13831cdd881 qtsvg-opensource-src-5.7.0.tar.xz
  6283. diff --git a/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch b/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch
  6284. new file mode 100644
  6285. index 0000000..61cbdfe
  6286. --- /dev/null
  6287. +++ b/package/qt5/qt5tools/0001-Disable-qdoc-needs-qtdeclarative.patch
  6288. @@ -0,0 +1,30 @@
  6289. +From acdb24783322bb6e69df61cf04df2b2e47a06ad2 Mon Sep 17 00:00:00 2001
  6290. +From: Peter Seiderer <ps.report@gmx.net>
  6291. +Date: Tue, 29 Mar 2016 13:37:09 +0200
  6292. +Subject: [PATCH] Disable qdoc (needs qtdeclarative).
  6293. +
  6294. +Fixes:
  6295. +
  6296. + Project ERROR: Unknown module(s) in QT: qmldevtools-private
  6297. + Makefile:63: recipe for target 'sub-qdoc-qmake_all' failed
  6298. +
  6299. +Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  6300. +---
  6301. + src/src.pro | 1 -
  6302. + 1 file changed, 1 deletion(-)
  6303. +
  6304. +diff --git a/src/src.pro b/src/src.pro
  6305. +index 387d54f..494898f 100644
  6306. +--- a/src/src.pro
  6307. ++++ b/src/src.pro
  6308. +@@ -14,7 +14,6 @@ qtHaveModule(widgets) {
  6309. + }
  6310. +
  6311. + SUBDIRS += linguist \
  6312. +- qdoc \
  6313. + qtplugininfo
  6314. + if(!android|android_app):!ios: SUBDIRS += qtpaths
  6315. +
  6316. +--
  6317. +2.1.4
  6318. +
  6319. diff --git a/package/qt5/qt5virtualkeyboard/Config.in b/package/qt5/qt5virtualkeyboard/Config.in
  6320. new file mode 100644
  6321. index 0000000..803b937
  6322. --- /dev/null
  6323. +++ b/package/qt5/qt5virtualkeyboard/Config.in
  6324. @@ -0,0 +1,10 @@
  6325. +config BR2_PACKAGE_QT5VIRTUALKEYBOARD
  6326. + bool "qt5virtualkeyboard"
  6327. + select BR2_PACKAGE_QT5BASE
  6328. + help
  6329. + Qt is a cross-platform application and UI framework for
  6330. + developers using C++.
  6331. +
  6332. + This package corresponds to the qt5virtualkeyboard module.
  6333. +
  6334. + http://qt.io
  6335. \ No newline at end of file
  6336. diff --git a/package/qt5/qt5virtualkeyboard/qt5virtualkeyboard.mk b/package/qt5/qt5virtualkeyboard/qt5virtualkeyboard.mk
  6337. new file mode 100644
  6338. index 0000000..bedefc5
  6339. --- /dev/null
  6340. +++ b/package/qt5/qt5virtualkeyboard/qt5virtualkeyboard.mk
  6341. @@ -0,0 +1,39 @@
  6342. +################################################################################
  6343. +#
  6344. +# qt5virtualkeyboard
  6345. +#
  6346. +################################################################################
  6347. +
  6348. +QT5VIRTUALKEYBOARD_VERSION = $(QT5_VERSION)
  6349. +QT5VIRTUALKEYBOARD_SITE = $(QT5_SITE)
  6350. +QT5VIRTUALKEYBOARD_SOURCE = qtvirtualkeyboard-opensource-src-$(QT5VIRTUALKEYBOARD_VERSION).tar.xz
  6351. +QT5VIRTUALKEYBOARD_DEPENDENCIES = qt5base qt5declarative
  6352. +QT5VIRTUALKEYBOARD_INSTALL_STAGING = YES
  6353. +
  6354. +ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  6355. +QT5VIRTUALKEYBOARD_LICENSE = GPLv3
  6356. +QT5VIRTUALKEYBOARD_LICENSE_FILES = LICENSE.GPL3
  6357. +else
  6358. +QT5VIRTUALKEYBOARD_LICENSE = Commercial license
  6359. +QT5VIRTUALKEYBOARD_REDISTRIBUTE = NO
  6360. +endif
  6361. +
  6362. +define QT5VIRTUALKEYBOARD_CONFIGURE_CMDS
  6363. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake CONFIG+=disable-desktop)
  6364. +endef
  6365. +
  6366. +define QT5VIRTUALKEYBOARD_BUILD_CMDS
  6367. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  6368. +endef
  6369. +
  6370. +define QT5VIRTUALKEYBOARD_INSTALL_STAGING_CMDS
  6371. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  6372. +endef
  6373. +
  6374. +define QT5VIRTUALKEYBOARD_INSTALL_TARGET_CMDS
  6375. + cp -dpf $(STAGING_DIR)/usr/lib/qt/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so $(TARGET_DIR)/usr/lib/qt/plugins/platforminputcontexts
  6376. + cp -dpfrv $(STAGING_DIR)/usr/qml/QtQuick/VirtualKeyboard $(TARGET_DIR)/usr/qml/QtQuick/
  6377. +
  6378. +endef
  6379. +
  6380. +$(eval $(generic-package))
  6381. diff --git a/package/qt5/qt5wayland/Config.in b/package/qt5/qt5wayland/Config.in
  6382. new file mode 100644
  6383. index 0000000..dbb67b7
  6384. --- /dev/null
  6385. +++ b/package/qt5/qt5wayland/Config.in
  6386. @@ -0,0 +1,14 @@
  6387. +config BR2_PACKAGE_QT5WAYLAND
  6388. + bool "qt5wayland"
  6389. + select BR2_PACKAGE_QT5BASE
  6390. + select BR2_PACKAGE_QT5DECLARATIVE
  6391. + select BR2_PACKAGE_QT5JSBACKEND
  6392. + depends on BR2_PACKAGE_WAYLAND
  6393. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  6394. + help
  6395. + Qt is a cross-platform application and UI framework for
  6396. + developers using C++.
  6397. +
  6398. + This package corresponds to the qt5wayland module.
  6399. +
  6400. + http://qt.io
  6401. \ No newline at end of file
  6402. diff --git a/package/qt5/qt5wayland/qt5wayland.mk b/package/qt5/qt5wayland/qt5wayland.mk
  6403. new file mode 100644
  6404. index 0000000..436934d
  6405. --- /dev/null
  6406. +++ b/package/qt5/qt5wayland/qt5wayland.mk
  6407. @@ -0,0 +1,35 @@
  6408. +# (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake -r CONFIG+=wayland-compositor )
  6409. +################################################################################
  6410. +#
  6411. +# qt5wayland
  6412. +#
  6413. +################################################################################
  6414. +
  6415. +QT5WAYLAND_VERSION = $(QT5_VERSION)
  6416. +QT5WAYLAND_SITE = $(QT5_SITE)
  6417. +QT5WAYLAND_SOURCE = qtwayland-opensource-src-$(QT5WAYLAND_VERSION).tar.xz
  6418. +QT5WAYLAND_DEPENDENCIES = qt5base qt5declarative wayland
  6419. +ifeq ($(BR2_PACKAGE_HAS_LIBEGL),y)
  6420. +QT5WAYLAND_DEPENDENCIES += libegl
  6421. +endif
  6422. +QT5WAYLAND_INSTALL_STAGING = YES
  6423. +
  6424. +define QT5WAYLAND_CONFIGURE_CMDS
  6425. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake)
  6426. +endef
  6427. +
  6428. +define QT5WAYLAND_BUILD_CMDS
  6429. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  6430. +endef
  6431. +
  6432. +define QT5WAYLAND_INSTALL_STAGING_CMDS
  6433. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  6434. +endef
  6435. +
  6436. +define QT5WAYLAND_INSTALL_TARGET_CMDS
  6437. + cp -dpf $(STAGING_DIR)/usr/lib/libQt5WaylandClient.so* $(TARGET_DIR)/usr/lib
  6438. + cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/wayland-*-client $(TARGET_DIR)/usr/lib/qt/plugins
  6439. + cp -dpf $(STAGING_DIR)/usr/lib/qt/plugins/platforms/libqwayland-*.so $(TARGET_DIR)/usr/lib/qt/plugins/platforms
  6440. +endef
  6441. +
  6442. +$(eval $(generic-package))
  6443. diff --git a/package/qt5/qt5webchannel/qt5webchannel.hash b/package/qt5/qt5webchannel/qt5webchannel.hash
  6444. index 0f9eaae..c4fc230 100644
  6445. --- a/package/qt5/qt5webchannel/qt5webchannel.hash
  6446. +++ b/package/qt5/qt5webchannel/qt5webchannel.hash
  6447. @@ -1,2 +1 @@
  6448. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtwebchannel-opensource-src-5.6.2.tar.xz.mirrorlist
  6449. -sha256 700efdef5f51bdb77093f4db212afe275ad35a710ea08ba0e9e9cbc8f09f1a52 qtwebchannel-opensource-src-5.6.2.tar.xz
  6450. +sha256 3ab4cd177cc742ee5015f2b7f943c16ce13380b840f824436b5005485b749816 qtwebchannel-opensource-src-5.7.0.tar.xz
  6451. diff --git a/package/qt5/qt5webengine/001-chromium-glibc-2.24-issue.patch b/package/qt5/qt5webengine/001-chromium-glibc-2.24-issue.patch
  6452. new file mode 100644
  6453. index 0000000..f3d5bda
  6454. --- /dev/null
  6455. +++ b/package/qt5/qt5webengine/001-chromium-glibc-2.24-issue.patch
  6456. @@ -0,0 +1,14 @@
  6457. +--- a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp 2016-05-26 15:53:47.000000000 +0200
  6458. ++++ b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/PageAllocator.cpp 2016-11-19 00:19:49.894527354 +0100
  6459. +@@ -39,6 +39,11 @@
  6460. +
  6461. + #include <sys/mman.h>
  6462. +
  6463. ++#if OS(LINUX) && defined(MADV_FREE)
  6464. ++// glibc 2.24 issues in qtwebengine
  6465. ++#undef MADV_FREE
  6466. ++#endif
  6467. ++
  6468. + #ifndef MADV_FREE
  6469. + #define MADV_FREE MADV_DONTNEED
  6470. + #endif
  6471. diff --git a/package/qt5/qt5webengine/001-delegate_frame_node_fence_sync.patch b/package/qt5/qt5webengine/001-delegate_frame_node_fence_sync.patch
  6472. new file mode 100644
  6473. index 0000000..c7bdcff
  6474. --- /dev/null
  6475. +++ b/package/qt5/qt5webengine/001-delegate_frame_node_fence_sync.patch
  6476. @@ -0,0 +1,20 @@
  6477. +--- a/src/core/delegated_frame_node.cpp 2016-03-03 17:02:28.000000000 +0100
  6478. ++++ b/src/core/delegated_frame_node.cpp 2016-04-09 21:01:03.502390661 +0200
  6479. +@@ -194,7 +194,7 @@
  6480. + case gfx::TransferableFence::NoSync:
  6481. + break;
  6482. + case gfx::TransferableFence::EglSync:
  6483. +-#ifdef EGL_KHR_reusable_sync
  6484. ++#ifdef EGL_KHR_fence_sync
  6485. + {
  6486. + static bool resolved = false;
  6487. + static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR = 0;
  6488. +@@ -235,7 +235,7 @@
  6489. + case gfx::TransferableFence::NoSync:
  6490. + break;
  6491. + case gfx::TransferableFence::EglSync:
  6492. +-#ifdef EGL_KHR_reusable_sync
  6493. ++#ifdef EGL_KHR_fence_sync
  6494. + {
  6495. + static bool resolved = false;
  6496. + static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = 0;
  6497. diff --git a/package/qt5/qt5webengine/Config.in b/package/qt5/qt5webengine/Config.in
  6498. new file mode 100644
  6499. index 0000000..b630a85
  6500. --- /dev/null
  6501. +++ b/package/qt5/qt5webengine/Config.in
  6502. @@ -0,0 +1,17 @@
  6503. +config BR2_PACKAGE_QT5WEBENGINE
  6504. + bool "qt5webengine"
  6505. + select BR2_PACKAGE_QT5BASE
  6506. + select BR2_PACKAGE_QT5BASE_GUI
  6507. +# select BR2_PACKAGE_QT5BASE_FONTCONFIG
  6508. + select BR2_PACKAGE_QT5BASE_DBUS
  6509. + select BR2_PACKAGE_QT5BASE_ICU
  6510. + select BR2_PACKAGE_QT5WEBCHANNEL
  6511. + select BR2_PACKAGE_OPENSSL
  6512. + select BR2_PACKAGE_LIBCAP
  6513. + select BR2_PACKAGE_QT5DECLARATIVE
  6514. + select BR2_PACKAGE_QT5DECLARATIVE_QUICK
  6515. + help
  6516. + Qt is a cross-platform application and UI framework for
  6517. + developers using C++.
  6518. +
  6519. + This package corresponds to the qt5webengine module.
  6520. diff --git a/package/qt5/qt5webengine/patches_save/001-allow-arm-compiler.patch b/package/qt5/qt5webengine/patches_save/001-allow-arm-compiler.patch
  6521. new file mode 100644
  6522. index 0000000..bb8aa69
  6523. --- /dev/null
  6524. +++ b/package/qt5/qt5webengine/patches_save/001-allow-arm-compiler.patch
  6525. @@ -0,0 +1,26 @@
  6526. +diff '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*ninja*' -Naur qt5_a/src/3rdparty/chromium/build/common.gypi qt5webengine-5.5.1/src/3rdparty/chromium/build/common.gypi
  6527. +--- qt5_a/src/3rdparty/chromium/build/common.gypi 2015-10-13 06:36:43.000000000 +0200
  6528. ++++ qt5webengine-5.5.1/src/3rdparty/chromium/build/common.gypi 2016-02-09 16:37:54.729166157 +0100
  6529. +@@ -2294,7 +2294,7 @@
  6530. + }],
  6531. + ],
  6532. + # Change the default to hard once the armhf transition is complete.
  6533. +- 'arm_float_abi%': 'softfp',
  6534. ++ 'arm_float_abi%': 'hard',
  6535. + 'arm_thumb%': 1,
  6536. + }],
  6537. +
  6538. +--- qt5webengine-5.5.1/tools/qmake/mkspecs/features/functions.prf 2015-10-13 06:36:55.000000000 +0200
  6539. ++++ qt5_we_b/tools/qmake/mkspecs/features/functions.prf 2016-02-09 21:44:30.829783885 +0100
  6540. +@@ -12,9 +12,9 @@
  6541. + return(false)
  6542. + }
  6543. +
  6544. +- linux-g++*:!isGCCVersionSupported(): return(false)
  6545. ++ linux*g++*:!isGCCVersionSupported(): return(false)
  6546. + !isPythonVersionSupported(): return(false)
  6547. +- linux-g++*|win32-msvc2013|macx-clang: return(true)
  6548. ++ linux*g++*|win32-msvc2013|macx-clang: return(true)
  6549. + boot2qt: return(true)
  6550. +
  6551. + skipBuild("Qt WebEngine can currently only be built for Linux (GCC), Windows (MSVC 2013), OS X (XCode 5.1+) or Qt for Device Creation.")
  6552. diff --git a/package/qt5/qt5webengine/patches_save/002-buildroot-python-bz2.patch b/package/qt5/qt5webengine/patches_save/002-buildroot-python-bz2.patch
  6553. new file mode 100644
  6554. index 0000000..b780f49
  6555. --- /dev/null
  6556. +++ b/package/qt5/qt5webengine/patches_save/002-buildroot-python-bz2.patch
  6557. @@ -0,0 +1,11 @@
  6558. +--- a/src/3rdparty/chromium/v8/tools/js2c.py 2016-03-03 15:48:36.000000000 +0100
  6559. ++++ b/src/3rdparty/chromium/v8/tools/js2c.py 2016-04-28 15:56:42.219174252 +0200
  6560. +@@ -34,7 +34,7 @@
  6561. + import os, re, sys, string
  6562. + import optparse
  6563. + import jsmin
  6564. +-import bz2
  6565. ++##import bz2
  6566. + import textwrap
  6567. +
  6568. +
  6569. diff --git a/package/qt5/qt5webengine/patches_save/002-move_icu_to_56_1.patch b/package/qt5/qt5webengine/patches_save/002-move_icu_to_56_1.patch
  6570. new file mode 100644
  6571. index 0000000..a917a9c
  6572. --- /dev/null
  6573. +++ b/package/qt5/qt5webengine/patches_save/002-move_icu_to_56_1.patch
  6574. @@ -0,0 +1,43 @@
  6575. +--- qt5webengine-5.5.1/src/3rdparty/chromium/third_party/icu/source/common/unicode/uvernum.h 2015-10-13 06:36:26.000000000 +0200
  6576. ++++ qt5_b/src/3rdparty/chromium/third_party/icu/source/common/unicode/uvernum.h 2016-02-11 12:06:28.304679220 +0100
  6577. +@@ -57,7 +57,7 @@
  6578. + * This value will change in the subsequent releases of ICU
  6579. + * @stable ICU 2.4
  6580. + */
  6581. +-#define U_ICU_VERSION_MAJOR_NUM 52
  6582. ++#define U_ICU_VERSION_MAJOR_NUM 56
  6583. +
  6584. + /** The current ICU minor version as an integer.
  6585. + * This value will change in the subsequent releases of ICU
  6586. +@@ -83,7 +83,7 @@
  6587. + * This value will change in the subsequent releases of ICU
  6588. + * @stable ICU 2.6
  6589. + */
  6590. +-#define U_ICU_VERSION_SUFFIX _52
  6591. ++#define U_ICU_VERSION_SUFFIX _56
  6592. +
  6593. + /**
  6594. + * \def U_DEF2_ICU_ENTRY_POINT_RENAME
  6595. +@@ -118,19 +118,19 @@
  6596. + * This value will change in the subsequent releases of ICU
  6597. + * @stable ICU 2.4
  6598. + */
  6599. +-#define U_ICU_VERSION "52.1"
  6600. ++#define U_ICU_VERSION "56.1"
  6601. +
  6602. + /** The current ICU library major/minor version as a string without dots, for library name suffixes.
  6603. + * This value will change in the subsequent releases of ICU
  6604. + * @stable ICU 2.6
  6605. + */
  6606. +-#define U_ICU_VERSION_SHORT "52"
  6607. ++#define U_ICU_VERSION_SHORT "56"
  6608. +
  6609. + #ifndef U_HIDE_INTERNAL_API
  6610. + /** Data version in ICU4C.
  6611. + * @internal ICU 4.4 Internal Use Only
  6612. + **/
  6613. +-#define U_ICU_DATA_VERSION "52.1"
  6614. ++#define U_ICU_DATA_VERSION "56.1"
  6615. + #endif /* U_HIDE_INTERNAL_API */
  6616. +
  6617. + /*===========================================================================
  6618. diff --git a/package/qt5/qt5webengine/patches_save/003-egl_khr_reusable_sync.patch b/package/qt5/qt5webengine/patches_save/003-egl_khr_reusable_sync.patch
  6619. new file mode 100644
  6620. index 0000000..8d633d9
  6621. --- /dev/null
  6622. +++ b/package/qt5/qt5webengine/patches_save/003-egl_khr_reusable_sync.patch
  6623. @@ -0,0 +1,14 @@
  6624. +--- qt5webengine-5.5.1/src/core/delegated_frame_node.cpp 2015-10-13 06:36:54.000000000 +0200
  6625. ++++ qt5_b/src/core/delegated_frame_node.cpp 2016-02-11 13:27:42.142167151 +0100
  6626. +@@ -76,6 +76,11 @@
  6627. + #include <EGL/eglext.h>
  6628. + #endif
  6629. +
  6630. ++#ifdef EGL_KHR_reusable_sync
  6631. ++#undef EGL_KHR_reusable_sync
  6632. ++#endif
  6633. ++
  6634. ++
  6635. + namespace QtWebEngineCore {
  6636. +
  6637. + class MailboxTexture : public QSGTexture, protected QOpenGLFunctions {
  6638. diff --git a/package/qt5/qt5webengine/patches_save/004-allow-egl-surface.patch b/package/qt5/qt5webengine/patches_save/004-allow-egl-surface.patch
  6639. new file mode 100644
  6640. index 0000000..604cb88
  6641. --- /dev/null
  6642. +++ b/package/qt5/qt5webengine/patches_save/004-allow-egl-surface.patch
  6643. @@ -0,0 +1,166 @@
  6644. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/base/files/file_proxy_unittest.cc qt5_b/src/3rdparty/chromium/base/files/file_proxy_unittest.cc
  6645. +--- qt5webengine-5.5.1/src/3rdparty/chromium/base/files/file_proxy_unittest.cc 2015-10-13 06:36:48.000000000 +0200
  6646. ++++ qt5_b/src/3rdparty/chromium/base/files/file_proxy_unittest.cc 2016-02-12 17:58:52.694043375 +0100
  6647. +@@ -142,7 +142,7 @@
  6648. + }
  6649. +
  6650. + TEST_F(FileProxyTest, CreateOrOpen_AbandonedCreate) {
  6651. +- bool prev = ThreadRestrictions::SetIOAllowed(false);
  6652. ++ bool prev = ThreadRestrictions::SetIOAllowed(true);
  6653. + {
  6654. + FileProxy proxy(file_task_runner());
  6655. + proxy.CreateOrOpen(
  6656. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/content/browser/browser_main_loop.cc qt5_b/src/3rdparty/chromium/content/browser/browser_main_loop.cc
  6657. +--- qt5webengine-5.5.1/src/3rdparty/chromium/content/browser/browser_main_loop.cc 2015-10-13 06:36:47.000000000 +0200
  6658. ++++ qt5_b/src/3rdparty/chromium/content/browser/browser_main_loop.cc 2016-02-12 17:53:52.118534482 +0100
  6659. +@@ -745,7 +745,7 @@
  6660. +
  6661. + // If the UI thread blocks, the whole UI is unresponsive.
  6662. + // Do not allow disk IO from the UI thread.
  6663. +- base::ThreadRestrictions::SetIOAllowed(false);
  6664. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6665. + base::ThreadRestrictions::DisallowWaiting();
  6666. + return result_code_;
  6667. + }
  6668. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/content/browser/browser_process_sub_thread.cc qt5_b/src/3rdparty/chromium/content/browser/browser_process_sub_thread.cc
  6669. +--- qt5webengine-5.5.1/src/3rdparty/chromium/content/browser/browser_process_sub_thread.cc 2015-10-13 06:36:46.000000000 +0200
  6670. ++++ qt5_b/src/3rdparty/chromium/content/browser/browser_process_sub_thread.cc 2016-02-12 17:52:40.717701092 +0100
  6671. +@@ -39,7 +39,7 @@
  6672. + // Though this thread is called the "IO" thread, it actually just routes
  6673. + // messages around; it shouldn't be allowed to perform any blocking disk
  6674. + // I/O.
  6675. +- base::ThreadRestrictions::SetIOAllowed(false);
  6676. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6677. + base::ThreadRestrictions::DisallowWaiting();
  6678. + }
  6679. + }
  6680. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/dbus/end_to_end_async_unittest.cc qt5_b/src/3rdparty/chromium/dbus/end_to_end_async_unittest.cc
  6681. +--- qt5webengine-5.5.1/src/3rdparty/chromium/dbus/end_to_end_async_unittest.cc 2015-10-13 06:36:51.000000000 +0200
  6682. ++++ qt5_b/src/3rdparty/chromium/dbus/end_to_end_async_unittest.cc 2016-02-12 17:57:04.280777854 +0100
  6683. +@@ -39,7 +39,7 @@
  6684. +
  6685. + virtual void SetUp() {
  6686. + // Make the main thread not to allow IO.
  6687. +- base::ThreadRestrictions::SetIOAllowed(false);
  6688. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6689. +
  6690. + // Start the D-Bus thread.
  6691. + dbus_thread_.reset(new base::Thread("D-Bus Thread"));
  6692. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/dbus/object_manager_unittest.cc qt5_b/src/3rdparty/chromium/dbus/object_manager_unittest.cc
  6693. +--- qt5webengine-5.5.1/src/3rdparty/chromium/dbus/object_manager_unittest.cc 2015-10-13 06:36:51.000000000 +0200
  6694. ++++ qt5_b/src/3rdparty/chromium/dbus/object_manager_unittest.cc 2016-02-12 17:54:33.659019384 +0100
  6695. +@@ -61,7 +61,7 @@
  6696. +
  6697. + virtual void SetUp() {
  6698. + // Make the main thread not to allow IO.
  6699. +- base::ThreadRestrictions::SetIOAllowed(false);
  6700. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6701. +
  6702. + // Start the D-Bus thread.
  6703. + dbus_thread_.reset(new base::Thread("D-Bus Thread"));
  6704. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/dbus/property_unittest.cc qt5_b/src/3rdparty/chromium/dbus/property_unittest.cc
  6705. +--- qt5webengine-5.5.1/src/3rdparty/chromium/dbus/property_unittest.cc 2015-10-13 06:36:51.000000000 +0200
  6706. ++++ qt5_b/src/3rdparty/chromium/dbus/property_unittest.cc 2016-02-12 17:57:54.025358691 +0100
  6707. +@@ -51,7 +51,7 @@
  6708. +
  6709. + virtual void SetUp() {
  6710. + // Make the main thread not to allow IO.
  6711. +- base::ThreadRestrictions::SetIOAllowed(false);
  6712. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6713. +
  6714. + // Start the D-Bus thread.
  6715. + dbus_thread_.reset(new base::Thread("D-Bus Thread"));
  6716. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/dbus/signal_sender_verification_unittest.cc qt5_b/src/3rdparty/chromium/dbus/signal_sender_verification_unittest.cc
  6717. +--- qt5webengine-5.5.1/src/3rdparty/chromium/dbus/signal_sender_verification_unittest.cc 2015-10-13 06:36:51.000000000 +0200
  6718. ++++ qt5_b/src/3rdparty/chromium/dbus/signal_sender_verification_unittest.cc 2016-02-12 17:55:57.519998395 +0100
  6719. +@@ -32,7 +32,7 @@
  6720. + base::StatisticsRecorder::Initialize();
  6721. +
  6722. + // Make the main thread not to allow IO.
  6723. +- base::ThreadRestrictions::SetIOAllowed(false);
  6724. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6725. +
  6726. + // Start the D-Bus thread.
  6727. + dbus_thread_.reset(new base::Thread("D-Bus Thread"));
  6728. +@@ -161,7 +161,7 @@
  6729. + void SafeServiceStop(TestService* test_service) {
  6730. + base::ThreadRestrictions::SetIOAllowed(true);
  6731. + test_service->Stop();
  6732. +- base::ThreadRestrictions::SetIOAllowed(false);
  6733. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6734. + }
  6735. +
  6736. + base::MessageLoop message_loop_;
  6737. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/net/base/file_stream_unittest.cc qt5_b/src/3rdparty/chromium/net/base/file_stream_unittest.cc
  6738. +--- qt5webengine-5.5.1/src/3rdparty/chromium/net/base/file_stream_unittest.cc 2015-10-13 06:36:53.000000000 +0200
  6739. ++++ qt5_b/src/3rdparty/chromium/net/base/file_stream_unittest.cc 2016-02-12 18:00:05.358889970 +0100
  6740. +@@ -758,7 +758,7 @@
  6741. + scoped_refptr<base::SequencedWorkerPool> pool(
  6742. + new base::SequencedWorkerPool(1, "StreamTest"));
  6743. +
  6744. +- bool prev = base::ThreadRestrictions::SetIOAllowed(false);
  6745. ++ bool prev = base::ThreadRestrictions::SetIOAllowed(true);
  6746. + scoped_ptr<FileStream> stream(new FileStream(pool.get()));
  6747. + int flags = base::File::FLAG_OPEN | base::File::FLAG_WRITE |
  6748. + base::File::FLAG_ASYNC;
  6749. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/net/base/network_config_watcher_mac.cc qt5_b/src/3rdparty/chromium/net/base/network_config_watcher_mac.cc
  6750. +--- qt5webengine-5.5.1/src/3rdparty/chromium/net/base/network_config_watcher_mac.cc 2015-10-13 06:36:53.000000000 +0200
  6751. ++++ qt5_b/src/3rdparty/chromium/net/base/network_config_watcher_mac.cc 2016-02-12 18:00:56.359484236 +0100
  6752. +@@ -67,7 +67,7 @@
  6753. + void NetworkConfigWatcherMacThread::Init() {
  6754. + // Disallow IO to make sure NetworkConfigWatcherMacThread's helper thread does
  6755. + // not perform blocking operations.
  6756. +- base::ThreadRestrictions::SetIOAllowed(false);
  6757. ++ base::ThreadRestrictions::SetIOAllowed(true);
  6758. +
  6759. + delegate_->Init();
  6760. +
  6761. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/3rdparty/chromium/net/disk_cache/backend_unittest.cc qt5_b/src/3rdparty/chromium/net/disk_cache/backend_unittest.cc
  6762. +--- qt5webengine-5.5.1/src/3rdparty/chromium/net/disk_cache/backend_unittest.cc 2015-10-13 06:36:53.000000000 +0200
  6763. ++++ qt5_b/src/3rdparty/chromium/net/disk_cache/backend_unittest.cc 2016-02-12 18:02:24.724514006 +0100
  6764. +@@ -463,7 +463,7 @@
  6765. + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
  6766. + net::TestCompletionCallback cb;
  6767. +
  6768. +- bool prev = base::ThreadRestrictions::SetIOAllowed(false);
  6769. ++ bool prev = base::ThreadRestrictions::SetIOAllowed(true);
  6770. + scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
  6771. + cache_path_, cache_thread.task_runner(), NULL));
  6772. + int rv = cache->Init(cb.callback());
  6773. +@@ -1972,7 +1972,7 @@
  6774. + base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
  6775. +
  6776. + net::TestCompletionCallback cb;
  6777. +- bool prev = base::ThreadRestrictions::SetIOAllowed(false);
  6778. ++ bool prev = base::ThreadRestrictions::SetIOAllowed(true);
  6779. + base::FilePath path(cache_path_);
  6780. + int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE,
  6781. + net::CACHE_BACKEND_BLOCKFILE,
  6782. +diff -aur '--exclude=*.pyc' '--exclude=*.o' '--exclude=*.h' '--exclude=*.a' '--exclude=*deps' '--exclude=*log*' '--exclude=*ninja*' '--exclude=*.gyp' '--exclude=*.pak' '--exclude=*.pickle' '--exclude=*.cache' '--exclude=*.py' '--exclude=*.idl' '--exclude=*.gypi' '--exclude=*.tmp' '--exclude=*.in' '--exclude=*.rc' qt5webengine-5.5.1/src/core/gl_surface_qt.cpp qt5_b/src/core/gl_surface_qt.cpp
  6783. +--- qt5webengine-5.5.1/src/core/gl_surface_qt.cpp 2015-10-13 06:36:54.000000000 +0200
  6784. ++++ qt5_b/src/core/gl_surface_qt.cpp 2016-02-14 11:38:43.661776602 +0100
  6785. +@@ -513,15 +513,20 @@
  6786. + return NULL;
  6787. + #endif
  6788. + }
  6789. +- case kGLImplementationEGLGLES2: {
  6790. ++ case kGLImplementationEGLGLES2: {
  6791. + scoped_refptr<GLSurface> surface = new GLSurfaceQtEGL(size);
  6792. + if (!surface->Initialize())
  6793. + return NULL;
  6794. + return surface;
  6795. + }
  6796. +- default:
  6797. +- Q_UNREACHABLE();
  6798. +- return NULL;
  6799. ++ default: {
  6800. ++ scoped_refptr<GLSurface> surface = new GLSurfaceQtEGL(size);
  6801. ++ if (!surface->Initialize())
  6802. ++ return NULL;
  6803. ++ return surface;
  6804. ++ }
  6805. ++// Q_UNREACHABLE();
  6806. ++// return NULL;
  6807. + }
  6808. + }
  6809. +
  6810. diff --git a/package/qt5/qt5webengine/qt5webengine.__hash b/package/qt5/qt5webengine/qt5webengine.__hash
  6811. new file mode 100644
  6812. index 0000000..b5ecd88
  6813. --- /dev/null
  6814. +++ b/package/qt5/qt5webengine/qt5webengine.__hash
  6815. @@ -0,0 +1,2 @@
  6816. +# Hash from: http://download.qt.io/official_releases/qt/5.5/5.5.1/submodules/qtwebengine-opensource-src-5.5.1.tar.xz.mirrorlist
  6817. +sha256 7c4d328dd305991aaf0c3450615f4a8e5d80152194bee6f5925bd8d3477e2b90 qtwebengine-opensource-src-5.5.1.tar.xz
  6818. diff --git a/package/qt5/qt5webengine/qt5webengine.mk b/package/qt5/qt5webengine/qt5webengine.mk
  6819. new file mode 100644
  6820. index 0000000..98c67a6
  6821. --- /dev/null
  6822. +++ b/package/qt5/qt5webengine/qt5webengine.mk
  6823. @@ -0,0 +1,70 @@
  6824. +################################################################################
  6825. +#
  6826. +# qt5webengine
  6827. +#
  6828. +################################################################################
  6829. +
  6830. +QT5WEBENGINE_VERSION = $(QT5_VERSION)
  6831. +QT5WEBENGINE_SITE = $(QT5_SITE)
  6832. +QT5WEBENGINE_SOURCE = qtwebengine-opensource-src-$(QT5WEBENGINE_VERSION).tar.xz
  6833. +QT5WEBENGINE_DEPENDENCIES = qt5base qt5declarative qt5webchannel libcap openssl host-gperf
  6834. +QT5WEBENGINE_INSTALL_STAGING = YES
  6835. +
  6836. +ifeq ($(BR2_PACKAGE_QT5BASE_LICENSE_APPROVED),y)
  6837. +QT5WEBENGINE_LICENSE = GPLv3 with exception or LGPLv3 or GPLv2
  6838. +# Source files contain references to LGPL_EXCEPTION.txt but it is not included
  6839. +# in the archive.
  6840. +QT5WEBENGINE_LICENSE_FILES = LICENSE.GPL2 LICENSE.GPL3 LICENSE.GPL3-EXCEPT LICENSE.GPLv3 LICENSE.LGPL3
  6841. +else
  6842. +QT5WEBENGINE_LICENSE = Commercial license
  6843. +QT5WEBENGINE_REDISTRIBUTE = NO
  6844. +endif
  6845. +
  6846. +ifeq ($(BR2_PACKAGE_QT5DECLARATIVE),y)
  6847. +QT5WEBENGINE_DEPENDENCIES += qt5declarative
  6848. +endif
  6849. +
  6850. +define QT5WEBENGINE_CONFIGURE_CMDS
  6851. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake WEBENGINE_CONFIG+=use_proprietary_codecs)
  6852. +endef
  6853. +
  6854. +define QT5WEBENGINE_BUILD_CMDS
  6855. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  6856. +endef
  6857. +
  6858. +define QT5WEBENGINE_INSTALL_STAGING_CMDS
  6859. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  6860. + $(QT5_LA_PRL_FILES_FIXUP)
  6861. +endef
  6862. +
  6863. +ifeq ($(BR2_PACKAGE_QT5DECLARATIVE_QUICK),y)
  6864. +define QT5WEBENGINE_INSTALL_TARGET_QMLS
  6865. + cp -dpfr $(STAGING_DIR)/usr/qml/QtWebEngine $(TARGET_DIR)/usr/qml/
  6866. +endef
  6867. +endif
  6868. +
  6869. +ifeq ($(BR2_PACKAGE_QT5BASE_EXAMPLES),y)
  6870. +define QT5WEBENGINE_INSTALL_TARGET_EXAMPLES
  6871. + cp -dpfr $(STAGING_DIR)/usr/lib/qt/examples/webengine* $(TARGET_DIR)/usr/lib/qt/examples/
  6872. +endef
  6873. +endif
  6874. +
  6875. +ifneq ($(BR2_STATIC_LIBS),y)
  6876. +define QT5WEBENGINE_INSTALL_TARGET_LIBS
  6877. + cp -dpf $(STAGING_DIR)/usr/lib/libQt5WebEngine*.so.* $(TARGET_DIR)/usr/lib
  6878. + #cp -dpfr $(STAGING_DIR)/usr/lib/qt/plugins/qtwebengine $(TARGET_DIR)/usr/lib/qt/plugins/
  6879. + cp -dpf $(STAGING_DIR)/usr/libexec/QtWebEngineProcess $(TARGET_DIR)/usr/libexec/
  6880. + mkdir -p $(TARGET_DIR)/usr/translations/qtwebengine_locales
  6881. + cp -dpfr $(STAGING_DIR)/usr/translations/qtwebengine_locales/* $(TARGET_DIR)/usr/translations/qtwebengine_locales/
  6882. + mkdir -p $(TARGET_DIR)/usr/resources
  6883. + cp -dpfr $(STAGING_DIR)/usr/resources/* $(TARGET_DIR)/usr/resources/
  6884. +endef
  6885. +endif
  6886. +
  6887. +define QT5WEBENGINE_INSTALL_TARGET_CMDS
  6888. + $(QT5WEBENGINE_INSTALL_TARGET_LIBS)
  6889. + $(QT5WEBENGINE_INSTALL_TARGET_QMLS)
  6890. + $(QT5WEBENGINE_INSTALL_TARGET_EXAMPLES)
  6891. +endef
  6892. +
  6893. +$(eval $(generic-package))
  6894. diff --git a/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch b/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch
  6895. new file mode 100644
  6896. index 0000000..b7b6791
  6897. --- /dev/null
  6898. +++ b/package/qt5/qt5webkit/0004-Fix-linking-with-libpthread.patch
  6899. @@ -0,0 +1,34 @@
  6900. +From 5dd4bb67cfce812fd7686e43616e2069f354a7df Mon Sep 17 00:00:00 2001
  6901. +From: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
  6902. +Date: Mon, 22 Feb 2016 10:57:32 +0100
  6903. +Subject: [PATCH] Fix linking with libpthread
  6904. +
  6905. +WebKit use libpthread directly but is depending on other qt modules
  6906. +causing it to be linked against, which might break unless -lpthread
  6907. +is last. Instead just add it explicitly after the static libraries.
  6908. +
  6909. +Upstream-Status: Backport from 5.7 branch
  6910. +
  6911. +Change-Id: I2b95cff2c96373f8dce6f95052c4fccbe1982b33
  6912. +Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
  6913. +Signed-off-by: Jonathan Liu <net147@gmail.com>
  6914. +Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
  6915. +---
  6916. + Tools/qmake/mkspecs/features/default_post.prf | 1 +
  6917. + 1 file changed, 1 insertion(+)
  6918. +
  6919. +diff --git a/Tools/qmake/mkspecs/features/default_post.prf b/Tools/qmake/mkspecs/features/default_post.prf
  6920. +index 67276b7..39bb3f7 100644
  6921. +--- a/Tools/qmake/mkspecs/features/default_post.prf
  6922. ++++ b/Tools/qmake/mkspecs/features/default_post.prf
  6923. +@@ -201,6 +201,7 @@ needToLink() {
  6924. + linkAgainstLibrary($$library, $$eval(WEBKIT.$${library_identifier}.root_source_dir))
  6925. + LIBS += $$eval(WEBKIT.$${library_identifier}.dependent_libs)
  6926. + }
  6927. ++ posix:!darwin: LIBS += -lpthread
  6928. + }
  6929. +
  6930. + creating_module {
  6931. +--
  6932. +2.7.1
  6933. +
  6934. diff --git a/package/qt5/qt5webkit/Config.in b/package/qt5/qt5webkit/Config.in
  6935. index 48aaf94..7add5f9 100644
  6936. --- a/package/qt5/qt5webkit/Config.in
  6937. +++ b/package/qt5/qt5webkit/Config.in
  6938. @@ -23,6 +23,6 @@ config BR2_PACKAGE_QT5WEBKIT
  6939. http://qt.io
  6940. comment "qt5webkit needs a toolchain w/ dynamic library"
  6941. - depends on BR2_STATIC_LIBS
  6942. - depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  6943. - depends on !BR2_BINFMT_FLAT
  6944. + depends on BR2_STATIC_LIBS
  6945. + depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
  6946. + depends on !BR2_BINFMT_FLAT
  6947. diff --git a/package/qt5/qt5webkit/qt5webkit.hash b/package/qt5/qt5webkit/qt5webkit.hash
  6948. index 96b8bdd..47e93c0 100644
  6949. --- a/package/qt5/qt5webkit/qt5webkit.hash
  6950. +++ b/package/qt5/qt5webkit/qt5webkit.hash
  6951. @@ -1,2 +1 @@
  6952. -# locally computed
  6953. -sha256 bdd659573e7e75cd4ad57b7160a7353d98d21a6fef06e4fb9e114a5b1f1e9dab qt5webkit-b35917bcb44d7f200af0f4ac68a126fa0aa8d93d.tar.gz
  6954. +sha256 1c79843ef32313312290d4fe0b87256a9129dc44d62b01789a692981edf4d8ab qt5webkit-d2ff5a085572b1ee24dcb42ae107063f3142d14e.tar.gz
  6955. diff --git a/package/qt5/qt5webkit/qt5webkit.mk b/package/qt5/qt5webkit/qt5webkit.mk
  6956. index 378cdf7..629e40a 100644
  6957. --- a/package/qt5/qt5webkit/qt5webkit.mk
  6958. +++ b/package/qt5/qt5webkit/qt5webkit.mk
  6959. @@ -4,13 +4,11 @@
  6960. #
  6961. ################################################################################
  6962. -QT5WEBKIT_VERSION = b35917bcb44d7f200af0f4ac68a126fa0aa8d93d
  6963. +QT5WEBKIT_VERSION = d2ff5a085572b1ee24dcb42ae107063f3142d14e
  6964. # Using GitHub since it supports downloading tarballs from random commits.
  6965. # The http://code.qt.io/cgit/qt/qtwebkit.git/ repo doesn't allow to do so.
  6966. QT5WEBKIT_SITE = $(call github,qtproject,qtwebkit,$(QT5WEBKIT_VERSION))
  6967. -QT5WEBKIT_DEPENDENCIES = \
  6968. - host-bison host-flex host-gperf host-python host-ruby \
  6969. - qt5base sqlite
  6970. +QT5WEBKIT_DEPENDENCIES = qt5base sqlite host-ruby host-gperf host-bison host-flex
  6971. QT5WEBKIT_INSTALL_STAGING = YES
  6972. QT5WEBKIT_LICENSE_FILES = Source/WebCore/LICENSE-LGPL-2 Source/WebCore/LICENSE-LGPL-2.1
  6973. @@ -33,16 +31,6 @@ ifeq ($(BR2_PACKAGE_QT5DECLARATIVE),y)
  6974. QT5WEBKIT_DEPENDENCIES += qt5declarative
  6975. endif
  6976. -# QtWebkit's build system uses python, but only supports python2. We work
  6977. -# around this by forcing python2 early in the PATH, via a python->python2
  6978. -# symlink.
  6979. -QT5WEBKIT_ENV = PATH=$(@D)/host-bin:$(BR_PATH)
  6980. -define QT5WEBKIT_PYTHON2_SYMLINK
  6981. - mkdir -p $(@D)/host-bin
  6982. - ln -sf $(HOST_DIR)/usr/bin/python2 $(@D)/host-bin/python
  6983. -endef
  6984. -QT5WEBKIT_PRE_CONFIGURE_HOOKS += QT5WEBKIT_PYTHON2_SYMLINK
  6985. -
  6986. # Since we get the source from git, generated header files are not included.
  6987. # qmake detects that header file generation (using the syncqt tool) must be
  6988. # done based on the existence of a .git directory (cfr. the git_build config
  6989. @@ -51,15 +39,15 @@ QT5WEBKIT_PRE_CONFIGURE_HOOKS += QT5WEBKIT_PYTHON2_SYMLINK
  6990. # create an empty .git directory.
  6991. define QT5WEBKIT_CONFIGURE_CMDS
  6992. mkdir -p $(@D)/.git
  6993. - (cd $(@D); $(TARGET_MAKE_ENV) $(QT5WEBKIT_ENV) $(HOST_DIR)/usr/bin/qmake)
  6994. + (cd $(@D); $(TARGET_MAKE_ENV) $(HOST_DIR)/usr/bin/qmake)
  6995. endef
  6996. define QT5WEBKIT_BUILD_CMDS
  6997. - $(TARGET_MAKE_ENV) $(QT5WEBKIT_ENV) $(MAKE) -C $(@D)
  6998. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
  6999. endef
  7000. define QT5WEBKIT_INSTALL_STAGING_CMDS
  7001. - $(TARGET_MAKE_ENV) $(QT5WEBKIT_ENV) $(MAKE) -C $(@D) install
  7002. + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install
  7003. $(QT5_LA_PRL_FILES_FIXUP)
  7004. endef
  7005. diff --git a/package/qt5/qt5websockets/qt5websockets.hash b/package/qt5/qt5websockets/qt5websockets.hash
  7006. index 3443476..067bd6f 100644
  7007. --- a/package/qt5/qt5websockets/qt5websockets.hash
  7008. +++ b/package/qt5/qt5websockets/qt5websockets.hash
  7009. @@ -1,2 +1 @@
  7010. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtwebsockets-opensource-src-5.6.2.tar.xz.mirrorlist
  7011. -sha256 3cd9d4bbff8e6be5e252f00fc9ecb9ac2d8a193020288c7d1e82583daeb5ba35 qtwebsockets-opensource-src-5.6.2.tar.xz
  7012. +sha256 741be11a907f82807a786e6a53ae7316c0b3864491b692e8719c381e0f158b43 qtwebsockets-opensource-src-5.7.0.tar.xz
  7013. diff --git a/package/qt5/qt5xmlpatterns/qt5xmlpatterns.hash b/package/qt5/qt5xmlpatterns/qt5xmlpatterns.hash
  7014. index fa4e97f..f0f369d 100644
  7015. --- a/package/qt5/qt5xmlpatterns/qt5xmlpatterns.hash
  7016. +++ b/package/qt5/qt5xmlpatterns/qt5xmlpatterns.hash
  7017. @@ -1,2 +1 @@
  7018. -# Hash from: http://download.qt.io/official_releases/qt/5.6/5.6.2/submodules/qtxmlpatterns-opensource-src-5.6.2.tar.xz.mirrorlist
  7019. -sha256 7c6df3eebf188d8ce6822a22cebbc63da5ac27047cf1bd7236d5b988244782cc qtxmlpatterns-opensource-src-5.6.2.tar.xz
  7020. +sha256 38882a4ea5d711be07d10695759359045f7f9d64727a65e1d5e6515d55c7e20b qtxmlpatterns-opensource-src-5.7.0.tar.xz
  7021. diff --git a/package/ti-gfx/S80ti-gfx b/package/ti-gfx/S80ti-gfx
  7022. index fc5999a..00f8394 100644
  7023. --- a/package/ti-gfx/S80ti-gfx
  7024. +++ b/package/ti-gfx/S80ti-gfx
  7025. @@ -3,14 +3,16 @@
  7026. start() {
  7027. echo "ti-gfx: starting pvr driver"
  7028. + TMPFB=`mktemp`
  7029. + cat /dev/fb0 > $TMPFB
  7030. BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
  7031. YRES="$(fbset | awk '/geom/ {print $3}')"
  7032. # Set RGBA ordering to something the drivers like
  7033. - if [ "$BITSPERPIXEL" = "32" ] ; then
  7034. - fbset -rgba 8/16,8/8,8/0,8/24
  7035. - fi
  7036. + #if [ "$BITSPERPIXEL" = "32" ] ; then
  7037. + # fbset -rgba 8/16,8/8,8/0,8/24
  7038. + #fi
  7039. # Try to enable triple buffering when there's enough VRAM
  7040. - fbset -vyres $(( YRES*3 ))
  7041. + #fbset -vyres $(( YRES*3 ))
  7042. modprobe pvrsrvkm
  7043. modprobe omaplfb
  7044. @@ -22,6 +24,14 @@ start() {
  7045. mknod /dev/pvrsrvkm c $pvr_maj 0
  7046. chmod 600 /dev/pvrsrvkm
  7047. + #-- cursor off
  7048. + echo -e "\033[?25l\033[9;0]\033[14;0]" > /dev/tty0
  7049. + # -- disa screensaver
  7050. + echo 0 > /sys/class/graphics/fb0/blank
  7051. +
  7052. + cat $TMPFB > /dev/fb0
  7053. + rm $TMPFB
  7054. +
  7055. if ! /usr/bin/pvrsrvctl --start --no-module; then
  7056. echo "ti-gfx: unable to start server"
  7057. fi
  7058. diff --git a/package/ti-gfx/powervr.ini b/package/ti-gfx/powervr.ini
  7059. index 8d2d853..cceecdd 100644
  7060. --- a/package/ti-gfx/powervr.ini
  7061. +++ b/package/ti-gfx/powervr.ini
  7062. @@ -1,2 +1,4 @@
  7063. [default]
  7064. -WindowSystem=libpvrPVR2D_FRONTWSEGL.so
  7065. +#WindowSystem=libpvrPVR2D_FRONTWSEGL.so
  7066. +WindowSystem=libpvrPVR2D_FLIPWSEGL.so
  7067. +ParamBufferSize=16777216
  7068. diff --git a/package/ti-sgx-km/ti-sgx-km.mk b/package/ti-sgx-km/ti-sgx-km.mk
  7069. index 48c8a6d..05e1cca 100644
  7070. --- a/package/ti-sgx-km/ti-sgx-km.mk
  7071. +++ b/package/ti-sgx-km/ti-sgx-km.mk
  7072. @@ -5,7 +5,8 @@
  7073. ################################################################################
  7074. # This correpsonds to SDK 02.00.00.00
  7075. -TI_SGX_KM_VERSION = 2b7523d07a13ab704a24a7664749551f4a13ed32
  7076. +#TI_SGX_KM_VERSION = 2b7523d07a13ab704a24a7664749551f4a13ed32
  7077. +TI_SGX_KM_VERSION = remotes/origin/ti-img-sgx/1.14.3699939/k4.4
  7078. TI_SGX_KM_SITE = git://git.ti.com/graphics/omap5-sgx-ddk-linux.git
  7079. TI_SGX_KM_LICENSE = GPLv2
  7080. TI_SGX_KM_LICENSE_FILES = GPL-COPYING
  7081. @@ -18,7 +19,7 @@ TI_SGX_KM_MAKE_OPTS = \
  7082. PVR_NULLDRM=1
  7083. ifeq ($(BR2_PACKAGE_TI_SGX_AM335X),y)
  7084. -TI_SGX_KM_PLATFORM_NAME = omap335x
  7085. +TI_SGX_KM_PLATFORM_NAME = omap
  7086. else ifeq ($(BR2_PACKAGE_TI_SGX_AM437X),y)
  7087. TI_SGX_KM_PLATFORM_NAME = omap437x
  7088. else ifeq ($(BR2_PACKAGE_TI_SGX_AM4430),y)
  7089. @@ -38,6 +39,8 @@ define TI_SGX_KM_INSTALL_TARGET_CMDS
  7090. $(TARGET_MAKE_ENV) $(MAKE) $(TI_SGX_KM_MAKE_OPTS) \
  7091. DISCIMAGE=$(TARGET_DIR) \
  7092. kbuild_install -C $(@D)/$(TI_SGX_KM_SUBDIR)
  7093. + echo ">>>>>>>>>"
  7094. + sleep 10
  7095. endef
  7096. $(eval $(generic-package))
  7097. diff --git a/package/ti-sgx-um/ti-sgx-um.mk b/package/ti-sgx-um/ti-sgx-um.mk
  7098. index d5c50a0..76a7663 100644
  7099. --- a/package/ti-sgx-um/ti-sgx-um.mk
  7100. +++ b/package/ti-sgx-um/ti-sgx-um.mk
  7101. @@ -6,6 +6,7 @@
  7102. # This correpsonds to SDK 02.00.00.00
  7103. TI_SGX_UM_VERSION = e15f1543bab4de9e8927a2c4934addf3fd16ffcb
  7104. +#TI_SGX_UM_VERSION = glsdk_7.04.00.03
  7105. TI_SGX_UM_SITE = git://git.ti.com/graphics/omap5-sgx-ddk-um-linux.git
  7106. TI_SGX_UM_LICENSE = TI TSPA License
  7107. TI_SGX_UM_LICENSE_FILES = OMAP5-Linux-Graphics-DDK-UM-Manifest.doc