- GCC के लिए Rust frontend gccrs ने 2026 की पहली छमाही में Linux kernel crates को टेस्ट करते हुए attribute processing, name resolution और resource management समस्याओं को ठीक किया, और अब kernel code की सही execution semantics लागू करने पर ध्यान दे रहा है
- LLVM जिन architectures को support नहीं करता और मौजूदा GCC plugin ecosystem का लाभ उठाने के लिए GCC-आधारित Rust compiler की ज़रूरत है, और इससे Linux distributions को toolchain चुनने का विकल्प भी मिल सकता है
- सही code generation के लिए control flow के अनुसार dynamic drop flag analysis ज़रूरी है; इसके बिना
MutexGuardlock release नहीं कर सकता, जिससे synchronization failure या deadlock हो सकता है - असली kernel crates को compile करते समय Rust के तीन namespaces को गलत तरीके से संभालने वाली name resolution संरचना,
#[cfg()]processing order, और nested modules को छोड़ देने वाली crate metadata समस्या सामने आई, जिसके कारण बड़े पैमाने पर rework चल रहा है no_coreprograms औरcore,compiler_builtinssupport में प्रगति हुई है, लेकिन पूर्ण kernel compilation के लिएallocsupport और सही execution semantics अभी और चाहिए, साथ ही GCC upstream integration के लिए review और coordination भी बाकी है
Linux kernel को test target के रूप में क्यों चुना गया
- gccrs GCC के लिए Rust frontend विकसित करने वाला प्रोजेक्ट है, जिसने 2026 की पहली छमाही में Linux kernel compilation पर फोकस किया
- kernel crates को टेस्ट करते हुए attribute processing, name resolution और resource management समस्याएँ खोजी और ठीक की गईं
- अभी यह केवल सरल standalone programs को संभाल सकता है, लेकिन kernel code पर testing से अन्य Rust programs के लिए भी सही code generation में प्रगति मिल रही है
- प्रगति प्रोजेक्ट की weekly reports और monthly reports में दर्ज है
- अभी Linux kernel का Rust code LLVM-आधारित
rustcका उपयोग करता हैrustcमें GCC को backend के रूप में इस्तेमाल करने वाला experimental rust_codegen_gcc भी विकसित किया जा रहा है- GCC-आधारित विकल्प उन architectures के support और मौजूदा GCC plugin ecosystem के integration के लिए ज़रूरी है जिन्हें LLVM target नहीं करता
- kernel में Rust integration के mature होने के साथ Linux distributions toolchain flexibility और GCC-आधारित compiler की availability को प्राथमिकता दे रहे हैं
GCC version की जगह capabilities पर आधारित milestones
- gccrs टीम ने मार्च 2026 रिपोर्ट में किसी खास GCC version को target करने के बजाय काम की संरचना को तीन capability-based milestones में बदल दिया
- embedded Rust compiler: केवल
coreपर निर्भरno_stdprograms को compile करता है - Rust for Linux compiler:
coreऔर kernel में उपयोग होने वाले कुछ specific crates को support करता है - general-purpose compiler: kernel environment से आगे बढ़कर अधिक व्यापक Rust applications को संभालता है
- embedded Rust compiler: केवल
- पहला milestone अभी पूरा नहीं हुआ है, लेकिन लगभग पहुँच चुका है, और Rust for Linux milestone पर काम भी शुरू हो चुका है
- मार्च 2026 में kernel build के लिए ज़रूरी low-level crate compiler_builtins support जोड़ा गया और kernel के
fficrate की समस्याओं को सुलझाने पर फोकस किया गया - Zhi Heng मई 2026 में Open Source Security internship के तहत जुड़े
- gccrs द्वारा kernel crates compile करते समय आने वाले bugs को ठीक किया
- regressions रोकने के लिए continuous integration tests बनाए
- सिर्फ Rust code को crash के बिना संभाल लेना काफ़ी नहीं है; generated code का सही तरह से काम करना भी ज़रूरी है
- idiomatic Rust code, C की तुलना में destructor semantics का अधिक उपयोग करता है, इसलिए
Dropimplementation सही code generation का मुख्य हिस्सा है
- idiomatic Rust code, C की तुलना में destructor semantics का अधिक उपयोग करता है, इसलिए
सही resource release के लिए Drop infrastructure
- Rust resource acquisition is initialization यानी RAII model से resources manage करता है, और जब कोई value scope से बाहर जाती है तो compiler अपने-आप Drop trait में परिभाषित destructor को call करता है
- variables की initialization state function के अंदर control flow के अनुसार बदल सकती है
- अगर कोई value conditionally move हुई हो या केवल आंशिक रूप से initialized हो, तो scope के अंत में उसे बिना शर्त drop नहीं किया जा सकता
- frontend को control-flow graph का analysis करके dynamic drop flag बनाना होता है, जो runtime पर यह रिकॉर्ड करने वाला boolean variable है कि value को drop करना है या नहीं, और फिर इसे GCC backend तक भेजना होता है
- शुरुआती gccrs
Dropimplementation में यह analysis नहीं था, इसलिए कुछDrop::drop()calls छूट गए या गलत generate हुए - Linux kernel में
Dropcall छूट जाने से memory leaks और system resources वापस न मिलने जैसी गंभीर runtime समस्याएँ हो सकती हैं- lock लेने पर Rust for Linux API
MutexGuardलौटाता है - इस guard का
Dropimplementation lock release करने का काम करता है - सही
Dropcall न होने पर guard के scope से बाहर जाने के बाद भी lock बना रह सकता है, जिससे synchronization failure या deadlock हो सकता है
- lock लेने पर Rust for Linux API
- GSoC participant Janet Chien मई 2026 में जुड़ीं और gccrs के
Dropinfrastructure बनाने पर फोकस कर रही हैं
Rust namespaces के अनुरूप name resolution का पुनर्लेखन
- standard library और kernel crates की testing से gccrs के बुनियादी name resolution bugs सामने आए
- प्रोजेक्ट इन समस्याओं में से कई को पहले से जानता था और 2023 से name resolution को अलग से सुधार रहा था
- Rust तीन namespaces को अलग रखता है
- value namespace में functions और static variables आते हैं
- macro namespace में macros आते हैं
- type namespace में structs, modules और traits आते हैं
crate::foo::barजैसे paths को process करने के लिए यह पहचानना ज़रूरी है कि हर identifier segment किस namespace से संबंधित है- पहले gccrs पूरा path उसी एक namespace में resolve करता था जो अंत में खोजी जा रही item type से मेल खाता था
- function खोजते समय वह path के सभी segments को value namespace में resolve करता था
- लेकिन modules और public imports type namespace में होते हैं, इसलिए function तक पहुँचने के लिए पहले module structure को type namespace में follow करना पड़ता है
- इसे ठीक करने के लिए internal data structures को दोबारा लिखना पड़ा और पूरे codebase में visitor implementations को refactor करना पड़ा
- मई 2026 तक
corecrate के गहराई से nested imports को सही तरीके से resolve करना संभव हो गया - modules और imports को type namespace में insert करने से व्यवहार
rustcके अधिक करीब हो गया
- मई 2026 तक
conditional attributes और compiler options में सुधार
- kernel crates compile करते समय gccrs की compiler attribute processing और crate metadata समस्याएँ भी सामने आईं
- Rust
#[cfg()]जैसे attributes से conditional compilation करता है - Pierre-Emmanuel Patry ने फ़रवरी 2026 में attribute processing pipeline को फिर से तैयार किया
cfgattributes से exclude की गई items हटाने वाले compiler pass को दो चरणों में बाँटा- kernel की कुछ unstable features macro expansion या conditional attributes पर निर्भर करती हैं
- validation process में compile errors से बचने के लिए ऐसे attributes को मुख्य attribute validation pass से पहले हटाना ज़रूरी है
- मार्च 2026 में
rustcके-Zcrate-attrके समकक्ष-frust-crate-attroption जोड़ा गया- build systems अब source files बदले बिना compiler invocation के समय attributes inject कर सकते हैं
- यह standard
corelibrary के बिना code compile करने के लिए ज़रूरी#![no_core]पास करने में उपयोगी है - compiler fuzzing करने वाले developers भी edge-case bugs खोजने के लिए इस feature का उपयोग करते हैं
असली kernel code में सामने आई metadata omissions
- Rust crates आम तौर पर
.rlibfiles में शामिल metadata export करते हैं, ताकि अन्य crates तक public API पहुँच सके - kernel के Rust crates को link करते समय यह पाया गया कि generated metadata से कुछ modules और exports गायब थे
- gccrs metadata generation के दौरान nested modules के exports छोड़ दे रहा था
- इसके कारण external dependencies resolve नहीं हो पा रही थीं
- मौजूदा metadata tests flat module structures का उपयोग करते थे, इसलिए यह समस्या पकड़ में नहीं आई; bug असली code compile करने के बाद ही सामने आया
- GNU toolchain के साथ kernel dependency tree को link करने के लिए metadata processing system पर बड़े पैमाने पर rework शुरू किया गया
मौजूदा support scope और GCC upstream constraints
- अभी gccrs standalone
no_coreprograms को सफलतापूर्वक संभाल सकता है corecrate processing औरcompiler_builtinsimplementation में भी काफ़ी प्रगति हुई है, लेकिन kernel की जटिल Rust abstractions को पूरी तरह compile करने का काम अभी जारी है- kernel code को parse किया जा सकता है
- अभी फोकस runtime semantics को सही तरीके से लागू करने पर है
- तकनीकी चुनौतियों के साथ GNU toolchain की organizational constraints भी पार करनी हैं
- तेज़ी से बदलते नए language frontend को पूरी तरह GCC में integrate करना बहुत बड़ा काम है
- बड़े patch sets कभी-कभी GCC upstream की सीमित review capacity से आगे निकल गए
- frontend structure के स्थिर होने के साथ स्थिति में सुधार हुआ है
- हाल में gccrs के दो developers को GCC maintainers बनाया गया
- अब वे अपने tree में updates तैयार करके एक साथ apply कर सकते हैं
alloc support और आगे की प्रस्तुतियाँ
- GSoC participant Enes Çevik मई 2026 में जुड़े और alloc crate support implement कर रहे हैं
allocdynamic memory allocation types जैसेBox,Rc,Vecको संभालता है- kernel development कई standard library abstractions से बचता है, लेकिन कुछ मुख्य Rust kernel abstractions allocation types पर निर्भर करती हैं
- इसलिए
allocsupport, Rust for Linux milestone की अनिवार्य शर्त है
- Patry और Arthur Cohen 2026 के उत्तरार्ध में Montreal के RustConf और Barcelona के EuroRust में “Compiling the Linux kernel with gccrs” पर प्रस्तुति देने की योजना बना रहे हैं
- kernel code जिन features की मांग करता है उन्हें क्रमशः लागू करते हुए, GCC के साथ Linux kernel ecosystem के Rust code को compile करने की बुनियाद तैयार की जा रही है
अभी कोई टिप्पणी नहीं है.